diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 77b350f807..11f46a4125 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index c1e8e0fb50..459ed2758b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 45835dd02a..812967cc92 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index 526508155b..c698c76fa8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index 00ad78ac2c..1a67ae9ca4 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 2788aa93cc..d4344bc6e8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index f5e3dc3e69..25c79ace98 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index d7115ee25a..8ef1e1d321 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index caf08e5cdd..1b44628d60 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index 1bbeb0ad64..29a83860a4 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 227023b304..af85d81e5f 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index f0628cde9e..9a6cc57d81 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index e18fe0fd7d..b9930ea6e6 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index 719c6c9d3c..3b2eac3168 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 67c391291c..8a5d3c9551 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index 04a0b54820..066cc364c3 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 17cd30e93c..b0bc4ccc33 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 432eb436b3..bd7625527b 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 57d43d97bc..bf39141ff1 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 645fe9d05c..495f477151 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml @@ -150,7 +150,15 @@ - + + org.apache.maven.plugins + maven-surefire-plugin + + + src/test/resources/testng.xml + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 5661da9cf7..01c6a22a86 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml @@ -75,6 +75,18 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + file:src/test/resources/log4j.properties + + + src/test/resources/testng.xml + + + @@ -148,11 +160,6 @@ cxf-rt-transports-http provided - - junit - junit - test - commons-httpclient.wso2 commons-httpclient @@ -212,6 +219,14 @@ org.apache.axis2.wso2 axis2-client + + org.mockito + mockito-core + + + javassist + javassist + @@ -223,6 +238,14 @@ org.apache.axis2.wso2 axis2-client + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + + + org.mockito + mockito-core + @@ -249,6 +272,12 @@ org.wso2.carbon.devicemgt org.wso2.carbon.certificate.mgt.core provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + + io.swagger @@ -378,6 +407,15 @@ org.wso2.carbon.apimgt.integration.client provided + + org.powermock + powermock-module-testng + test + + + org.powermock + powermock-api-mockito + test + - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java index 254ad9a95e..cbbfaf32ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java @@ -101,7 +101,6 @@ import java.util.List; */ public class DeviceMgtAPIUtils { - public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.APPLICATION_JSON_TYPE; private static final String NOTIFIER_FREQUENCY = "notifierFrequency"; private static final String STREAM_DEFINITION_PREFIX = "iot.per.device.stream."; private static final String DEFAULT_HTTP_PROTOCOL = "https"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImplTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImplTest.java new file mode 100644 index 0000000000..e329a6219e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImplTest.java @@ -0,0 +1,315 @@ +/* + * 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.jaxrs.service.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.wso2.carbon.device.mgt.jaxrs.service.api.DeviceManagementService; +import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; +import javax.ws.rs.core.Response; + +import static org.mockito.MockitoAnnotations.initMocks; + +/** + * This class includes unit tests for testing the functionality of {@link DeviceManagementServiceImpl} + */ +@PowerMockIgnore("javax.ws.rs.*") +@SuppressStaticInitializationFor({"org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils", + "org.wso2.carbon.context.CarbonContext"}) +@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class}) +public class DeviceManagementServiceImplTest { + + private static final Log log = LogFactory.getLog(DeviceManagementServiceImplTest.class); + private static final String TEST_DEVICE_TYPE = "TEST-DEVICE-TYPE"; + private static final String TEST_DEVICE_NAME = "TEST-DEVICE"; + private static final String DEFAULT_USERNAME = "admin"; + private static final String TENANT_AWARE_USERNAME = "admin@carbon.super"; + private static final String DEFAULT_ROLE = "admin"; + private static final String DEFAULT_OWNERSHIP = "BYOD"; + private static final String DEFAULT_STATUS = "ACTIVE"; + private static final String DEFAULT_DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; + private DeviceManagementService deviceManagementService; + private DeviceAccessAuthorizationService deviceAccessAuthorizationService; + private DeviceManagementProviderService deviceManagementProviderService; + + @ObjectFactory + public IObjectFactory getObjectFactory() { + return new org.powermock.modules.testng.PowerMockObjectFactory(); + } + + @BeforeClass + public void init() throws Exception { + log.info("Initializing DeviceManagementServiceImpl tests"); + initMocks(this); + this.deviceManagementProviderService = Mockito + .mock(DeviceManagementProviderServiceImpl.class, Mockito.RETURNS_MOCKS); + this.deviceManagementService = new DeviceManagementServiceImpl(); + this.deviceAccessAuthorizationService = Mockito.mock(DeviceAccessAuthorizationServiceImpl.class); + } + + @Test(description = "Testing if the device is enrolled when the device is enrolled.") + public void testIsEnrolledWhenDeviceIsEnrolled() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.isEnrolled(Mockito.any(DeviceIdentifier.class))) + .thenReturn(true); + Response response = this.deviceManagementService.isEnrolled(TEST_DEVICE_TYPE, UUID.randomUUID().toString()); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "Testing if the device is enrolled when the device is not enrolled.", + dependsOnMethods = "testIsEnrolledWhenDeviceIsEnrolled") + public void testIsEnrolledWhenDeviceIsNotEnrolled() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.isEnrolled(Mockito.any(DeviceIdentifier.class))) + .thenReturn(false); + Response response = this.deviceManagementService.isEnrolled(TEST_DEVICE_TYPE, UUID.randomUUID().toString()); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.NO_CONTENT.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "Testing if the device enrolled api when exception occurred.", + dependsOnMethods = "testIsEnrolledWhenDeviceIsNotEnrolled") + public void testIsEnrolledError() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.isEnrolled(Mockito.any(DeviceIdentifier.class))) + .thenThrow(new DeviceManagementException()); + Response response = this.deviceManagementService.isEnrolled(TEST_DEVICE_TYPE, UUID.randomUUID().toString()); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "Testing get devices when request exists both name and role.") + public void testGetDevicesWhenBothNameAndRoleAvailable() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + Response response = this.deviceManagementService + .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); + } + + @Test(description = "Testing get devices with correct request.") + public void testGetDevices() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, null, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, true, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + } + + @Test(description = "Testing get devices when DeviceAccessAuthorizationService is not available") + public void testGetDevicesWithErroneousDeviceAccessAuthorizationService() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(null); + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + } + + @Test(description = "Testing get devices when user is the device admin") + public void testGetDevicesWhenUserIsAdmin() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + Mockito.when(deviceAccessAuthorizationService.isDeviceAdminUser()).thenReturn(true); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, null, DEFAULT_USERNAME, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + } + + @Test(description = "Testing get devices when user is unauthorized.") + public void testGetDevicesWhenUserIsUnauthorized() throws Exception { + PowerMockito.spy(MultitenantUtils.class); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + PowerMockito.doReturn(TENANT_AWARE_USERNAME) + .when(MultitenantUtils.class, "getTenantAwareUsername", DEFAULT_USERNAME); + PowerMockito.doReturn("newuser@carbon.super").when(MultitenantUtils.class, "getTenantAwareUsername", "newuser"); + Mockito.when(this.deviceAccessAuthorizationService.isDeviceAdminUser()).thenReturn(false); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, "newuser", null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, DEFAULT_STATUS, 1, + null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.UNAUTHORIZED.getStatusCode()); + Mockito.reset(this.deviceAccessAuthorizationService); + } + + @Test(description = "Testing get devices with IF-Modified-Since") + public void testGetDevicesWithModifiedSince() throws Exception { + String ifModifiedSince = new SimpleDateFormat(DEFAULT_DATE_FORMAT).format(new Date()); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, ifModifiedSince, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); + response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, ifModifiedSince, true, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); + response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, "ErrorModifiedSince", false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); + } + + @Test(description = "Testing get devices with Since") + public void testGetDevicesWithSince() throws Exception { + String since = new SimpleDateFormat(DEFAULT_DATE_FORMAT).format(new Date()); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, since, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, since, null, true, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, "ErrorSince", null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); + } + + @Test(description = "Testing get devices when unable to retrieve devices") + public void testGetDeviceServerErrorWhenGettingDeviceList() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + Mockito.when(this.deviceManagementProviderService.getAllDevices(Mockito.any(PaginationRequest.class), Mockito.anyBoolean())) + .thenThrow(new DeviceManagementException()); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "Testing get devices when unable to check if the user is the admin user") + public void testGetDevicesServerErrorWhenCheckingAdminUser() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")) + .toReturn(this.deviceAccessAuthorizationService); + PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername")) + .toReturn(TENANT_AWARE_USERNAME); + PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext")) + .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS)); + Mockito.when(this.deviceAccessAuthorizationService.isDeviceAdminUser()) + .thenThrow(new DeviceAccessAuthorizationException()); + + Response response = this.deviceManagementService + .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, + DEFAULT_STATUS, 1, null, null, false, 10, 5); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + Mockito.reset(this.deviceAccessAuthorizationService); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceTypeManagementServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceTypeManagementServiceTest.java new file mode 100644 index 0000000000..2062f7dc44 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceTypeManagementServiceTest.java @@ -0,0 +1,236 @@ +/* + * 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.jaxrs.service.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.FeatureManager; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.wso2.carbon.device.mgt.jaxrs.service.api.DeviceTypeManagementService; +import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.DeviceMgtAPITestHelper; +import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; + +import javax.ws.rs.core.Response; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +import static org.mockito.MockitoAnnotations.initMocks; + +/** + * This class holds the unit tests for the class {@link DeviceTypeManagementService} + */ +@PowerMockIgnore("javax.ws.rs.*") +@SuppressStaticInitializationFor({"org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils"}) +@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class}) +public class DeviceTypeManagementServiceTest { + + private static final Log log = LogFactory.getLog(DeviceManagementServiceImplTest.class); + private static final String TEST_DEVICE_TYPE = "TEST-DEVICE-TYPE"; + private static final int TEST_DEVICE_TYPE_ID = 12345; + private static final String MODIFIED_SINCE = "1234503934242"; + private DeviceTypeManagementService deviceTypeManagementService; + private DeviceManagementProviderService deviceManagementProviderService; + + @ObjectFactory + public IObjectFactory getObjectFactory() { + return new org.powermock.modules.testng.PowerMockObjectFactory(); + } + + @BeforeClass + public void init() throws DeviceManagementException { + log.info("Initializing DeviceTypeManagement tests"); + initMocks(this); + this.deviceManagementProviderService = Mockito + .mock(DeviceManagementProviderServiceImpl.class, Mockito.RETURNS_MOCKS); + this.deviceTypeManagementService = new DeviceTypeManagementServiceImpl(); + } + + @Test(description = "Testing for existing device types.") + public void testExistingDeviceType() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Response response = this.deviceTypeManagementService.getDeviceTypes(""); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), + "The response states should be 200."); + } + + @Test(description = "Testing get existing device types error") + public void testExistingDeviceTypesError() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getDeviceTypes()).thenThrow(new DeviceManagementException()); + + Response response = this.deviceTypeManagementService.getDeviceTypes(); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + "The response status should be 500."); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Testing get existing device types error") + public void testExistingDeviceTypesModifiedError() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getAvailableDeviceTypes()).thenThrow(new + DeviceManagementException()); + + Response response = this.deviceTypeManagementService.getDeviceTypes(MODIFIED_SINCE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + "The response status should be 500."); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Test case to retrieve the Features of specified device type.") + public void testGetDeviceTypeFeatures() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Response response = this.deviceTypeManagementService.getFeatures(TEST_DEVICE_TYPE, MODIFIED_SINCE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), + "The response status should be 200."); + } + + @Test(description = "Test case to test the error scenario when retrieving the Features of specified device type.") + public void testGetDeviceTypeFeaturesError() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + FeatureManager featureManager = Mockito.mock(FeatureManager.class); + Mockito.when(this.deviceManagementProviderService.getFeatureManager(Mockito.anyString())).thenReturn + (featureManager); + Mockito.when((featureManager).getFeatures()).thenThrow(new DeviceManagementException()); + Response response = this.deviceTypeManagementService.getFeatures(TEST_DEVICE_TYPE, MODIFIED_SINCE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + "The response status should be 500."); + Mockito.reset(deviceManagementProviderService); + Mockito.reset(featureManager); + } + + @Test(description = "Test getting device type features when feature manager is null.") + public void testGetDeviceTypeFeaturesWithNoFeatureManager() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getFeatureManager(Mockito.anyString())).thenReturn(null); + Response response = this.deviceTypeManagementService.getFeatures(TEST_DEVICE_TYPE, MODIFIED_SINCE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode(), + "The response status should be 404."); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Test to get all the device types.") + public void testGetDeviceTypes() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Response response = this.deviceTypeManagementService.getDeviceTypes(); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), + "The response status should be 200."); + } + + @Test(description = "Test to get all the device types.") + public void testGetDeviceTypesWithDeviceTypes() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + + List deviceTypes = DeviceMgtAPITestHelper.getDummyDeviceTypeList(5); + Mockito.when(this.deviceManagementProviderService.getDeviceTypes()).thenReturn(deviceTypes); + + Response response = this.deviceTypeManagementService.getDeviceTypes(); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), + "The response state should be 200"); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Test to get all the device types for the given name") + public void testGetDeviceTypeByName() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Response response = this.deviceTypeManagementService.getDeviceTypeByName(TEST_DEVICE_TYPE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), + "The response status should be 200."); + } + + @Test(description = "Test the scenario when there are no device types for the given name.") + public void testGetDeviceTypeByNameError() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getDeviceType(Mockito.anyString())).thenReturn(null); + + Response response = this.deviceTypeManagementService.getDeviceTypeByName(TEST_DEVICE_TYPE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.NO_CONTENT.getStatusCode(), + "The response status should be 204."); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Test the scenario when there are no device types for the given name.") + public void testGetDeviceTypeByNameException() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getDeviceType(Mockito.anyString())) + .thenThrow(new DeviceManagementException()); + + Response response = this.deviceTypeManagementService.getDeviceTypeByName(TEST_DEVICE_TYPE); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + "The response status should be 500"); + Mockito.reset(deviceManagementProviderService); + } + + @Test(description = "Test to get all the device types when given name is null") + public void testGetDeviceTypeByNameBadRequest() throws Exception { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Response response = this.deviceTypeManagementService.getDeviceTypeByName(null); + Assert.assertNotNull(response, "The response object is null."); + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode(), + "The response status should be 400"); + } + + @Test(description = "Test to clear the sensitive metadata information of device type") + public void testClearMetaEntryInfo() throws NoSuchMethodException, InvocationTargetException, + IllegalAccessException { + Method clearMetaEntryInfo = DeviceTypeManagementServiceImpl.class.getDeclaredMethod("clearMetaEntryInfo", + DeviceType.class); + clearMetaEntryInfo.setAccessible(true); + + DeviceType deviceType = DeviceMgtAPITestHelper.getDummyDeviceType(TEST_DEVICE_TYPE, TEST_DEVICE_TYPE_ID); + DeviceType returned = (DeviceType) clearMetaEntryInfo.invoke(this.deviceTypeManagementService, deviceType); + + Assert.assertNotNull(returned.getDeviceTypeMetaDefinition(), "The response object is null."); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java new file mode 100644 index 0000000000..f75b181fc4 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java @@ -0,0 +1,76 @@ +/* + * 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.jaxrs.service.impl.util; + +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; +import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; + +import java.util.ArrayList; +import java.util.List; + +/** + * Helper class for Device Management API test cases. + * */ +public class DeviceMgtAPITestHelper { + + private static final String DEVICE_TYPE_DESCRIPTION = "Dummy Description"; + private static final String DEVICE_TYPE = "TEST_DEVICE_TYPE"; + + /** + * Creates a Device Type with given name and given id. + * If the name is null, the TEST_DEVICE_TYPE will be used as the name. + * + * @param name : Name of the device type. + * @param deviceTypeId : The Id of the device type. + * @return DeviceType + */ + public static DeviceType getDummyDeviceType(String name, int deviceTypeId) { + DeviceType deviceType = new DeviceType(); + deviceType.setId(deviceTypeId); + deviceType.setName(name != null ? name : DEVICE_TYPE); + + DeviceTypeMetaDefinition deviceTypeMetaDefinition = new DeviceTypeMetaDefinition(); + deviceTypeMetaDefinition.setClaimable(true); + deviceTypeMetaDefinition.setDescription(DEVICE_TYPE_DESCRIPTION); + + PushNotificationConfig pushNotificationConfig = + new PushNotificationConfig(name, true, null); + deviceTypeMetaDefinition.setPushNotificationConfig(pushNotificationConfig); + + deviceType.setDeviceTypeMetaDefinition(deviceTypeMetaDefinition); + return deviceType; + } + + /** + * Generates a list of device types. + * + * @param count: The number of device types that is needed. + * @return List : A list of device types. + */ + public static List getDummyDeviceTypeList(int count) { + List deviceTypes = new ArrayList<>(); + + for (int i = 0; i < count; i++) { + DeviceType deviceType = getDummyDeviceType(DEVICE_TYPE + count, count); + deviceTypes.add(deviceType); + } + + return deviceTypes; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/log4j.properties b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/log4j.properties new file mode 100644 index 0000000000..e415fd607d --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/log4j.properties @@ -0,0 +1,34 @@ +# +# Copyright (c) 2016, 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. +# + +# +# This is the log4j configuration file used by WSO2 Carbon +# +# IMPORTANT : Please do not remove or change the names of any +# of the Appender defined here. The layout pattern & log file +# can be changed using the WSO2 Carbon Management Console, and those +# settings will override the settings in this file. +# + +log4j.rootLogger=DEBUG, STD_OUT + +# Redirect log messages to console +log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender +log4j.appender.STD_OUT.Target=System.out +log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout +log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/testng.xml new file mode 100644 index 0000000000..e295559853 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/resources/testng.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index a8100ff934..f294b18327 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 4c352bde49..d0f5b1bf70 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 1dc588f0e1..e083572b1a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -1062,9 +1062,9 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { conn = this.getConnection(); String sql = "SELECT d.ID AS DEVICE_ID, d.DESCRIPTION, d.NAME AS DEVICE_NAME, t.NAME AS DEVICE_TYPE, " + "d.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " + - "e.DATE_OF_ENROLMENT FROM (SELECT e.ID, e.DEVICE_ID, e.OWNER, e.OWNERSHIP, e.STATUS, " + - "e.DATE_OF_ENROLMENT, e.DATE_OF_LAST_UPDATE, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e " + - "WHERE TENANT_ID = ? AND STATUS = ?) e, DM_DEVICE d, DM_DEVICE_TYPE t " + + "e.DATE_OF_ENROLMENT, e.ENROLMENT_ID FROM (SELECT e.ID, e.DEVICE_ID, e.OWNER, e" + + ".OWNERSHIP, e.STATUS, e.DATE_OF_ENROLMENT, e.DATE_OF_LAST_UPDATE, e.ID AS " + + "ENROLMENT_ID FROM DM_ENROLMENT e WHERE TENANT_ID = ? AND STATUS = ?) e, DM_DEVICE d, DM_DEVICE_TYPE t " + "WHERE DEVICE_ID = e.DEVICE_ID AND d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManager.java index e30edc3f48..b67a0ceb27 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManager.java @@ -95,7 +95,7 @@ public class TestDeviceManager implements DeviceManager { @Override public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException { - return false; + return true; } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java index 64efeb76a4..63fd3dbec0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java @@ -388,6 +388,17 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes Assert.assertTrue(device != null); } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testUpdateDeviceInfo() throws DeviceManagementException, + TransactionManagementException, DeviceDetailsMgtDAOException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE)); + + boolean status = deviceMgtService.updateDeviceInfo(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE), device); + Assert.assertTrue(status); + } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) public void testDeviceByDateWithNonExistentDevice() throws DeviceManagementException, TransactionManagementException, DeviceDetailsMgtDAOException { @@ -466,6 +477,12 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) public void testGetAllDevicesByStatus() throws DeviceManagementException { + List devices = deviceMgtService.getDevicesByStatus(EnrolmentInfo.Status.ACTIVE); + Assert.assertTrue(!devices.isEmpty()); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDevicesByStatus() throws DeviceManagementException { PaginationRequest request = new PaginationRequest(0, 100); request.setStatus(EnrolmentInfo.Status.ACTIVE.toString()); PaginationResult result = deviceMgtService.getDevicesByStatus(request, true); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 677bc14153..d2b4df6e7b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 560e9a724b..6b46a306f8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index ff5f175e42..c64c858535 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index d9a947580d..7740da0d92 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index cf3cdd156a..637c55573b 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index 394e889e8b..c42c131b2b 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 5ff9a37937..e9290ca1c3 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index 92fcdd602d..7cab23b1d7 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index 065f757aa4..0887418b42 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 5cd4de1336..fe2154cd4f 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index ddc111c6dd..29fcdb08f7 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 31e23434ee..f96f47209b 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index 9593e9caf9..00118afe6e 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index b87008bf7b..fb0e11dd42 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index f91853b45c..ee49a64608 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core @@ -223,9 +223,14 @@ - org.mockito - mockito-core - 2.10.0 + org.powermock + powermock-api-mockito + test + + + org.powermock + powermock-module-testng + test diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/ProfileDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/ProfileDAOImpl.java index 32e00c03c4..1483e6ebc7 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/ProfileDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/ProfileDAOImpl.java @@ -180,7 +180,7 @@ public class ProfileDAOImpl implements ProfileDAO { Connection conn; PreparedStatement stmt = null; ResultSet resultSet = null; - Profile profile = new Profile(); + Profile profile = null; try { conn = this.getConnection(); String query = "SELECT * FROM DM_PROFILE WHERE ID = ?"; @@ -189,7 +189,7 @@ public class ProfileDAOImpl implements ProfileDAO { resultSet = stmt.executeQuery(); while (resultSet.next()) { - + profile = new Profile(); profile.setProfileId(profileId); profile.setProfileName(resultSet.getString("PROFILE_NAME")); profile.setTenantId(resultSet.getInt("TENANT_ID")); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImpl.java index ada8b58763..bf1e00e165 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImpl.java @@ -20,12 +20,17 @@ package org.wso2.carbon.policy.mgt.core.mgt.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; import org.wso2.carbon.policy.mgt.common.ProfileManagementException; -import org.wso2.carbon.policy.mgt.core.dao.*; +import org.wso2.carbon.policy.mgt.core.dao.FeatureDAO; +import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException; +import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory; +import org.wso2.carbon.policy.mgt.core.dao.PolicyManagerDAOException; +import org.wso2.carbon.policy.mgt.core.dao.ProfileDAO; +import org.wso2.carbon.policy.mgt.core.dao.ProfileManagerDAOException; import org.wso2.carbon.policy.mgt.core.mgt.ProfileManager; import java.sql.SQLException; @@ -143,6 +148,9 @@ public class ProfileManagerImpl implements ProfileManager { try { PolicyManagementDAOFactory.openConnection(); profile = profileDAO.getProfile(profileId); + if (profile == null) { + throw new ProfileManagementException("Profile is not available with profile id (" + profileId + ")"); + } featureList = featureDAO.getFeaturesForProfile(profileId); profile.setProfileFeaturesList(featureList); } catch (ProfileManagerDAOException e) { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/BasePolicyManagementDAOTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/BasePolicyManagementDAOTest.java index 9e86417fd0..ec37dab9aa 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/BasePolicyManagementDAOTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/BasePolicyManagementDAOTest.java @@ -21,45 +21,107 @@ package org.wso2.carbon.policy.mgt.core; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeSuite; +import org.testng.internal.collections.Pair; import org.w3c.dom.Document; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.DeviceNotFoundException; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; +import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl; import org.wso2.carbon.ntask.common.TaskException; +import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.common.DataSourceConfig; import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory; +import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; +import org.wso2.carbon.policy.mgt.core.mgt.ProfileManager; +import org.wso2.carbon.policy.mgt.core.mgt.impl.ProfileManagerImpl; +import org.wso2.carbon.policy.mgt.core.services.SimplePolicyEvaluationTest; import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil; +import org.wso2.carbon.registry.core.config.RegistryContext; +import org.wso2.carbon.registry.core.exceptions.RegistryException; +import org.wso2.carbon.registry.core.internal.RegistryDataHolder; +import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; +import org.wso2.carbon.registry.core.service.RegistryService; +import org.wso2.carbon.user.core.service.RealmService; import javax.sql.DataSource; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Field; import java.sql.Connection; +import java.sql.DatabaseMetaData; import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public abstract class BasePolicyManagementDAOTest { private DataSource dataSource; private static final Log log = LogFactory.getLog(BasePolicyManagementDAOTest.class); + protected DeviceManagementProviderService deviceMgtService; + protected GroupManagementProviderService groupMgtService; + protected ProfileManager profileManager; + + private static final String ADMIN_USER = "admin"; + @BeforeSuite public void setupDataSource() throws Exception { this.initDatSource(); this.initSQLScript(); - this.initialize(); this.initiatePrivilegedCaronContext(); DeviceConfigurationManager.getInstance().initConfig(); } - public void initialize() throws TaskException { + protected void initializeServices() throws Exception{ + initDatSource(); + initSQLScript(); + + DeviceConfigurationManager.getInstance().initConfig(); + + deviceMgtService = new DeviceManagementProviderServiceImpl(); + groupMgtService = new GroupManagementProviderServiceImpl(); + + DeviceManagementServiceComponent.notifyStartupListeners(); + DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceMgtService); + DeviceManagementDataHolder.getInstance().setRegistryService(getRegistryService()); + DeviceManagementDataHolder.getInstance().setDeviceAccessAuthorizationService( + new DeviceAccessAuthorizationServiceImpl()); + DeviceManagementDataHolder.getInstance().setGroupManagementProviderService(groupMgtService); + DeviceManagementDataHolder.getInstance().setDeviceTaskManagerService(null); + + PolicyEvaluationPoint policyEvaluationPoint = new SimplePolicyEvaluationTest(); + PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint("Simple", policyEvaluationPoint); + PolicyManagementDataHolder.getInstance().setDeviceManagementService(deviceMgtService); + profileManager = new ProfileManagerImpl(); } public void initDatSource() throws Exception { @@ -98,9 +160,6 @@ public abstract class BasePolicyManagementDAOTest { } - @BeforeClass - public abstract void init() throws Exception; - private DataSource getDataSource(DataSourceConfig config) { PoolProperties properties = new PoolProperties(); properties.setUrl(config.getUrl()); @@ -138,4 +197,102 @@ public abstract class BasePolicyManagementDAOTest { return dataSource; } + + protected Object changeFieldValue(Object targetObj, String fieldName, Object valueObj) + throws IllegalAccessException, NoSuchFieldException { + Field field = targetObj.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + Object oldVal = field.get(targetObj); + field.set(targetObj, valueObj); + return oldVal; + } + + protected RegistryService getRegistryService() throws RegistryException { + RealmService realmService = new InMemoryRealmService(); + RegistryDataHolder.getInstance().setRealmService(realmService); + DeviceManagementDataHolder.getInstance().setRealmService(realmService); + InputStream is = this.getClass().getClassLoader().getResourceAsStream( + "carbon-home/repository/conf/registry.xml"); + RegistryContext context = RegistryContext.getBaseInstance(is, realmService); + context.setSetup(true); + return context.getEmbeddedRegistryService(); + } + + protected boolean enrollDevice(String deviceName, String deviceType) { + boolean success = false; + EnrolmentInfo enrolmentInfo = new EnrolmentInfo( + ADMIN_USER, EnrolmentInfo.OwnerShip.BYOD, EnrolmentInfo.Status.ACTIVE); + Device device1 = new Device(deviceName, deviceType, deviceName, deviceName, enrolmentInfo, null, null); + try { + success = deviceMgtService.enrollDevice(device1); + } catch (DeviceManagementException e) { + String msg = "Failed to enroll a device."; + log.error(msg, e); + Assert.fail(); + } + return success; + } + + protected void createDeviceGroup(String groupName) { + DeviceGroup deviceGroup = new DeviceGroup(groupName); + deviceGroup.setDescription(groupName); + deviceGroup.setOwner(ADMIN_USER); + try { + groupMgtService.createGroup(deviceGroup, null, null); + } catch (GroupAlreadyExistException | GroupManagementException e) { + String msg = "Failed to create group: " + groupName; + log.error(msg, e); + Assert.fail(msg); + } + } + + protected void addDeviceToGroup(DeviceIdentifier deviceIdentifier, String groupName) { + List groupDevices = new ArrayList<>(); + groupDevices.add(deviceIdentifier); + try { + DeviceGroup group = groupMgtService.getGroup(groupName); + groupMgtService.addDevices(group.getGroupId(), groupDevices); + } catch (DeviceNotFoundException | GroupManagementException e) { + String msg = "Failed to add device " + deviceIdentifier.getId() + " to group " + groupName; + log.error(msg, e); + Assert.fail(msg); + } + } + + public interface Command { + void call(Profile profile) throws Exception; + } + + protected void testThrowingException(Profile profile, Command command, String fieldName, Object mockObj, + Class exceptionClass) throws Exception { + Object oldObj = changeFieldValue(profileManager, fieldName, mockObj); + try { + command.call(profile); + } catch (Exception e) { + if (!(e.getCause().getClass().getName().equals(exceptionClass.getName()))) { + throw e; + } + } finally { + changeFieldValue(profileManager, fieldName, oldObj); + } + } + + protected Pair> mockConnection() throws Exception { + //Throwing PolicyManagerDAOException while adding profile + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDatabaseProductName()).thenReturn("H2"); + + Connection conn = mock(Connection.class); + when(conn.getMetaData()).thenReturn(databaseMetaData); + + DataSource dataSource = mock(DataSource.class); + when(dataSource.getConnection()).thenReturn(conn); + + Field dataSourceField = PolicyManagementDAOFactory.class.getDeclaredField("dataSource"); + dataSourceField.setAccessible(true); + DataSource oldDataSource = (DataSource) dataSourceField.get(null); + PolicyManagementDAOFactory.init(dataSource); + + return new Pair<>(conn, new Pair<>(oldDataSource, dataSource)); + } } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java index a2d8d4b725..e78f58ef8f 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java @@ -52,12 +52,6 @@ public class MonitoringTestCase extends BasePolicyManagementDAOTest { private DeviceIdentifier identifier = new DeviceIdentifier(); - @BeforeClass - @Override - public void init() throws Exception { - - } - @Test public void testMonitorDao() { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java index d056f8a1ff..032acdb878 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java @@ -52,14 +52,12 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest { private static final Log log = LogFactory.getLog(PolicyDAOTestCase.class); @BeforeClass - @Override public void init() throws Exception { initDatSource(); // System.setProperty("GetTenantIDForTest", "Super"); initiatePrivilegedCaronContext(); } - @Test public void addDeviceType() throws DeviceManagementDAOException { try { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java index 03eb400364..2c47b72b21 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java @@ -45,7 +45,6 @@ public class PolicyEvaluationTestCase extends BasePolicyManagementDAOTest { @BeforeClass - @Override public void init() throws Exception { PolicyEvaluationPoint evaluationPoint = new SimplePolicyEvaluationTest(); PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint(evaluationPoint.getName(), evaluationPoint); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index e21fa59f4b..a218429863 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -19,7 +19,6 @@ package org.wso2.carbon.policy.mgt.core; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.mockito.Spy; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -59,7 +58,7 @@ import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.enforcement.DelegationTask; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; -import org.wso2.carbon.policy.mgt.core.mock.TypeADeviceManagementService; +import org.wso2.carbon.policy.mgt.core.mock.TypeXDeviceManagementService; import org.wso2.carbon.policy.mgt.core.services.SimplePolicyEvaluationTest; import org.wso2.carbon.policy.mgt.core.task.MonitoringTask; import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService; @@ -90,8 +89,6 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { public static final String DEVICE_2 = "device2"; public static final String DEVICE_TYPE_B = "deviceTypeB"; - private DeviceManagementProviderService deviceMgtService; - private GroupManagementProviderService groupMgtService; private OperationManager operationManager; private PolicyManagerService policyManagerService; private Profile profile; @@ -100,75 +97,8 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { @BeforeClass public void init() throws Exception { - super.initSQLScript(); - - DeviceConfigurationManager.getInstance().initConfig(); log.info("Initializing policy tests"); - - deviceMgtService = new DeviceManagementProviderServiceImpl(); - groupMgtService = new GroupManagementProviderServiceImpl(); - - DeviceManagementServiceComponent.notifyStartupListeners(); - DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceMgtService); - DeviceManagementDataHolder.getInstance().setRegistryService(getRegistryService()); - DeviceManagementDataHolder.getInstance().setDeviceAccessAuthorizationService(new DeviceAccessAuthorizationServiceImpl()); - DeviceManagementDataHolder.getInstance().setGroupManagementProviderService(groupMgtService); - DeviceManagementDataHolder.getInstance().setDeviceTaskManagerService(null); - - PolicyEvaluationPoint policyEvaluationPoint = new SimplePolicyEvaluationTest(); - PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint("Simple", policyEvaluationPoint); - PolicyManagementDataHolder.getInstance().setDeviceManagementService(deviceMgtService); - } - - private RegistryService getRegistryService() throws RegistryException { - RealmService realmService = new InMemoryRealmService(); - RegistryDataHolder.getInstance().setRealmService(realmService); - DeviceManagementDataHolder.getInstance().setRealmService(realmService); - InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml"); - RegistryContext context = RegistryContext.getBaseInstance(is, realmService); - context.setSetup(true); - return context.getEmbeddedRegistryService(); - } - - private boolean enrollDevice(String deviceName, String deviceType) { - boolean success = false; - EnrolmentInfo enrolmentInfo = new EnrolmentInfo( - ADMIN_USER, EnrolmentInfo.OwnerShip.BYOD, EnrolmentInfo.Status.ACTIVE); - Device device1 = new Device(deviceName, deviceType, deviceName, deviceName, enrolmentInfo, null, null); - try { - success = deviceMgtService.enrollDevice(device1); - } catch (DeviceManagementException e) { - String msg = "Failed to enroll a device."; - log.error(msg, e); - Assert.fail(); - } - return success; - } - - private void createDeviceGroup(String groupName) { - DeviceGroup deviceGroup = new DeviceGroup(groupName); - deviceGroup.setDescription(groupName); - deviceGroup.setOwner(ADMIN_USER); - try { - groupMgtService.createGroup(deviceGroup, null, null); - } catch (GroupAlreadyExistException | GroupManagementException e) { - String msg = "Failed to create group: " + groupName; - log.error(msg, e); - Assert.fail(msg); - } - } - - private void addDeviceToGroup(DeviceIdentifier deviceIdentifier, String groupName) { - List groupDevices = new ArrayList<>(); - groupDevices.add(deviceIdentifier); - try { - DeviceGroup group = groupMgtService.getGroup(groupName); - groupMgtService.addDevices(group.getGroupId(), groupDevices); - } catch (DeviceNotFoundException | GroupManagementException e) { - String msg = "Failed to add device " + deviceIdentifier.getId() + " to group " + groupName; - log.error(msg, e); - Assert.fail(msg); - } + super.initializeServices(); } @Test @@ -176,7 +106,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); policyManagerService = new PolicyManagerServiceImpl(); - deviceMgtService.registerDeviceType(new TypeADeviceManagementService()); + deviceMgtService.registerDeviceType(new TypeXDeviceManagementService(DEVICE_TYPE_A)); operationManager = new OperationManagerImpl(DEVICE_TYPE_A); enrollDevice(DEVICE1, DEVICE_TYPE_A); createDeviceGroup(GROUP1); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java new file mode 100644 index 0000000000..2cbcfc4e22 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java @@ -0,0 +1,349 @@ +package org.wso2.carbon.policy.mgt.core.mgt.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.powermock.api.mockito.PowerMockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.testng.internal.collections.Pair; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.IllegalTransactionStateException; +import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; +import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; +import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; +import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; +import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; +import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl; +import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; +import org.wso2.carbon.policy.mgt.common.ProfileManagementException; +import org.wso2.carbon.policy.mgt.core.BasePolicyManagementDAOTest; +import org.wso2.carbon.policy.mgt.core.PolicyManagerServiceImpl; +import org.wso2.carbon.policy.mgt.core.dao.FeatureDAO; +import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException; +import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory; +import org.wso2.carbon.policy.mgt.core.dao.ProfileDAO; +import org.wso2.carbon.policy.mgt.core.dao.ProfileManagerDAOException; +import org.wso2.carbon.policy.mgt.core.dao.impl.ProfileDAOImpl; +import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; +import org.wso2.carbon.policy.mgt.core.mock.TypeXDeviceManagementService; +import org.wso2.carbon.policy.mgt.core.services.SimplePolicyEvaluationTest; +import org.wso2.carbon.policy.mgt.core.util.FeatureCreator; +import org.wso2.carbon.policy.mgt.core.util.ProfileCreator; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.SQLException; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyListOf; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class ProfileManagerImplTest extends BasePolicyManagementDAOTest { + private static final Log log = LogFactory.getLog(PolicyManagerServiceImpl.class); + + private static final String DEVICE3 = "device3"; + private static final String GROUP3 = "group3"; + private static final String POLICY3 = "policy3"; + private static final String DEVICE_TYPE_C = "deviceTypeC"; + + private Profile profile1; + private OperationManager operationManager; + + @BeforeClass + public void initialize() throws Exception { + log.info("Initializing policy manager tests"); + super.initializeServices(); + deviceMgtService.registerDeviceType(new TypeXDeviceManagementService(DEVICE_TYPE_C)); + operationManager = new OperationManagerImpl(DEVICE_TYPE_C); + enrollDevice(DEVICE3, DEVICE_TYPE_C); + createDeviceGroup(GROUP3); + DeviceGroup group1 = groupMgtService.getGroup(GROUP3); + addDeviceToGroup(new DeviceIdentifier(DEVICE3, DEVICE_TYPE_C), GROUP3); + } + + @Test(description = "This test case tests adding new profile") + public void testAddProfile() throws Exception { + //Creating profile object + Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_C); + //Adding profile + profile1 = profileManager.addProfile(profile); + Assert.assertEquals(profile1.getProfileName(), profile.getProfileName()); + Assert.assertEquals(profile1.getTenantId(), profile.getTenantId()); + Assert.assertEquals(profile1.getDeviceType(), profile.getDeviceType()); + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when adding new profile", + dependsOnMethods = "testAddProfile") + public void testAddProfileThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.addProfile(any(Profile.class))).thenThrow(new ProfileManagerDAOException()); + //Creating profile object + Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_C); + testThrowingException(profile, p -> profileManager.addProfile(p), "profileDAO", profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when adding new profile", + dependsOnMethods = "testAddProfileThrowingProfileManagerDAOException") + public void testAddProfileThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.addProfileFeatures(anyListOf(ProfileFeature.class), anyInt())).thenThrow( + new FeatureManagerDAOException()); + //Creating profile object + Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_C); + testThrowingException(profile, p -> profileManager.addProfile(p), "featureDAO", featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when adding new profile", + dependsOnMethods = "testAddProfileThrowingFeatureManagerDAOException", + expectedExceptions = IllegalTransactionStateException.class) + public void testAddProfileThrowingIllegalTransactionStateException() throws Exception { + //Creating profile object + Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_C); + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.first()).setAutoCommit(anyBoolean()); + try { + profileManager.addProfile(profile); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests updating profile", + dependsOnMethods = "testAddProfile") + public void testUpdateProfile() throws Exception { + String newProfileName = "Updated Test Profile"; + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + savedProfile.setProfileName(newProfileName); + Profile updateProfile = profileManager.updateProfile(savedProfile); + Assert.assertEquals(updateProfile.getProfileName(), newProfileName); + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when updating profile", + dependsOnMethods = "testUpdateProfile") + public void testUpdateProfileThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.updateProfile(any(Profile.class))).thenThrow(new ProfileManagerDAOException()); + + String newProfileName = "Updated Test Profile"; + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + savedProfile.setProfileName(newProfileName); + testThrowingException(savedProfile, p -> profileManager.updateProfile(p), "profileDAO", profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when updating profile", + dependsOnMethods = "testUpdateProfileThrowingProfileManagerDAOException") + public void testUpdateProfileThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.updateProfileFeatures(anyListOf(ProfileFeature.class), anyInt())).thenThrow( + new FeatureManagerDAOException()); + + String newProfileName = "Updated Test Profile"; + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + savedProfile.setProfileName(newProfileName); + testThrowingException(savedProfile, p -> profileManager.updateProfile(p), "featureDAO", featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when updating profile", + dependsOnMethods = {"testUpdateProfileThrowingFeatureManagerDAOException"}, + expectedExceptions = IllegalTransactionStateException.class) + public void testUpdateProfileThrowingIllegalTransactionStateException() throws Exception { + //Retrieving profile object + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.first()).setAutoCommit(anyBoolean()); + + String newProfileName = "Updated Test Profile"; + savedProfile.setProfileName(newProfileName); + try { + profileManager.updateProfile(savedProfile); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests retrieving profile", dependsOnMethods = "testAddProfile") + public void testGetProfile() throws Exception { + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + Assert.assertEquals(profile1.getProfileName(), savedProfile.getProfileName()); + Assert.assertEquals(profile1.getTenantId(), savedProfile.getTenantId()); + Assert.assertEquals(profile1.getDeviceType(), savedProfile.getDeviceType()); + } + + @Test(description = "This test case tests retrieving non existent profile", dependsOnMethods = "testGetProfile", + expectedExceptions = ProfileManagementException.class) + public void testGetProfileThrowingProfileManagementException() throws Exception { + int nonExistentProfileId = 9999; + profileManager.getProfile(nonExistentProfileId); + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when retrieving profile", + dependsOnMethods = "testGetProfile") + public void testGetProfileThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.getProfile(anyInt())).thenThrow(new ProfileManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getProfile(p.getProfileId()), "profileDAO", profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when retrieving profile", + dependsOnMethods = "testGetProfileThrowingProfileManagerDAOException") + public void testGetProfileThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.getFeaturesForProfile(anyInt())).thenThrow(new FeatureManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getProfile(p.getProfileId()), "featureDAO", featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when retrieving profile", + dependsOnMethods = "testGetProfileThrowingFeatureManagerDAOException", + expectedExceptions = IllegalTransactionStateException.class) + public void testGetProfileThrowingIllegalTransactionStateException() throws Exception { + //Creating profile object + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.second().second()).getConnection(); + + try { + profileManager.getProfile(profile1.getProfileId()); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests retrieving all profiles", + dependsOnMethods = "testAddProfile") + public void testGetAllProfiles() throws Exception { + profileManager.getAllProfiles(); + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when retrieving all profiles", + dependsOnMethods = "testGetAllProfiles") + public void testGetAllProfilesThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.getAllProfiles()).thenThrow(new ProfileManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getAllProfiles(), "profileDAO", profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when retrieving all profiles", + dependsOnMethods = "testGetAllProfilesThrowingProfileManagerDAOException") + public void testGetAllProfilesThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.getAllProfileFeatures()).thenThrow(new FeatureManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getAllProfiles(), "featureDAO", featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when retrieving all profiles", + dependsOnMethods = "testGetAllProfilesThrowingFeatureManagerDAOException", + expectedExceptions = IllegalTransactionStateException.class) + public void testGetAllProfilesThrowingIllegalTransactionStateException() throws Exception { + //Creating profile object + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.second().second()).getConnection(); + + try { + profileManager.getAllProfiles(); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests retrieving profiles of a device type", + dependsOnMethods = "testAddProfile") + public void testGetProfilesOfDeviceType() throws Exception { + profileManager.getProfilesOfDeviceType(DEVICE_TYPE_C); + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when retrieving all profiles of a " + + "device type", + dependsOnMethods = "testGetProfilesOfDeviceType") + public void testGetProfilesOfDeviceTypeThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.getProfilesOfDeviceType(anyString())).thenThrow(new ProfileManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getProfilesOfDeviceType(DEVICE_TYPE_C), "profileDAO", + profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when retrieving all profiles of a " + + "device type", + dependsOnMethods = "testGetProfilesOfDeviceTypeThrowingProfileManagerDAOException") + public void testGetProfilesOfDeviceTypeThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.getAllProfileFeatures()).thenThrow(new FeatureManagerDAOException()); + testThrowingException(profile1, p -> profileManager.getProfilesOfDeviceType(DEVICE_TYPE_C), "featureDAO", + featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when retrieving all profiles of a device type", + dependsOnMethods = "testGetProfilesOfDeviceTypeThrowingFeatureManagerDAOException", + expectedExceptions = IllegalTransactionStateException.class) + public void testGetProfilesOfDeviceTypeThrowingIllegalTransactionStateException() throws Exception { + //Creating profile object + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.second().second()).getConnection(); + + try { + profileManager.getProfilesOfDeviceType(DEVICE_TYPE_C); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests handling ProfileManagerDAOException when deleting a profile", + dependsOnMethods = "testGetProfilesOfDeviceTypeThrowingIllegalTransactionStateException") + public void testDeleteProfileThrowingProfileManagerDAOException() throws Exception { + ProfileDAO profileDAO = mock(ProfileDAOImpl.class); + when(profileDAO.deleteProfile(any(Profile.class))).thenThrow(new ProfileManagerDAOException()); + testThrowingException(profile1, p -> profileManager.deleteProfile(profile1), "profileDAO", profileDAO, + ProfileManagerDAOException.class); + } + + @Test(description = "This test case tests handling FeatureManagerDAOException when deleting a profile", + dependsOnMethods = "testDeleteProfileThrowingProfileManagerDAOException") + public void testDeleteProfileThrowingFeatureManagerDAOException() throws Exception { + FeatureDAO featureDAO = mock(FeatureDAO.class); + when(featureDAO.deleteFeaturesOfProfile(any(Profile.class))).thenThrow(new FeatureManagerDAOException()); + testThrowingException(profile1, p -> profileManager.deleteProfile(profile1), "featureDAO", featureDAO, + FeatureManagerDAOException.class); + } + + @Test(description = "This test case tests handling SQLException when deleting a profile", + dependsOnMethods = "testDeleteProfileThrowingFeatureManagerDAOException", + expectedExceptions = IllegalTransactionStateException.class) + public void testDeleteProfileThrowingIllegalTransactionStateException() throws Exception { + //Creating profile object + Pair> pair = mockConnection(); + PowerMockito.doThrow(new SQLException()).when(pair.second().second()).getConnection(); + + try { + profileManager.deleteProfile(profile1); + } finally { + PolicyManagementDAOFactory.init(pair.second().first()); + } + } + + @Test(description = "This test case tests deleting a profile", + dependsOnMethods = "testDeleteProfileThrowingIllegalTransactionStateException", + expectedExceptions = {ProfileManagementException.class}) + public void testDeleteProfile() throws Exception { + profileManager.deleteProfile(profile1); + Profile savedProfile = profileManager.getProfile(profile1.getProfileId()); + } +} \ No newline at end of file diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeADeviceManagementService.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java similarity index 93% rename from components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeADeviceManagementService.java rename to components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java index df070ab3c2..93fa5c6207 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeADeviceManagementService.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java @@ -32,12 +32,12 @@ import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import java.util.ArrayList; -public class TypeADeviceManagementService implements DeviceManagementService { +public class TypeXDeviceManagementService implements DeviceManagementService { - public static String DEVICE_TYPE = "deviceTypeA"; + private String deviceType; - public TypeADeviceManagementService() { - super(); + public TypeXDeviceManagementService(String deviceType) { + this.deviceType = deviceType; } @Override @@ -47,7 +47,7 @@ public class TypeADeviceManagementService implements DeviceManagementService { @Override public String getType() { - return DEVICE_TYPE; + return deviceType; } @Override diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/util/ProfileCreator.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/util/ProfileCreator.java index b1d05d969f..21a49c4e9a 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/util/ProfileCreator.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/util/ProfileCreator.java @@ -27,11 +27,15 @@ import java.util.List; public class ProfileCreator { public static Profile getProfile(List features) { + return getProfile(features, "android"); + } + + public static Profile getProfile(List features, String deviceType) { Profile profile = new Profile(); profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features)); profile.setProfileName("Test Profile"); profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID); - profile.setDeviceType("android"); + profile.setDeviceType(deviceType); return profile; } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/testng.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/testng.xml index 5daa8c13ed..7b8b22fe2d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/testng.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/testng.xml @@ -32,9 +32,10 @@ - + + diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index b3f6bfd697..fe65972831 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index a89b44a4ab..f6c2d2c7d1 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -21,7 +21,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 @@ -195,6 +195,10 @@ + + + + diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index db6aa3f59d..2516a1c37e 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 8a039c09cd..d54c44479b 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index aee0053b20..37906c1576 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index 21cd8e3d74..e7e287947b 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index 8bc00561d1..82cd9b3576 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - APIM Integration Client Feature http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index d6aaea623a..407a6c5a0e 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 6553a3d1a1..8fec63bacd 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index fcbce9d773..d8053c0983 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index 4ecaf97f03..474f5dfc00 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 6bbe7752d5..958fa1800d 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index a785c751f4..deb0a4edc5 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index 5802e02903..9cc379bc08 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 51fbc838cb..1b83a4c40d 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - FCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 929fc52057..d30d57d35b 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index e390d6c8f7..a0e2acab6a 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 11e4e7bc36..8ba5bd49b9 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index d607c28460..e6283535c2 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 2e15777494..ac1d112c10 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index 1186d6d60a..9351f97f19 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 4fec0a99b9..49c049722c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index ae3efcbd6b..7553125f02 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 9a0fd82651..bdd908be75 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index 3395a77803..57c6754010 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 3b195c6400..df8be27abc 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 95d3011678..44437526df 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index 574a06bb20..11cd6aafef 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index c7d209ebbe..a6a4081bc2 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 4b4bccf0c1..c5f9f06cc3 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - JWT Client Extension Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 477fef5cc7..9718e1ce6a 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 8b25b81a53..ba13e33228 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index b535ac8f55..35c254ec1b 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 92d4820562..0179dd9b60 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 46f2ed3adc..606900cb1b 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index e9557fcc6e..c8edaa93e3 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 7b2777a540..ff4e818f72 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1869,7 +1869,7 @@ 1.2.11.wso2v10 - 3.0.148-SNAPSHOT + 3.0.151-SNAPSHOT 4.4.8 @@ -1896,7 +1896,7 @@ [4.4.8, 5.0.0) - 2.7.16 + 3.2.0 2.5.11 1.1.wso2v1 1.9.0