|
|
@ -125,39 +125,39 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
// public void testReEnrollmentofSameDeviceWithOtherUser() {
|
|
|
|
public void testReEnrollmentofSameDeviceWithOtherUser() {
|
|
|
|
//
|
|
|
|
|
|
|
|
// EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
|
|
|
|
|
|
|
|
// enrolmentInfo.setDateOfEnrolment(new Date().getTime());
|
|
|
|
|
|
|
|
// enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
|
|
|
|
|
|
|
|
// enrolmentInfo.setOwner("user1");
|
|
|
|
|
|
|
|
// enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
|
|
|
|
|
|
|
|
// enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE,
|
|
|
|
|
|
|
|
// enrolmentInfo);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE));
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// deviceMgtService.enrollDevice(alternateDevice);
|
|
|
|
|
|
|
|
// Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
|
|
|
|
|
|
|
|
// .getDeviceIdentifier(), alternateDevice.getType()));
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// log.info(retrievedDevice1.getEnrolmentInfo().getOwner());
|
|
|
|
|
|
|
|
// log.info(retrievedDevice2.getEnrolmentInfo().getOwner());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
|
|
|
|
// (retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
|
|
|
|
// } catch (DeviceManagementException e) {
|
|
|
|
|
|
|
|
// String msg = "Error Occured while enrolling device";
|
|
|
|
|
|
|
|
// Assert.fail(msg, e);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
|
|
|
|
|
|
|
|
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
|
|
|
|
|
|
|
|
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
|
|
|
|
|
|
|
|
enrolmentInfo.setOwner("user1");
|
|
|
|
|
|
|
|
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
|
|
|
|
|
|
|
|
enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE,
|
|
|
|
|
|
|
|
enrolmentInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deviceMgtService.enrollDevice(alternateDevice);
|
|
|
|
|
|
|
|
Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
|
|
|
|
|
|
|
|
.getDeviceIdentifier(), alternateDevice.getType()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info(retrievedDevice1.getEnrolmentInfo().getOwner());
|
|
|
|
|
|
|
|
log.info(retrievedDevice2.getEnrolmentInfo().getOwner());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
|
|
|
|
(retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|
|
|
|
String msg = "Error Occured while enrolling device";
|
|
|
|
|
|
|
|
Assert.fail(msg, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
|
|
|
|
public void testDisenrollment() {
|
|
|
|
public void testDisenrollment() {
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE);
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|