From 22db015699389a03f80cc487dadb094b21e6c1a0 Mon Sep 17 00:00:00 2001 From: megala21 Date: Tue, 26 Sep 2017 09:50:02 +0530 Subject: [PATCH] Fixing issues as per the comments --- .../DeviceTypeManagerServiceTest.java | 7 ++++-- .../device/mgt/extensions/utils/Utils.java | 22 +++++++++++++++++++ .../src/test/resources/raspberrypi.xml | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java index 7e6f16215a9..f261f983744 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java @@ -23,6 +23,7 @@ import org.mockito.Mockito; import org.testng.Assert; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig; import org.wso2.carbon.device.mgt.common.InitialOperationConfig; @@ -158,13 +159,15 @@ public class DeviceTypeManagerServiceTest { boolean isRasberryPiSharedWithTenants = (rasberrypiDeviceConfiguration.getProvisioningConfig() != null) && rasberrypiDeviceConfiguration .getProvisioningConfig().isSharedWithAllTenants(); - setProvisioningConfig.invoke(androidDeviceTypeManagerService, "carbon.super", androidDeviceConfiguration); + setProvisioningConfig.invoke(androidDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, + androidDeviceConfiguration); ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(), "Provisioning configs " + "are not correctly set as per the configuration file provided"); - setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, "carbon.super", rasberrypiDeviceConfiguration); + setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, + rasberrypiDeviceConfiguration); provisioningConfig = rasberrypiDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), isRasberryPiSharedWithTenants, "Provisioning configs are not correctly set as per the configuration file provided."); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java index 63e22db3bd9..f19049015b0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + package org.wso2.carbon.device.mgt.extensions.utils; import org.w3c.dom.Document; @@ -16,6 +35,9 @@ import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.IOException; +/** + * This class handles the test utility tasks. + */ public class Utils { /** diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml index b4625cdf9c0..5115fafd8e2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml @@ -44,4 +44,4 @@ This is license text - \ No newline at end of file +