|
|
@ -153,7 +153,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
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);
|
|
|
@ -163,7 +162,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
dataSource.reset();
|
|
|
|
dataSource.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = "testSuccessfulDeviceEnrollment")
|
|
|
|
@Test(dependsOnMethods = "testSuccessfulDeviceEnrollment")
|
|
|
@ -211,7 +209,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
|
|
|
|
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
|
|
|
|
if (!isMock()) {
|
|
|
|
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());
|
|
|
@ -446,29 +443,9 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
|
|
|
|
public void testDeviceByDate() throws DeviceManagementException, TransactionManagementException,
|
|
|
|
public void testDeviceByDate() throws DeviceManagementException, TransactionManagementException,
|
|
|
|
DeviceDetailsMgtDAOException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
DeviceDetailsMgtDAOException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
MockDataSource dataSource = null;
|
|
|
|
MockDataSource dataSource = setDatasourceForGetDevice();
|
|
|
|
if (isMock()) {
|
|
|
|
if (dataSource != null) {
|
|
|
|
Field datasourceField = DeviceManagementDAOFactory.class.getDeclaredField("dataSource");
|
|
|
|
setMockDeviceCount(dataSource.getConnection(0));
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//connection used for the add device information operation.
|
|
|
|
|
|
|
|
dataSource.setConnection(new MockConnection(dataSource.getUrl()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//connection used for second get device operation.
|
|
|
|
|
|
|
|
connection = new MockConnection(dataSource.getUrl());
|
|
|
|
|
|
|
|
dataSource.setConnection(connection);
|
|
|
|
|
|
|
|
mockStatement = new MockStatement();
|
|
|
|
|
|
|
|
mockStatement.addResultSet(getMockGetDeviceResult());
|
|
|
|
|
|
|
|
connection.addMockStatement(mockStatement);
|
|
|
|
|
|
|
|
datasourceField.set(datasourceField, dataSource);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
|
|
|
|
DEVICE_TYPE));
|
|
|
|
DEVICE_TYPE));
|
|
|
|