mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding some testcases for the invalid devices, and parameters.
This commit is contained in:
parent
87bab1acc2
commit
bd04e3d8b2
@ -357,14 +357,16 @@ public class OperationManagementTests extends BaseDeviceManagementTest {
|
|||||||
@Test(dependsOnMethods = "getNextPendingOperation")
|
@Test(dependsOnMethods = "getNextPendingOperation")
|
||||||
public void getOperationByDeviceAndOperationId() throws OperationManagementException {
|
public void getOperationByDeviceAndOperationId() throws OperationManagementException {
|
||||||
DeviceIdentifier deviceIdentifier = this.deviceIds.get(0);
|
DeviceIdentifier deviceIdentifier = this.deviceIds.get(0);
|
||||||
String operationId = this.commandActivity.getActivityId().
|
|
||||||
replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, "");
|
|
||||||
Operation operation = this.operationMgtService.getOperationByDeviceAndOperationId(deviceIdentifier,
|
Operation operation = this.operationMgtService.getOperationByDeviceAndOperationId(deviceIdentifier,
|
||||||
Integer.parseInt(operationId));
|
getOperationId(this.commandActivity.getActivityId()));
|
||||||
Assert.assertTrue(operation.getStatus().equals(Operation.Status.COMPLETED));
|
Assert.assertTrue(operation.getStatus().equals(Operation.Status.COMPLETED));
|
||||||
Assert.assertTrue(operation.getType().equals(Operation.Type.COMMAND));
|
Assert.assertTrue(operation.getType().equals(Operation.Type.COMMAND));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getOperationId(String activityId) {
|
||||||
|
return Integer.parseInt(activityId.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, ""));
|
||||||
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "getNextPendingOperation", expectedExceptions = OperationManagementException.class)
|
@Test(dependsOnMethods = "getNextPendingOperation", expectedExceptions = OperationManagementException.class)
|
||||||
public void getOperationByDeviceAndOperationIdNonAdmin() throws OperationManagementException {
|
public void getOperationByDeviceAndOperationIdNonAdmin() throws OperationManagementException {
|
||||||
startTenantFlowAsNonAdmin();
|
startTenantFlowAsNonAdmin();
|
||||||
@ -493,7 +495,7 @@ public class OperationManagementTests extends BaseDeviceManagementTest {
|
|||||||
|
|
||||||
@Test(dependsOnMethods = "getOperationForInactiveDevice", expectedExceptions = OperationManagementException.class)
|
@Test(dependsOnMethods = "getOperationForInactiveDevice", expectedExceptions = OperationManagementException.class)
|
||||||
public void getPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, OperationManagementException {
|
public void getPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, OperationManagementException {
|
||||||
this.operationMgtService.getPendingOperations(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE));
|
this.operationMgtService.getPendingOperations(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "getPendingOperationDeviceForInvalidDevice", expectedExceptions = OperationManagementException.class)
|
@Test(dependsOnMethods = "getPendingOperationDeviceForInvalidDevice", expectedExceptions = OperationManagementException.class)
|
||||||
@ -501,4 +503,38 @@ public class OperationManagementTests extends BaseDeviceManagementTest {
|
|||||||
this.operationMgtService.getNextPendingOperation(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE));
|
this.operationMgtService.getNextPendingOperation(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getNextPendingOperationDeviceForInvalidDevice", expectedExceptions = OperationManagementException.class)
|
||||||
|
public void getUpdateOperationForInvalidDevice() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.updateOperation(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), getOperation(new CommandOperation(),
|
||||||
|
Operation.Type.COMMAND, COMMAND_OPERATON_CODE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getUpdateOperationForInvalidDevice", expectedExceptions = OperationManagementException.class)
|
||||||
|
public void getOperationByDeviceAndOperationIdInvalidDevice() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.getOperationByDeviceAndOperationId(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE),
|
||||||
|
getOperationId(this.commandActivity.getActivityId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getOperationByDeviceAndOperationIdInvalidDevice", expectedExceptions = OperationManagementException.class)
|
||||||
|
public void getOperationsByDeviceAndStatusInvalidDevice() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.getOperationsByDeviceAndStatus(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE),
|
||||||
|
Operation.Status.PENDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getOperationsByDeviceAndStatusInvalidDevice", expectedExceptions = OperationManagementException.class)
|
||||||
|
public void getOperationsInvalidOperationId() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.getOperation(123445);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getOperationsInvalidOperationId", expectedExceptions = IllegalArgumentException.class)
|
||||||
|
public void getOperationsByActivityIdInvalidActivityId() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.getOperationByActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "getOperationsByActivityIdInvalidActivityId", expectedExceptions = IllegalArgumentException.class)
|
||||||
|
public void getOperationByActivityIdAndDeviceInvalidActivityId() throws DeviceManagementException, OperationManagementException {
|
||||||
|
this.operationMgtService.getOperationByActivityIdAndDevice(DeviceManagementConstants.OperationAttributes.ACTIVITY + 0,
|
||||||
|
new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user