|
|
@ -40,7 +40,6 @@ import org.wso2.carbon.user.core.service.RealmService;
|
|
|
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
|
|
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
|
|
public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTest {
|
|
|
|
public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTest {
|
|
|
@ -50,9 +49,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
|
|
|
|
private static final String DEVICE_TYPE = "RANDOM_DEVICE_TYPE";
|
|
|
|
private static final String DEVICE_TYPE = "RANDOM_DEVICE_TYPE";
|
|
|
|
|
|
|
|
|
|
|
|
DeviceManagementProviderService deviceMgtService;
|
|
|
|
DeviceManagementProviderService deviceMgtService;
|
|
|
|
private Method setProvisioningConfig;
|
|
|
|
|
|
|
|
private Method setOperationMonitoringConfig;
|
|
|
|
|
|
|
|
private Method setDeviceStatusTaskPluginConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
@BeforeClass
|
|
|
|
public void init() throws Exception {
|
|
|
|
public void init() throws Exception {
|
|
|
@ -129,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 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("12345", DEVICE_TYPE,
|
|
|
|
// Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE,
|
|
|
|
enrolmentInfo);
|
|
|
|
// enrolmentInfo);
|
|
|
|
|
|
|
|
//
|
|
|
|
try {
|
|
|
|
// try {
|
|
|
|
Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE));
|
|
|
|
// Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", 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()));
|
|
|
|
|
|
|
|
//
|
|
|
|
log.info(retrievedDevice1.getEnrolmentInfo().getOwner());
|
|
|
|
// log.info(retrievedDevice1.getEnrolmentInfo().getOwner());
|
|
|
|
log.info(retrievedDevice2.getEnrolmentInfo().getOwner());
|
|
|
|
// log.info(retrievedDevice2.getEnrolmentInfo().getOwner());
|
|
|
|
|
|
|
|
//
|
|
|
|
Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
// Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
|
|
|
|
(retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
// (retrievedDevice2.getEnrolmentInfo().getOwner()));
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
// } catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error Occured while enrolling device";
|
|
|
|
// String msg = "Error Occured while enrolling device";
|
|
|
|
Assert.fail(msg, e);
|
|
|
|
// Assert.fail(msg, e);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
|
|
|
|
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
|
|
|
|
public void testDisenrollment() {
|
|
|
|
public void testDisenrollment() {
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE);
|
|
|
|
Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|