|
|
@ -141,15 +141,19 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
datasourceField.setAccessible(true);
|
|
|
|
datasourceField.setAccessible(true);
|
|
|
|
dataSource = (MockDataSource) getDataSource();
|
|
|
|
dataSource = (MockDataSource) getDataSource();
|
|
|
|
dataSource.setConnection(new MockConnection(dataSource.getUrl()));
|
|
|
|
dataSource.setConnection(new MockConnection(dataSource.getUrl()));
|
|
|
|
|
|
|
|
|
|
|
|
MockConnection connection = new MockConnection(dataSource.getUrl());
|
|
|
|
MockConnection connection = new MockConnection(dataSource.getUrl());
|
|
|
|
dataSource.setConnection(connection);
|
|
|
|
dataSource.setConnection(connection);
|
|
|
|
MockStatement mockStatement = new MockStatement();
|
|
|
|
MockStatement mockStatement = new MockStatement();
|
|
|
|
MockResultSet resultSet = new MockResultSet();
|
|
|
|
MockResultSet resultSet = new MockResultSet();
|
|
|
|
resultSet.addInteger(1);
|
|
|
|
resultSet.addInteger(1);
|
|
|
|
resultSet.addString(null);
|
|
|
|
resultSet.addString(null);
|
|
|
|
|
|
|
|
|
|
|
|
mockStatement.addResultSet(resultSet);
|
|
|
|
mockStatement.addResultSet(resultSet);
|
|
|
|
connection.addMockStatement(mockStatement);
|
|
|
|
connection.addMockStatement(mockStatement);
|
|
|
|
|
|
|
|
|
|
|
|
datasourceField.set(datasourceField, dataSource);
|
|
|
|
datasourceField.set(datasourceField, dataSource);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
boolean enrollmentStatus = deviceMgtService.enrollDevice(device);
|
|
|
|
boolean enrollmentStatus = deviceMgtService.enrollDevice(device);
|
|
|
@ -168,7 +172,9 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
deviceIdentifier.setId(DEVICE_ID);
|
|
|
|
deviceIdentifier.setId(DEVICE_ID);
|
|
|
|
deviceIdentifier.setType(DEVICE_TYPE);
|
|
|
|
deviceIdentifier.setType(DEVICE_TYPE);
|
|
|
|
boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier);
|
|
|
|
boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier);
|
|
|
|
Assert.assertTrue(enrollmentStatus);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(enrollmentStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -195,43 +201,48 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testReEnrollmentofSameDeviceUnderSameUser() throws DeviceManagementException {
|
|
|
|
public void testReEnrollmentofSameDeviceUnderSameUser() throws DeviceManagementException {
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
if (!isMock()) {
|
|
|
|
boolean enrollment = deviceMgtService.enrollDevice(device);
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
Assert.assertTrue(enrollment);
|
|
|
|
boolean enrollment = deviceMgtService.enrollDevice(device);
|
|
|
|
|
|
|
|
Assert.assertTrue(enrollment);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
|
|
|
|
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
|
|
|
|
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
|
|
|
|
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
|
|
|
|
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
|
|
|
|
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
|
|
|
|
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
|
|
|
|
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
|
|
|
|
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
|
|
|
|
enrolmentInfo.setOwner("user1");
|
|
|
|
enrolmentInfo.setOwner("user1");
|
|
|
|
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
|
|
|
|
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
|
|
|
|
enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
|
|
|
|
enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
|
|
|
|
|
|
|
|
|
|
|
|
Device alternateDevice = TestDataHolder.generateDummyDeviceData(DEVICE_ID, DEVICE_TYPE,
|
|
|
|
Device alternateDevice = TestDataHolder.generateDummyDeviceData(DEVICE_ID, DEVICE_TYPE,
|
|
|
|
enrolmentInfo);
|
|
|
|
enrolmentInfo);
|
|
|
|
Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
DEVICE_TYPE));
|
|
|
|
DEVICE_TYPE));
|
|
|
|
|
|
|
|
|
|
|
|
deviceMgtService.enrollDevice(alternateDevice);
|
|
|
|
deviceMgtService.enrollDevice(alternateDevice);
|
|
|
|
Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
|
|
|
|
Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
|
|
|
|
.getDeviceIdentifier(), alternateDevice.getType()));
|
|
|
|
.getDeviceIdentifier(), alternateDevice.getType()));
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
(retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
(retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
|
|
|
|
public void testDisenrollment() throws DeviceManagementException {
|
|
|
|
public void testDisenrollment() throws DeviceManagementException {
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
if (!isMock()) {
|
|
|
|
boolean disenrollmentStatus = deviceMgtService.disenrollDevice(new DeviceIdentifier
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
boolean disenrollmentStatus = deviceMgtService.disenrollDevice(new DeviceIdentifier
|
|
|
|
log.info(disenrollmentStatus);
|
|
|
|
(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
log.info(disenrollmentStatus);
|
|
|
|
Assert.assertTrue(disenrollmentStatus);
|
|
|
|
Assert.assertTrue(disenrollmentStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"}, expectedExceptions =
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"}, expectedExceptions =
|
|
|
@ -260,23 +271,29 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testDisenrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testDisenrollment"})
|
|
|
|
public void testDisenrollAlreadyDisEnrolledDevice() throws DeviceManagementException {
|
|
|
|
public void testDisenrollAlreadyDisEnrolledDevice() throws DeviceManagementException {
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
if (!isMock()) {
|
|
|
|
DEVICE_TYPE));
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
boolean result = deviceMgtService.disenrollDevice(new DeviceIdentifier(
|
|
|
|
DEVICE_TYPE));
|
|
|
|
device.getDeviceIdentifier(), device.getType()));
|
|
|
|
boolean result = deviceMgtService.disenrollDevice(new DeviceIdentifier(
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviceCount() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceCount() throws DeviceManagementException {
|
|
|
|
int count = deviceMgtService.getDeviceCount();
|
|
|
|
int count = deviceMgtService.getDeviceCount();
|
|
|
|
Assert.assertTrue(count > 0);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(count > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviceCountForUser() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceCountForUser() throws DeviceManagementException {
|
|
|
|
int count = deviceMgtService.getDeviceCount(TestDataHolder.OWNER);
|
|
|
|
int count = deviceMgtService.getDeviceCount(TestDataHolder.OWNER);
|
|
|
|
Assert.assertTrue(count > 0);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(count > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -325,12 +342,16 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviceEnrolledTenants() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceEnrolledTenants() throws DeviceManagementException {
|
|
|
|
List<Integer> tenants = deviceMgtService.getDeviceEnrolledTenants();
|
|
|
|
List<Integer> tenants = deviceMgtService.getDeviceEnrolledTenants();
|
|
|
|
Assert.assertEquals(tenants.size(), 1);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertEquals(tenants.size(), 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDevice() throws DeviceManagementException {
|
|
|
|
public void testGetDevice() throws DeviceManagementException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(device.getDeviceIdentifier().equalsIgnoreCase(DEVICE_ID));
|
|
|
|
Assert.assertTrue(device.getDeviceIdentifier().equalsIgnoreCase(DEVICE_ID));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -339,12 +360,17 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
public void testGetDeviceWithInfo() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceWithInfo() throws DeviceManagementException {
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)
|
|
|
|
, true);
|
|
|
|
, true);
|
|
|
|
Assert.assertTrue(device.getDeviceInfo() != null);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(device.getDeviceInfo() != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviceTypeWithProps() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceTypeWithProps() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
Device device = deviceMgtService.getDeviceWithTypeProperties(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
Device device = deviceMgtService.getDeviceWithTypeProperties(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(!device.getProperties().isEmpty());
|
|
|
|
Assert.assertTrue(!device.getProperties().isEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -352,12 +378,16 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
public void testGetDeviceWithOutInfo() throws DeviceManagementException {
|
|
|
|
public void testGetDeviceWithOutInfo() throws DeviceManagementException {
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)
|
|
|
|
, false);
|
|
|
|
, false);
|
|
|
|
Assert.assertTrue(device.getDeviceInfo() == null);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(device.getDeviceInfo() == null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesOfRole() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesOfRole() throws DeviceManagementException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevicesOfRole("admin");
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevicesOfRole("admin");
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(devices.size() > 0);
|
|
|
|
Assert.assertTrue(devices.size() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -394,7 +424,9 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
public void testDeviceByOwner() throws DeviceManagementException {
|
|
|
|
public void testDeviceByOwner() throws DeviceManagementException {
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
DEVICE_TYPE), "admin", true);
|
|
|
|
DEVICE_TYPE), "admin", true);
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
@ -443,13 +475,10 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
addDeviceInformation(initialDevice);
|
|
|
|
addDeviceInformation(initialDevice);
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
DEVICE_TYPE), yesterday());
|
|
|
|
DEVICE_TYPE), yesterday());
|
|
|
|
if (isMock()) {
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
if (dataSource != null) {
|
|
|
|
if (!isMock()) {
|
|
|
|
dataSource.reset();
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MockResultSet getMockGetDeviceResult() {
|
|
|
|
private MockResultSet getMockGetDeviceResult() {
|
|
|
@ -458,7 +487,7 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
resultSet.addString("Test");
|
|
|
|
resultSet.addString("Test");
|
|
|
|
resultSet.addString(null);
|
|
|
|
resultSet.addString(null);
|
|
|
|
resultSet.addString(DEVICE_TYPE);
|
|
|
|
resultSet.addString(DEVICE_TYPE);
|
|
|
|
resultSet.addString(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE).toString());
|
|
|
|
resultSet.addString(DEVICE_ID);
|
|
|
|
resultSet.addInteger(0);
|
|
|
|
resultSet.addInteger(0);
|
|
|
|
resultSet.addString("admin");
|
|
|
|
resultSet.addString("admin");
|
|
|
|
resultSet.addString("BYOD");
|
|
|
|
resultSet.addString("BYOD");
|
|
|
@ -495,9 +524,11 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testDeviceByDate"})
|
|
|
|
@Test(dependsOnMethods = {"testDeviceByDate"})
|
|
|
|
public void testDeviceByDateAndOwner() throws DeviceManagementException {
|
|
|
|
public void testDeviceByDateAndOwner() throws DeviceManagementException {
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
if (!isMock()) {
|
|
|
|
DEVICE_TYPE), "admin", yesterday(), true);
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
DEVICE_TYPE), "admin", yesterday(), true);
|
|
|
|
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -509,16 +540,48 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevices() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevices() throws DeviceManagementException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevices();
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevices();
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MockDataSource setDatasourceForGetDevice() throws IllegalAccessException, NoSuchFieldException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = null;
|
|
|
|
|
|
|
|
if (isMock()) {
|
|
|
|
|
|
|
|
Field datasourceField = DeviceManagementDAOFactory.class.getDeclaredField("dataSource");
|
|
|
|
|
|
|
|
datasourceField.setAccessible(true);
|
|
|
|
|
|
|
|
dataSource = (MockDataSource) getDataSource();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//connection used for first get device operation.
|
|
|
|
|
|
|
|
MockConnection connection = new MockConnection(dataSource.getUrl());
|
|
|
|
|
|
|
|
dataSource.setConnection(connection);
|
|
|
|
|
|
|
|
MockStatement mockStatement = new MockStatement();
|
|
|
|
|
|
|
|
mockStatement.addResultSet(getMockGetDeviceResult());
|
|
|
|
|
|
|
|
connection.addMockStatement(mockStatement);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
datasourceField.set(datasourceField, dataSource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dataSource;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void cleanupMockDatasource(MockDataSource dataSource) {
|
|
|
|
|
|
|
|
if (isMock()) {
|
|
|
|
|
|
|
|
if (dataSource != null) {
|
|
|
|
|
|
|
|
dataSource.reset();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesPaginated() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesPaginated() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
request.setOwnerRole("admin");
|
|
|
|
request.setOwnerRole("admin");
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
PaginationResult result = deviceMgtService.getAllDevices(request);
|
|
|
|
PaginationResult result = deviceMgtService.getAllDevices(request);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -530,59 +593,92 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesByName() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesByName() throws DeviceManagementException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID);
|
|
|
|
request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID);
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
|
|
|
|
if (dataSource != null) {
|
|
|
|
|
|
|
|
setMockDeviceCount(dataSource.getConnection(0));
|
|
|
|
|
|
|
|
}
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByName(request);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByName(request);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesByNameAndType() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesByNameAndType() throws DeviceManagementException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID);
|
|
|
|
request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID);
|
|
|
|
request.setDeviceType(DEVICE_TYPE);
|
|
|
|
request.setDeviceType(DEVICE_TYPE);
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesByNameAndType(request, true);
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesByNameAndType(request, true);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesByStatus() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesByStatus() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
request.setStatus(EnrolmentInfo.Status.ACTIVE.toString());
|
|
|
|
request.setStatus(EnrolmentInfo.Status.ACTIVE.toString());
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
|
|
|
|
if (dataSource != null) {
|
|
|
|
|
|
|
|
setMockDeviceCount(dataSource.getConnection(0));
|
|
|
|
|
|
|
|
}
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByStatus(request, true);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByStatus(request, true);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setMockDeviceCount(MockConnection connection) {
|
|
|
|
|
|
|
|
MockStatement statement = new MockStatement();
|
|
|
|
|
|
|
|
connection.addMockStatement(statement);
|
|
|
|
|
|
|
|
MockResultSet resultSet = new MockResultSet();
|
|
|
|
|
|
|
|
resultSet.addInteger(1);
|
|
|
|
|
|
|
|
statement.addResultSet(resultSet);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDevicesOfTypePaginated() throws DeviceManagementException {
|
|
|
|
public void testGetDevicesOfTypePaginated() throws DeviceManagementException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
if (!isMock()) {
|
|
|
|
request.setDeviceType(DEVICE_TYPE);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByType(request);
|
|
|
|
request.setDeviceType(DEVICE_TYPE);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByType(request);
|
|
|
|
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesWithInfo() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesWithInfo() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevices(true);
|
|
|
|
List<Device> devices = deviceMgtService.getAllDevices(true);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
Assert.assertTrue(devices.get(0).getDeviceInfo() != null);
|
|
|
|
Assert.assertTrue(devices.get(0).getDeviceInfo() != null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetAllDevicesWithInfoPaginated() throws DeviceManagementException {
|
|
|
|
public void testGetAllDevicesWithInfoPaginated() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
|
|
|
|
if (dataSource != null) {
|
|
|
|
|
|
|
|
setMockDeviceCount(dataSource.getConnection(0));
|
|
|
|
|
|
|
|
}
|
|
|
|
PaginationResult result = deviceMgtService.getAllDevices(request, true);
|
|
|
|
PaginationResult result = deviceMgtService.getAllDevices(request, true);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetTenantedDevice() throws DeviceManagementException {
|
|
|
|
public void testGetTenantedDevice() throws DeviceManagementException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
|
|
|
|
HashMap<Integer, Device> deviceMap = deviceMgtService.getTenantedDevice(new
|
|
|
|
HashMap<Integer, Device> deviceMap = deviceMgtService.getTenantedDevice(new
|
|
|
|
DeviceIdentifier
|
|
|
|
DeviceIdentifier
|
|
|
|
(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
(DEVICE_ID, DEVICE_TYPE));
|
|
|
|
Assert.assertTrue(!deviceMap.isEmpty());
|
|
|
|
if (!isMock()) {
|
|
|
|
|
|
|
|
Assert.assertTrue(!deviceMap.isEmpty());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -606,29 +702,37 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviesOfUserWhileUserNull() throws DeviceManagementException {
|
|
|
|
public void testGetDeviesOfUserWhileUserNull() throws DeviceManagementException {
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesOfUser("admin");
|
|
|
|
if (!isMock()) {
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesOfUser("admin");
|
|
|
|
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDevieByStatus() throws DeviceManagementException {
|
|
|
|
public void testGetDevieByStatus() throws DeviceManagementException {
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
if (!isMock()) {
|
|
|
|
DEVICE_TYPE), EnrolmentInfo.Status.ACTIVE);
|
|
|
|
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
DEVICE_TYPE), EnrolmentInfo.Status.ACTIVE);
|
|
|
|
|
|
|
|
Assert.assertTrue(device != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDevieByDate() throws DeviceManagementException {
|
|
|
|
public void testGetDevieByDate() throws DeviceManagementException {
|
|
|
|
List<Device> devices = deviceMgtService.getDevices(yesterday());
|
|
|
|
if (!isMock()) {
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
List<Device> devices = deviceMgtService.getDevices(yesterday());
|
|
|
|
|
|
|
|
Assert.assertTrue(!devices.isEmpty());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviesOfUserPaginated() throws DeviceManagementException {
|
|
|
|
public void testGetDeviesOfUserPaginated() throws DeviceManagementException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
if (!isMock()) {
|
|
|
|
request.setOwner("admin");
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesOfUser(request, true);
|
|
|
|
request.setOwner("admin");
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesOfUser(request, true);
|
|
|
|
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
|
|
|
@ -640,10 +744,12 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviesByOwnership() throws DeviceManagementException {
|
|
|
|
public void testGetDeviesByOwnership() throws DeviceManagementException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
if (!isMock()) {
|
|
|
|
request.setOwnership(EnrolmentInfo.OwnerShip.BYOD.toString());
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByOwnership(request);
|
|
|
|
request.setOwnership(EnrolmentInfo.OwnerShip.BYOD.toString());
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByOwnership(request);
|
|
|
|
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
@ -667,24 +773,34 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviesByStatus() throws DeviceManagementException {
|
|
|
|
public void testGetDeviesByStatus() throws DeviceManagementException, NoSuchFieldException,
|
|
|
|
|
|
|
|
IllegalAccessException {
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
PaginationRequest request = new PaginationRequest(0, 100);
|
|
|
|
request.setStatus("ACTIVE");
|
|
|
|
request.setStatus("ACTIVE");
|
|
|
|
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
|
|
|
|
if (dataSource != null) {
|
|
|
|
|
|
|
|
setMockDeviceCount(dataSource.getConnection(0));
|
|
|
|
|
|
|
|
}
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByStatus(request);
|
|
|
|
PaginationResult result = deviceMgtService.getDevicesByStatus(request);
|
|
|
|
|
|
|
|
cleanupMockDatasource(dataSource);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
Assert.assertTrue(result.getRecordsTotal() > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
public void testUpdateDevicesStatus() throws DeviceManagementException {
|
|
|
|
public void testUpdateDevicesStatus() throws DeviceManagementException {
|
|
|
|
boolean status = deviceMgtService.setStatus("user1", EnrolmentInfo.Status.REMOVED);
|
|
|
|
if (!isMock()) {
|
|
|
|
Assert.assertTrue(status);
|
|
|
|
boolean status = deviceMgtService.setStatus("user1", EnrolmentInfo.Status.REMOVED);
|
|
|
|
|
|
|
|
Assert.assertTrue(status);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
public void testUpdateDevicesStatusWithDeviceID() throws DeviceManagementException {
|
|
|
|
public void testUpdateDevicesStatusWithDeviceID() throws DeviceManagementException {
|
|
|
|
boolean status = deviceMgtService.setStatus(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE), "user1",
|
|
|
|
if (!isMock()) {
|
|
|
|
EnrolmentInfo.Status.ACTIVE);
|
|
|
|
boolean status = deviceMgtService.setStatus(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE), "user1",
|
|
|
|
Assert.assertTrue(status);
|
|
|
|
EnrolmentInfo.Status.ACTIVE);
|
|
|
|
|
|
|
|
Assert.assertTrue(status);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
@ -695,9 +811,11 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testGetDeviesOfUserAndDeviceType() throws DeviceManagementException {
|
|
|
|
public void testGetDeviesOfUserAndDeviceType() throws DeviceManagementException {
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesOfUser("admin", DEVICE_TYPE, true);
|
|
|
|
if (!isMock()) {
|
|
|
|
Assert.assertTrue(!devices.isEmpty() && devices.get(0).getType().equalsIgnoreCase
|
|
|
|
List<Device> devices = deviceMgtService.getDevicesOfUser("admin", DEVICE_TYPE, true);
|
|
|
|
(DEVICE_TYPE) && devices.get(0).getDeviceInfo() != null);
|
|
|
|
Assert.assertTrue(!devices.isEmpty() && devices.get(0).getType().equalsIgnoreCase
|
|
|
|
|
|
|
|
(DEVICE_TYPE) && devices.get(0).getDeviceInfo() != null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|