当前位置: 首页>>代码示例>>Java>>正文


Java EnrolmentInfo.setStatus方法代码示例

本文整理汇总了Java中org.wso2.carbon.device.mgt.common.EnrolmentInfo.setStatus方法的典型用法代码示例。如果您正苦于以下问题:Java EnrolmentInfo.setStatus方法的具体用法?Java EnrolmentInfo.setStatus怎么用?Java EnrolmentInfo.setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.device.mgt.common.EnrolmentInfo的用法示例。


在下文中一共展示了EnrolmentInfo.setStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEnrollDeviceWithDeviceManagementException

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Test(description = "Test the device enrollment with device management exception.")
public void testEnrollDeviceWithDeviceManagementException() throws DeviceManagementException {
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService"))
            .toReturn(this.deviceManagementProviderService);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getAuthenticatedUser"))
            .toReturn(AUTHENTICATED_USER);
    Device device = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER);
    EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
    enrolmentInfo.setStatus(EnrolmentInfo.Status.INACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);
    Mockito.when(this.deviceManagementProviderService.getDevice(Mockito.any())).thenReturn(device);
    Mockito.when(this.deviceManagementProviderService.enrollDevice(Mockito.any()))
            .thenThrow(new DeviceManagementException());
    Response response = this.deviceAgentService.enrollDevice(device);
    Assert.assertNotNull(response, "Response should not be null");
    Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
            "The response status should be 500");
    Mockito.reset(this.deviceManagementProviderService);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:DeviceAgentServiceTest.java

示例2: testReEnrollmentofSameDeviceWithOtherUser

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
    if (!isMock()) {
        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(DEVICE_ID, DEVICE_TYPE,
                enrolmentInfo);
        Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
                DEVICE_TYPE));

        deviceMgtService.enrollDevice(alternateDevice);
        Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
                .getDeviceIdentifier(), alternateDevice.getType()));

        Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
                (retrievedDevice2.getEnrolmentInfo().getOwner()));
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:24,代码来源:DeviceManagementProviderServiceTest.java

示例3: generateDummyDeviceData

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> generateDummyDeviceData(List<DeviceIdentifier> deviceIds) {
    List<Device> devices = new ArrayList<>();
    for (DeviceIdentifier deviceId : deviceIds) {
        Device device = new Device();
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setOwner(OWNER);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
        device.setEnrolmentInfo(enrolmentInfo);
        device.setDescription("Test Description");
        device.setDeviceIdentifier(deviceId.getId());
        device.setType(deviceId.getType());
        devices.add(device);
    }
    return devices;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:19,代码来源:TestDataHolder.java

示例4: testEnrollDeviceSuccess

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Test(description = "Test the device enrollment success scenario.")
public void testEnrollDeviceSuccess() throws DeviceManagementException {
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService"))
            .toReturn(this.deviceManagementProviderService);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getAuthenticatedUser"))
            .toReturn(AUTHENTICATED_USER);
    EnrolmentInfo enrolmentInfo = demoDevice.getEnrolmentInfo();
    enrolmentInfo.setStatus(EnrolmentInfo.Status.INACTIVE);
    demoDevice.setEnrolmentInfo(enrolmentInfo);
    Mockito.when(this.deviceManagementProviderService.getDevice(Mockito.any())).thenReturn(demoDevice);
    Response response = this.deviceAgentService.enrollDevice(demoDevice);
    Assert.assertNotNull(response, "Response should not be null");
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "The response status should be 200");
    Mockito.reset(this.deviceManagementProviderService);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:DeviceAgentServiceTest.java

示例5: getDeviceList2

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList2 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(2);
    device.setType(deviceType.getName());
    device.setName("Apple 5S");
    device.setDeviceIdentifier("def123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dilshan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例6: getDeviceList4

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList4 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(4);
    device.setType(deviceType.getName());
    device.setName("HTC M");
    device.setDeviceIdentifier("ppp456");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dilan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例7: getDeviceList5

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList5 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(5);
    device.setType(deviceType.getName());
    device.setName("Sony Experia L");
    device.setDeviceIdentifier("ssss123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Milan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例8: getDeviceList6

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList6 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(6);
    device.setType(deviceType.getName());
    device.setName("Alcatel RTS");
    device.setDeviceIdentifier("ttt123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dileesha");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例9: getSingleDevice

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static Device getSingleDevice() {

        Device device = new Device();
        device.setId(1);
        device.setType("android");
        device.setName("Galaxy S6");
        device.setDeviceIdentifier("abc123");
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setOwner("Geeth");
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        device.setEnrolmentInfo(enrolmentInfo);


        return device;
    }
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:DeviceCreator.java

示例10: register

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
private boolean register(String deviceId, String name) {
    try {
        DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
        deviceIdentifier.setId(deviceId);
        deviceIdentifier.setType(DeviceTypeConstants.DEVICE_TYPE);
        if (APIUtil.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
            return false;
        }
        Device device = new Device();
        device.setDeviceIdentifier(deviceId);
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        device.setName(name);
        device.setType(DeviceTypeConstants.DEVICE_TYPE);
        enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser());
        device.setEnrolmentInfo(enrolmentInfo);
        boolean added = APIUtil.getDeviceManagementService().enrollDevice(device);
        if (added) {
            APIUtil.registerApiAccessRoles(APIUtil.getAuthenticatedUser());
        }
        return added;
    } catch (DeviceManagementException e) {
        log.error(e.getMessage(), e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:30,代码来源:DeviceTypeServiceImpl.java

示例11: generateEnrollmentInfo

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static EnrolmentInfo generateEnrollmentInfo(long dateOfEnrollment, long dateOfLastUpdate,
                                                   String owner, EnrolmentInfo.OwnerShip ownership,
                                                   EnrolmentInfo.Status status) {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setDateOfEnrolment(dateOfEnrollment);
    enrolmentInfo.setDateOfLastUpdate(dateOfLastUpdate);
    enrolmentInfo.setOwner(owner);
    enrolmentInfo.setOwnership(ownership);
    enrolmentInfo.setStatus(status);
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:12,代码来源:DeviceMgtAPITestHelper.java

示例12: loadEnrolment

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static EnrolmentInfo loadEnrolment(ResultSet rs) throws SQLException {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setId(rs.getInt("ENROLMENT_ID"));
    enrolmentInfo.setOwner(rs.getString("OWNER"));
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.valueOf(rs.getString("OWNERSHIP")));
    enrolmentInfo.setDateOfEnrolment(rs.getTimestamp("DATE_OF_ENROLMENT").getTime());
    enrolmentInfo.setDateOfLastUpdate(rs.getTimestamp("DATE_OF_LAST_UPDATE").getTime());
    enrolmentInfo.setStatus(EnrolmentInfo.Status.valueOf(rs.getString("STATUS")));
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:DeviceManagementDAOUtil.java

示例13: loadEnrolment

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
private EnrolmentInfo loadEnrolment(ResultSet rs) throws SQLException {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner(rs.getString("OWNER"));
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.valueOf(rs.getString("OWNERSHIP")));
    enrolmentInfo.setDateOfEnrolment(rs.getTimestamp("DATE_OF_ENROLMENT").getTime());
    enrolmentInfo.setDateOfLastUpdate(rs.getTimestamp("DATE_OF_LAST_UPDATE").getTime());
    enrolmentInfo.setStatus(EnrolmentInfo.Status.valueOf(rs.getString("STATUS")));
    enrolmentInfo.setId(rs.getInt("ID"));
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:EnrollmentDAOImpl.java

示例14: changeDeviceStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
/**
 * Change device status.
 *
 * @param deviceIdentifier {@link DeviceIdentifier} object
 * @param newStatus        New status of the device
 * @return Whether status is changed or not
 * @throws DeviceManagementException on errors while trying to change device status
 */
@Override
public boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
        throws DeviceManagementException {
    if (deviceIdentifier == null) {
        String msg = "Received incomplete data for getDevicesByStatus";
        log.error(msg);
        throw new DeviceManagementException(msg);
    }
    if (log.isDebugEnabled()) {
        log.debug("Change device status of device: " + deviceIdentifier.getId() + " of type '"
                + deviceIdentifier.getType() + "'");
    }
    boolean isDeviceUpdated;
    Device device = getDevice(deviceIdentifier, false);
    int deviceId = device.getId();
    EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
    enrolmentInfo.setStatus(newStatus);
    int tenantId = this.getTenantId();
    switch (newStatus) {
        case ACTIVE:
            isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
            break;
        case INACTIVE:
            isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
            break;
        case REMOVED:
            isDeviceUpdated = disenrollDevice(deviceIdentifier);
            break;
        default:
            throw new DeviceManagementException("Invalid status retrieved. Status : " + newStatus);
    }
    return isDeviceUpdated;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:42,代码来源:DeviceManagementProviderServiceImpl.java

示例15: getDeviceList

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList(DeviceType deviceType) {

        List<Device> deviceList = new ArrayList<Device>();

        Device device = new Device();
        device.setId(1);
        device.setType(deviceType.getName());
        device.setName("Galaxy S6");
        device.setDeviceIdentifier("abc123");
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setOwner("Geeth");
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        device.setEnrolmentInfo(enrolmentInfo);

//        Device device1 = new Device();
//        device1.setId(2);
//        device1.setType(deviceType.getName());
//        device1.setName("Nexus 5");
//        device1.setDeviceIdentifier("def456");
//        EnrolmentInfo enrolmentInfo1 = new EnrolmentInfo();
//        enrolmentInfo1.setOwner("Manoj");
//        enrolmentInfo1.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
//        enrolmentInfo1.setStatus(EnrolmentInfo.Status.ACTIVE);
//        device1.setEnrolmentInfo(enrolmentInfo);

        deviceList.add(device);
       // deviceList.add(device1);

        return deviceList;
    }
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:32,代码来源:DeviceCreator.java


注:本文中的org.wso2.carbon.device.mgt.common.EnrolmentInfo.setStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。