|
|
|
@ -175,7 +175,8 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
.toReturn(this.deviceAccessAuthorizationService);
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -194,19 +195,23 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, null, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, true, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, true,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -319,7 +324,7 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
.toReturn(this.deviceManagementProviderService);
|
|
|
|
|
Mockito.when(deviceAccessAuthorizationService.isDeviceAdminUser()).thenReturn(true);
|
|
|
|
|
deviceManagementService.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null,
|
|
|
|
|
DEFAULT_ROLE, DEFAULT_OWNERSHIP, DEFAULT_STATUS_LIST, 1,
|
|
|
|
|
DEFAULT_ROLE, DEFAULT_OWNERSHIP, null, DEFAULT_STATUS_LIST, 1,
|
|
|
|
|
null, null, false, 10, 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -339,11 +344,11 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP
|
|
|
|
|
, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, null, DEFAULT_USERNAME, DEFAULT_ROLE, DEFAULT_OWNERSHIP
|
|
|
|
|
, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -365,7 +370,8 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, "newuser", null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.UNAUTHORIZED.getStatusCode());
|
|
|
|
|
Mockito.reset(this.deviceAccessAuthorizationService);
|
|
|
|
|
}
|
|
|
|
@ -386,15 +392,18 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, true, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, true,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, null, "ErrorModifiedSince", false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, null, "ErrorModifiedSince",
|
|
|
|
|
false, 10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -414,15 +423,18 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, since, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, since, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, since, null, true, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, since, null, true,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
|
|
|
|
|
response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 0, "ErrorSince", null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 0, "ErrorSince", null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -444,7 +456,8 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
|
|
|
|
|
Mockito.reset(this.deviceManagementProviderService);
|
|
|
|
|
}
|
|
|
|
@ -466,7 +479,8 @@ public class DeviceManagementServiceImplTest {
|
|
|
|
|
|
|
|
|
|
Response response = this.deviceManagementService
|
|
|
|
|
.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
|
|
|
|
|
DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5);
|
|
|
|
|
null, DEFAULT_STATUS_LIST, 1, null, null, false,
|
|
|
|
|
10, 5);
|
|
|
|
|
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
|
|
|
|
|
Mockito.reset(this.deviceAccessAuthorizationService);
|
|
|
|
|
}
|
|
|
|
|