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 e6a86f7b93..01a40d7f31 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.142-SNAPSHOT + 3.0.145-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 e03370a7a4..2b3c1af1a7 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 - 3.0.142-SNAPSHOT + 3.0.145-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 287aebc8ac..8144fe8c76 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 - 3.0.142-SNAPSHOT + 3.0.145-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 fbf3632d4b..430b92fc3b 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.142-SNAPSHOT + 3.0.145-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 ff81774344..0ec3bb433b 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.142-SNAPSHOT + 3.0.145-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 cac4ee206d..80a8057ce1 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.142-SNAPSHOT + 3.0.145-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 bad625d400..72843c6886 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,19 +22,24 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher http://wso2.org + + org.powermock + powermock-api-mockito + test + org.eclipse.osgi org.eclipse.osgi @@ -103,10 +108,15 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.client - + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + + + com.h2database.wso2 + h2-database-engine + test + @@ -150,25 +160,25 @@ org.wso2.carbon.apimgt.annotations.*, org.wso2.carbon.governance.lcm.util.*, org.wso2.carbon.registry.core.*, - io.swagger.annotations, - javax.net.ssl, - org.scannotation, - org.scannotation.archiveiterator, - org.w3c.dom, - org.wso2.carbon.apimgt.integration.client.*, - org.wso2.carbon.context, - org.wso2.carbon.core.util, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.*, - org.wso2.carbon.utils.multitenancy, - org.wso2.carbon.apimgt.integration.generated.client.publisher.api, - org.wso2.carbon.apimgt.integration.generated.client.publisher.model + io.swagger.annotations, + javax.net.ssl, + org.scannotation, + org.scannotation.archiveiterator, + org.w3c.dom, + org.wso2.carbon.apimgt.integration.client.*, + org.wso2.carbon.context, + org.wso2.carbon.core.util, + org.wso2.carbon.user.api, + org.wso2.carbon.user.core.*, + org.wso2.carbon.utils.multitenancy, + org.wso2.carbon.apimgt.integration.generated.client.publisher.api, + org.wso2.carbon.apimgt.integration.generated.client.publisher.model javax.ws.rs-api, scribe;scope=compile|runtime;inline=false; - * + * @@ -200,5 +210,4 @@ - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java new file mode 100644 index 0000000000..cf313fca21 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java @@ -0,0 +1,100 @@ +/* +* 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.apimgt.webapp.publisher; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; +import org.wso2.carbon.apimgt.integration.client.model.OAuthApplication; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiUriTemplate; +import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; + +import java.lang.reflect.Field; +import java.util.*; + +/** + * This is the test class for {@link APIPublisherServiceImpl} + */ +public class +APIPublisherServiceTest extends BaseAPIPublisherTest { + private static final Log log = LogFactory.getLog(APIPublisherServiceTest.class); + private APIPublisherServiceImpl apiPublisherService = new APIPublisherServiceImpl(); + private APIConfig apiConfig = new APIConfig(); + + @BeforeTest + public void initialConfigs() throws Exception { + setApiConfigs(apiConfig); + initializeOAuthApplication(); + } + + @Test(description = "Publishes an API | will fail if there are any exceptions") + public void publishAPI() throws NoSuchFieldException, IllegalAccessException, + APIManagerPublisherException { + apiPublisherService.publishAPI(apiConfig); + } + + private void setApiConfigs(APIConfig apiConfig) { + apiConfig.setName("Windows Device Management Administrative Service"); + apiConfig.setContext("/api/device-mgt/windows/v1.0/admin/devices"); + apiConfig.setOwner("admin"); + apiConfig.setEndpoint("https://localhost:9443/api/device-mgt/windows/v1.0/admin/devices"); + apiConfig.setVersion("1.0.0"); + apiConfig.setTransports("http,https"); + apiConfig.setPolicy(null); + apiConfig.setSharedWithAllTenants(true); + apiConfig.setTags(new String[]{"windows", "device_management"}); + apiConfig.setTenantDomain("carbon.super"); + apiConfig.setSecured(false); + Map apiScopes = new HashMap<>(); + Set scopes = new HashSet<>(apiScopes.values()); + apiConfig.setScopes(scopes); + setAPIURITemplates(apiConfig); + } + + private void setAPIURITemplates(APIConfig apiConfig) { + Set uriTemplates = new LinkedHashSet<>(); + ApiUriTemplate template = new ApiUriTemplate(); + template.setAuthType("Application & Application User"); + template.setHttpVerb("POST"); + template.setResourceURI("https://localhost:9443/api/device-mgt/windows/v1.0/admin/devices/reboot"); + template.setUriTemplate("/reboot"); + ApiScope scope = new ApiScope(); + scope.setKey("perm:windows:reboot"); + scope.setName("Reboot"); + scope.setRoles("/permission/admin/device-mgt/devices/owning-device/operations/windows/reboot"); + scope.setDescription("Lock reset on Windows devices"); + template.setScope(scope); + uriTemplates.add(template); + apiConfig.setUriTemplates(uriTemplates); + } + + private void initializeOAuthApplication() throws NoSuchFieldException, IllegalAccessException { + OAuthApplication oAuthApplication = new OAuthApplication(); + oAuthApplication.setClientName("admin_api_integration_client"); + oAuthApplication.setIsSaasApplication("true"); + oAuthApplication.setClientId("random"); + oAuthApplication.setClientSecret("random="); + Field oAuth = OAuthRequestInterceptor.class.getDeclaredField("oAuthApplication"); + oAuth.setAccessible(true); + oAuth.set(null, oAuthApplication); + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/BaseAPIPublisherTest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/BaseAPIPublisherTest.java new file mode 100644 index 0000000000..e935b98e2a --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/BaseAPIPublisherTest.java @@ -0,0 +1,125 @@ +/* + * 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.apimgt.webapp.publisher; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.annotations.BeforeSuite; +import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl; +import org.wso2.carbon.apimgt.integration.client.internal.APIIntegrationClientDataHolder; +import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi; +import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import org.wso2.carbon.apimgt.webapp.publisher.utils.Api; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.context.internal.OSGiDataHolder; +import org.wso2.carbon.identity.jwt.client.extension.JWTClient; +import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerServiceImpl; +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.api.UserStoreException; +import org.wso2.carbon.user.core.service.RealmService; + +import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.net.URL; + +import static org.mockito.Mockito.doReturn; + +/** + * Base class which initializes carbonContext and needed services. + */ +public abstract class BaseAPIPublisherTest { + + private static final Log log = LogFactory.getLog(BaseAPIPublisherTest.class); + + @BeforeSuite + public void initialize() throws Exception { + this.initializeCarbonContext(); + this.initServices(); + } + + private void initializeCarbonContext() throws RegistryException { + ClassLoader classLoader = getClass().getClassLoader(); + URL resourceUrl = classLoader.getResource("carbon-home"); + if (resourceUrl != null) { + File carbonHome = new File(resourceUrl.getFile()); + System.setProperty("carbon.home", carbonHome.getAbsolutePath()); + } + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants. + SUPER_TENANT_DOMAIN_NAME); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID); + } + + private void initServices() throws NoSuchFieldException, IllegalAccessException, + JWTClientException, UserStoreException, RegistryException { + + IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.class, + Mockito.CALLS_REAL_METHODS); + APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService); + PublisherClient publisherClient = Mockito.mock(PublisherClient.class, Mockito.CALLS_REAL_METHODS); + doReturn(publisherClient).when(integrationClientService).getPublisherClient(); + + APIsApi api = new Api(); + Field field = PublisherClient.class.getDeclaredField("api"); + field.setAccessible(true); + field.set(publisherClient, api); + + AccessTokenInfo accessTokenInfo = new AccessTokenInfo(); + final String REQUIRED_SCOPE = + "apim:api_create apim:api_view apim:api_publish apim:subscribe apim:tier_view apim:tier_manage " + + "apim:subscription_view apim:subscription_block"; + accessTokenInfo.setScopes(REQUIRED_SCOPE); + + JWTClientManagerService jwtClientManagerService = Mockito.mock(JWTClientManagerServiceImpl.class, + Mockito.CALLS_REAL_METHODS); + JWTClient jwtClient = Mockito.mock(JWTClient.class, Mockito.CALLS_REAL_METHODS); + doReturn(accessTokenInfo).when(jwtClient).getAccessToken(Mockito.anyString(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString()); + doReturn(jwtClient).when(jwtClientManagerService).getJWTClient(); + + APIIntegrationClientDataHolder.getInstance().setJwtClientManagerService(jwtClientManagerService); + RegistryService registryService = this.getRegistryService(); + OSGiDataHolder.getInstance().setRegistryService(registryService); + JWTClientExtensionDataHolder.getInstance().setRegistryService(registryService); + } + + private RegistryService getRegistryService() throws RegistryException, UserStoreException { + RealmService realmService = new InMemoryRealmService(); + APIPublisherDataHolder.getInstance().setRealmService(realmService); + RegistryDataHolder.getInstance().setRealmService(realmService); + JWTClientExtensionDataHolder.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(); + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Api.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Api.java new file mode 100644 index 0000000000..820da060a9 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Api.java @@ -0,0 +1,86 @@ +/* +* 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.apimgt.webapp.publisher.utils; + +import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.API; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.FileInfo; + +import java.io.File; + +/** + * Class to create Api for testing. + */ +public class Api implements APIsApi { + + @Override + public void apisApiIdDelete(String apiId, String ifMatch, String ifUnmodifiedSince) { + + } + + @Override + public API apisApiIdGet(String apiId, String accept, String ifNoneMatch, String ifModifiedSince) { + return null; + } + + @Override + public API apisApiIdPut(String apiId, API body, String contentType, String ifMatch, String ifUnmodifiedSince) { + return null; + } + + @Override + public void apisApiIdSwaggerGet(String apiId, String accept, String ifNoneMatch, String ifModifiedSince) { + + } + + @Override + public void apisApiIdSwaggerPut(String apiId, String apiDefinition, String contentType, String ifMatch, String ifUnmodifiedSince) { + + } + + @Override + public void apisApiIdThumbnailGet(String apiId, String accept, String ifNoneMatch, String ifModifiedSince) { + + } + + @Override + public FileInfo apisApiIdThumbnailPost(String apiId, File file, String contentType, String ifMatch, String ifUnmodifiedSince) { + return null; + } + + @Override + public void apisChangeLifecyclePost(String action, String apiId, String lifecycleChecklist, String ifMatch, String ifUnmodifiedSince) { + + } + + @Override + public void apisCopyApiPost(String newVersion, String apiId) { + + } + + @Override + public APIList apisGet(Integer limit, Integer offset, String query, String accept, String ifNoneMatch) { + return null; + } + + @Override + public API apisPost(API body, String contentType) { + return new API(); + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/dbscripts/h2.sql b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/dbscripts/h2.sql new file mode 100644 index 0000000000..f6b31c78d9 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/dbscripts/h2.sql @@ -0,0 +1,429 @@ +CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK ( + REG_LOCK_NAME VARCHAR (20), + REG_LOCK_STATUS VARCHAR (20), + REG_LOCKED_TIME TIMESTAMP, + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (REG_LOCK_NAME) +); + +CREATE TABLE IF NOT EXISTS REG_LOG ( + REG_LOG_ID INTEGER AUTO_INCREMENT, + REG_PATH VARCHAR (2000), + REG_USER_ID VARCHAR (31) NOT NULL, + REG_LOGGED_TIME TIMESTAMP NOT NULL, + REG_ACTION INTEGER NOT NULL, + REG_ACTION_DATA VARCHAR (500), + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (REG_LOG_ID, REG_TENANT_ID) +); + +CREATE INDEX IF NOT EXISTS REG_LOG_IND_BY_REG_LOGTIME ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID); + +CREATE TABLE IF NOT EXISTS REG_PATH( + REG_PATH_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_PATH_VALUE VARCHAR(2000) NOT NULL, + REG_PATH_PARENT_ID INT, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID) +); +CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_NAME ON REG_PATH(REG_PATH_VALUE, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_PARENT_ID ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID); + + +CREATE TABLE IF NOT EXISTS REG_CONTENT ( + REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_CONTENT_DATA LONGBLOB, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_CONTENT PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY ( + REG_CONTENT_ID INTEGER NOT NULL, + REG_CONTENT_DATA LONGBLOB, + REG_DELETED SMALLINT, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_CONTENT_HISTORY PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE ( + REG_PATH_ID INTEGER NOT NULL, + REG_NAME VARCHAR(256), + REG_VERSION INTEGER NOT NULL AUTO_INCREMENT, + REG_MEDIA_TYPE VARCHAR(500), + REG_CREATOR VARCHAR(31) NOT NULL, + REG_CREATED_TIME TIMESTAMP NOT NULL, + REG_LAST_UPDATOR VARCHAR(31), + REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL, + REG_DESCRIPTION VARCHAR(1000), + REG_CONTENT_ID INTEGER, + REG_TENANT_ID INTEGER DEFAULT 0, + REG_UUID VARCHAR(100) NOT NULL, + CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID) +); + +ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_NAME ON REG_RESOURCE(REG_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_UUID ON REG_RESOURCE(REG_UUID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TENANT ON REG_RESOURCE(REG_TENANT_ID, REG_UUID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TYPE ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY ( + REG_PATH_ID INTEGER NOT NULL, + REG_NAME VARCHAR(256), + REG_VERSION INTEGER NOT NULL, + REG_MEDIA_TYPE VARCHAR(500), + REG_CREATOR VARCHAR(31) NOT NULL, + REG_CREATED_TIME TIMESTAMP NOT NULL, + REG_LAST_UPDATOR VARCHAR(31), + REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL, + REG_DESCRIPTION VARCHAR(1000), + REG_CONTENT_ID INTEGER, + REG_DELETED SMALLINT, + REG_TENANT_ID INTEGER DEFAULT 0, + REG_UUID VARCHAR(100) NOT NULL, + CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION, REG_TENANT_ID) +); + +ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_NAME ON REG_RESOURCE_HISTORY(REG_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID); + +CREATE TABLE IF NOT EXISTS REG_COMMENT ( + REG_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_COMMENT_TEXT VARCHAR(500) NOT NULL, + REG_USER_ID VARCHAR(31) NOT NULL, + REG_COMMENTED_TIME TIMESTAMP NOT NULL, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_COMMENT PRIMARY KEY(REG_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE_COMMENT ( + REG_COMMENT_ID INTEGER NOT NULL, + REG_VERSION INTEGER, + REG_PATH_ID INTEGER, + REG_RESOURCE_NAME VARCHAR(256), + REG_TENANT_ID INTEGER DEFAULT 0 +); + +ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_VERSION ON REG_RESOURCE_COMMENT(REG_VERSION, REG_TENANT_ID); + +CREATE TABLE IF NOT EXISTS REG_RATING ( + REG_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_RATING INTEGER NOT NULL, + REG_USER_ID VARCHAR(31) NOT NULL, + REG_RATED_TIME TIMESTAMP NOT NULL, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_RATING PRIMARY KEY(REG_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE_RATING ( + REG_RATING_ID INTEGER NOT NULL, + REG_VERSION INTEGER, + REG_PATH_ID INTEGER, + REG_RESOURCE_NAME VARCHAR(256), + REG_TENANT_ID INTEGER DEFAULT 0 +); + +ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_RATING_ID FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_VERSION ON REG_RESOURCE_RATING(REG_VERSION, REG_TENANT_ID); + + +CREATE TABLE IF NOT EXISTS REG_TAG ( + REG_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_TAG_NAME VARCHAR(500) NOT NULL, + REG_USER_ID VARCHAR(31) NOT NULL, + REG_TAGGED_TIME TIMESTAMP NOT NULL, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_TAG PRIMARY KEY(REG_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE_TAG ( + REG_TAG_ID INTEGER NOT NULL, + REG_VERSION INTEGER, + REG_PATH_ID INTEGER, + REG_RESOURCE_NAME VARCHAR(256), + REG_TENANT_ID INTEGER DEFAULT 0 +); + +ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_VERSION ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID); + +CREATE TABLE IF NOT EXISTS REG_PROPERTY ( + REG_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_NAME VARCHAR(100) NOT NULL, + REG_VALUE VARCHAR(1000), + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_PROPERTY PRIMARY KEY(REG_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY ( + REG_PROPERTY_ID INTEGER NOT NULL, + REG_VERSION INTEGER, + REG_PATH_ID INTEGER, + REG_RESOURCE_NAME VARCHAR(256), + REG_TENANT_ID INTEGER DEFAULT 0 +); + +ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_VERSION ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID); + +CREATE TABLE IF NOT EXISTS REG_ASSOCIATION ( + REG_ASSOCIATION_ID INTEGER AUTO_INCREMENT, + REG_SOURCEPATH VARCHAR (2000) NOT NULL, + REG_TARGETPATH VARCHAR (2000) NOT NULL, + REG_ASSOCIATION_TYPE VARCHAR (2000) NOT NULL, + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (REG_ASSOCIATION_ID, REG_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS REG_SNAPSHOT ( + REG_SNAPSHOT_ID INTEGER NOT NULL AUTO_INCREMENT, + REG_PATH_ID INTEGER NOT NULL, + REG_RESOURCE_NAME VARCHAR (256), + REG_RESOURCE_VIDS LONGBLOB NOT NULL, + REG_TENANT_ID INTEGER DEFAULT 0, + CONSTRAINT PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID) +); + +ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT IF NOT EXISTS REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); +CREATE INDEX IF NOT EXISTS REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_SNAPSHOT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); + +-- ################################ +-- USER MANAGER TABLES +-- ################################ + +CREATE TABLE IF NOT EXISTS UM_TENANT ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DOMAIN_NAME VARCHAR(255) NOT NULL, + UM_EMAIL VARCHAR(255), + UM_ACTIVE BOOLEAN DEFAULT FALSE, + UM_CREATED_DATE TIMESTAMP NOT NULL, + UM_USER_CONFIG LONGBLOB NOT NULL, + PRIMARY KEY (UM_ID), + UNIQUE(UM_DOMAIN_NAME)); + +CREATE TABLE IF NOT EXISTS UM_DOMAIN( + UM_DOMAIN_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DOMAIN_NAME VARCHAR(255), + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_DOMAIN_ID, UM_TENANT_ID) +); + +CREATE INDEX IF NOT EXISTS INDEX_UM_TENANT_UM_DOMAIN_NAME ON UM_TENANT (UM_DOMAIN_NAME); + +CREATE TABLE IF NOT EXISTS UM_USER ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_USER_PASSWORD VARCHAR(255) NOT NULL, + UM_SALT_VALUE VARCHAR(31), + UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE, + UM_CHANGED_TIME TIMESTAMP NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID), + UNIQUE(UM_USER_NAME, UM_TENANT_ID)); + +CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_USER_PASSWORD VARCHAR(255) NOT NULL, + UM_SALT_VALUE VARCHAR(31), + UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE, + UM_CHANGED_TIME TIMESTAMP NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID), + UNIQUE(UM_USER_NAME, UM_TENANT_ID)); + +CREATE TABLE IF NOT EXISTS UM_USER_ATTRIBUTE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ATTR_NAME VARCHAR(255) NOT NULL, + UM_ATTR_VALUE VARCHAR(1024), + UM_PROFILE_ID VARCHAR(255), + UM_USER_ID INTEGER, + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID), + FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID)); + +CREATE INDEX IF NOT EXISTS UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID); + +CREATE TABLE IF NOT EXISTS UM_ROLE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ROLE_NAME VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_SHARED_ROLE BOOLEAN DEFAULT FALSE, + PRIMARY KEY (UM_ID, UM_TENANT_ID), + UNIQUE(UM_ROLE_NAME, UM_TENANT_ID)); + +CREATE TABLE IF NOT EXISTS UM_MODULE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_MODULE_NAME VARCHAR(100), + UNIQUE(UM_MODULE_NAME), + PRIMARY KEY(UM_ID) +); + +CREATE TABLE IF NOT EXISTS UM_MODULE_ACTIONS( + UM_ACTION VARCHAR(255) NOT NULL, + UM_MODULE_ID INTEGER NOT NULL, + PRIMARY KEY(UM_ACTION, UM_MODULE_ID), + FOREIGN KEY (UM_MODULE_ID) REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS UM_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_RESOURCE_ID VARCHAR(255) NOT NULL, + UM_ACTION VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_MODULE_ID INTEGER DEFAULT 0, + UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID)); + +CREATE INDEX IF NOT EXISTS INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID); + +CREATE TABLE IF NOT EXISTS UM_ROLE_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_PERMISSION_ID INTEGER NOT NULL, + UM_ROLE_NAME VARCHAR(255) NOT NULL, + UM_IS_ALLOWED SMALLINT NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_DOMAIN_ID INTEGER, + FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, + FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE, + PRIMARY KEY (UM_ID, UM_TENANT_ID)); + +CREATE TABLE IF NOT EXISTS UM_USER_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_PERMISSION_ID INTEGER NOT NULL, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_IS_ALLOWED SMALLINT NOT NULL, + UNIQUE (UM_PERMISSION_ID, UM_USER_NAME, UM_TENANT_ID), + UM_TENANT_ID INTEGER DEFAULT 0, + FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, + PRIMARY KEY (UM_ID, UM_TENANT_ID)); + +CREATE TABLE IF NOT EXISTS UM_USER_ROLE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ROLE_ID INTEGER NOT NULL, + UM_USER_ID INTEGER NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID), + FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID), + FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID)); + + +CREATE TABLE IF NOT EXISTS UM_SHARED_USER_ROLE( + UM_ROLE_ID INTEGER NOT NULL, + UM_USER_ID INTEGER NOT NULL, + UM_USER_TENANT_ID INTEGER NOT NULL, + UM_ROLE_TENANT_ID INTEGER NOT NULL, + UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID, UM_ROLE_TENANT_ID), + FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE , + FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID) REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS UM_ACCOUNT_MAPPING( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER NOT NULL, + UM_USER_STORE_DOMAIN VARCHAR(100), + UM_ACC_LINK_ID INTEGER NOT NULL, + UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID), + FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE, + PRIMARY KEY (UM_ID) +); + + +CREATE TABLE IF NOT EXISTS UM_DIALECT( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_URI VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE(UM_DIALECT_URI, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + + +CREATE TABLE IF NOT EXISTS UM_CLAIM( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_ID INTEGER NOT NULL, + UM_CLAIM_URI VARCHAR(255) NOT NULL, + UM_DISPLAY_TAG VARCHAR(255), + UM_DESCRIPTION VARCHAR(255), + UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255), + UM_MAPPED_ATTRIBUTE VARCHAR(255), + UM_REG_EX VARCHAR(255), + UM_SUPPORTED SMALLINT, + UM_REQUIRED SMALLINT, + UM_DISPLAY_ORDER INTEGER, + UM_CHECKED_ATTRIBUTE SMALLINT, + UM_READ_ONLY SMALLINT, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI,UM_MAPPED_ATTRIBUTE_DOMAIN, UM_TENANT_ID), + FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS UM_PROFILE_CONFIG( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_ID INTEGER, + UM_PROFILE_NAME VARCHAR(255), + UM_TENANT_ID INTEGER DEFAULT 0, + FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + + +CREATE TABLE IF NOT EXISTS UM_HYBRID_ROLE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ROLE_NAME VARCHAR(255), + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS UM_HYBRID_USER_ROLE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255), + UM_ROLE_ID INTEGER NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_DOMAIN_ID INTEGER, + UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID,UM_DOMAIN_ID), + FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, + FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE, + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS UM_HYBRID_REMEMBER_ME ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_COOKIE_VALUE VARCHAR(1024), + UM_CREATED_TIME TIMESTAMP, + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS UM_SYSTEM_ROLE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ROLE_NAME VARCHAR(255), + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER_ROLE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255), + UM_ROLE_ID INTEGER NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID), + FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID) +); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/registry.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/registry.xml new file mode 100644 index 0000000000..0bb97a7dc9 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/registry.xml @@ -0,0 +1,50 @@ + + + + + + + + wso2registry + false + true + / + + + jdbc:h2:./target/databasetest/CARBON_TEST + + org.h2.Driver + 80 + 60000 + 5 + + + false + + + + true + true + true + true + + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/testng.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/testng.xml new file mode 100644 index 0000000000..7dfa0ef71a --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/testng.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/user-test/user-mgt-registry-test.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/user-test/user-mgt-registry-test.xml new file mode 100644 index 0000000000..bac4fc7667 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/user-test/user-mgt-registry-test.xml @@ -0,0 +1,80 @@ + + + + + true + admin + + admin + admin + + everyone + false + 500 + jdbc:h2:target/databasetest/CARBON_TEST + org.h2.Driver + 50 + 60000 + 5 + + + org.wso2.carbon.user.core.tenant.JDBCTenantManager + false + 100 + false + default + SHA-256 + true + true + true + false + ^[\S]{5,30}$ + Password length should be between 5 to 30 characters + + ^[\S]{5,30}$ + [a-zA-Z0-9._-|//]{3,30}$ + ^[\S]{3,30}$ + ^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$ + ^[\S]{3,30}$ + true + 100 + 100 + false + false + true + , + true + + + true + + + + login + manage-configuration + manage-security + upload-services + manage-services + manage-lc-configuration + manage-mediation + monitor-system + delegate-identity + + diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 5e16b5a158..eff6a49bcb 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.142-SNAPSHOT + 3.0.145-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 49174c9b1d..a617b24c0a 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.142-SNAPSHOT + 3.0.145-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 e0755b023f..843ee002b4 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.142-SNAPSHOT + 3.0.145-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 75cffd0376..b06d36ca42 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.142-SNAPSHOT + 3.0.145-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 0c957d3ab9..6cb0e09b82 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.142-SNAPSHOT + 3.0.145-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 1293d0a155..f73413d30c 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.142-SNAPSHOT + 3.0.145-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 ac2c10c942..8d2dd41c38 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.142-SNAPSHOT + 3.0.145-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 8d00195a75..d33d704db6 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.142-SNAPSHOT + 3.0.145-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 421f778044..9f4cf3f719 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.142-SNAPSHOT + 3.0.145-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 23fb100f4c..9bd6e9b3c4 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.142-SNAPSHOT + 3.0.145-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 2b26917fb3..4aa469074d 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index d00a7c0a52..69239a8995 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.142-SNAPSHOT + 3.0.145-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 ba6fb2f6dc..e64544a6ac 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.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 511810e335..767c5b008c 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 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 c0b360136b..bc829ee28e 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.142-SNAPSHOT + 3.0.145-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 d0a0f2dbd3..39d08c73f3 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 4c1454015b..552c10d12e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -237,10 +237,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv String msg = "Error occurred while adding enrolment related metadata for device: " + device.getId(); log.error(msg, e); throw new DeviceManagementException(msg, e); - } catch (TransactionManagementException e) { - String msg = "Error occurred while initiating transaction to enrol device: " + device.getId(); - log.error(msg); - throw new DeviceManagementException(msg, e); } catch (Exception e) { String msg = "Error occurred while enrolling device: " + device.getId(); log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java index 355ec9a55a..5065109f35 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java @@ -44,19 +44,26 @@ public class TestDataHolder { public static Device generateDummyDeviceData(String deviceType) { Device device = new Device(); - EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); - enrolmentInfo.setDateOfEnrolment(new Date().getTime()); - enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); - enrolmentInfo.setOwner(OWNER); - enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); - device.setEnrolmentInfo(enrolmentInfo); + device.setEnrolmentInfo(generateEnrollmentInfo(new Date().getTime(), new Date().getTime(), OWNER, EnrolmentInfo + .OwnerShip.BYOD, EnrolmentInfo.Status.CREATED)); device.setDescription("Test Description"); device.setDeviceIdentifier(initialDeviceIdentifier); device.setType(deviceType); return device; } + public static EnrolmentInfo generateEnrollmentInfo(long dateOfEnrollment, long dateOfLastUpdate, + String owner, EnrolmentInfo.OwnerShip ownership, + EnrolmentInfo.Status status) { + EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); + enrolmentInfo.setDateOfEnrolment(dateOfEnrollment); + enrolmentInfo.setDateOfLastUpdate(dateOfLastUpdate); + enrolmentInfo.setOwner(owner); + enrolmentInfo.setOwnership(ownership); + enrolmentInfo.setStatus(status); + return enrolmentInfo; + } + public static DeviceInfo generateDummyDeviceInfo() { DeviceInfo deviceInfo = new DeviceInfo(); deviceInfo.setIMEI("IMEI-12345"); @@ -100,6 +107,7 @@ public class TestDataHolder { device.setDescription("Test Description"); device.setDeviceIdentifier(deviceIdentifier); device.setType(deviceType); + device.setName(deviceType+"-"+deviceIdentifier); return device; } @@ -123,17 +131,13 @@ public class TestDataHolder { } public static Device generateDummyDeviceData(DeviceIdentifier deviceIdentifier) { - Device device = new Device(); - EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); - enrolmentInfo.setDateOfEnrolment(new Date().getTime()); - enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); - enrolmentInfo.setOwner(OWNER); - enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); - device.setEnrolmentInfo(enrolmentInfo); - device.setDescription("Test Description"); - device.setDeviceIdentifier(deviceIdentifier.getId()); - device.setType(deviceIdentifier.getType()); + Device device = new Device(); + device.setEnrolmentInfo(generateEnrollmentInfo(new Date().getTime(), new Date().getTime(), OWNER, EnrolmentInfo + .OwnerShip.BYOD, EnrolmentInfo.Status.CREATED)); + device.setDescription("Test Description"); + device.setDeviceIdentifier(deviceIdentifier.getId()); + device.setType(deviceIdentifier.getType()); + device.setName(deviceIdentifier.getType()+"-"+deviceIdentifier.getId()); return device; } 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 1975a56828..3b57176b63 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 @@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.TransactionManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.License; @@ -50,12 +51,15 @@ import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.io.InputStream; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Properties; public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTest { private static final Log log = LogFactory.getLog(DeviceManagementProviderServiceTest.class); + public static final String DEVICE_ID = "9999"; + public static final String ALTERNATE_DEVICE_ID = "1128"; private DeviceManagementProviderService providerService; private static final String DEVICE_TYPE = "RANDOM_DEVICE_TYPE"; private DeviceDetailsDAO deviceDetailsDAO = DeviceManagementDAOFactory.getDeviceDetailsDAO(); @@ -89,63 +93,39 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes } @Test - public void testGetAvailableDeviceTypes() { - try { - List deviceTypes = deviceMgtService.getDeviceTypes(); - Assert.assertTrue(deviceTypes.size() > 0); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting the device types"; - Assert.fail(msg, e); - } + public void testGetAvailableDeviceTypes() throws DeviceManagementException { + List deviceTypes = deviceMgtService.getDeviceTypes(); + Assert.assertTrue(deviceTypes.size() > 0); } - @Test - public void testNullDeviceEnrollment() { - try { - boolean enrollmentStatus = deviceMgtService.enrollDevice(null); - } catch (DeviceManagementException e) { - Assert.assertTrue(true); - } + @Test(expectedExceptions = DeviceManagementException.class) + public void testNullDeviceEnrollment() throws DeviceManagementException { + deviceMgtService.enrollDevice(null); } @Test - public void testSuccessfulDeviceEnrollment() { - Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); - try { - boolean enrollmentStatus = deviceMgtService.enrollDevice(device); - Assert.assertTrue(enrollmentStatus); - } catch (DeviceManagementException e) { - String msg = "Error occurred while enrolling device"; - Assert.fail(msg, e); - } + public void testSuccessfulDeviceEnrollment() throws DeviceManagementException { + Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)); + boolean enrollmentStatus = deviceMgtService.enrollDevice(device); + Assert.assertTrue(enrollmentStatus); } @Test(dependsOnMethods = "testSuccessfulDeviceEnrollment") - public void testIsEnrolled() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(TestDataHolder.initialDeviceIdentifier); - deviceIdentifier.setType(DEVICE_TYPE); - boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier); - Assert.assertTrue(enrollmentStatus); - } catch (DeviceManagementException e) { - String msg = "Error occurred while checking enrollment status."; - Assert.fail(msg, e); - } + public void testIsEnrolled() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(DEVICE_ID); + deviceIdentifier.setType(DEVICE_TYPE); + boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier); + Assert.assertTrue(enrollmentStatus); } @Test - public void testIsEnrolledForNonExistingDevice() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId("34535235235235235"); - deviceIdentifier.setType(DEVICE_TYPE); - boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier); - Assert.assertFalse(enrollmentStatus); - } catch (DeviceManagementException e) { - String msg = "Error occurred while checking enrollment status."; - Assert.fail(msg, e); - } + public void testIsEnrolledForNonExistingDevice() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId("34535235235235235"); + deviceIdentifier.setType(DEVICE_TYPE); + boolean enrollmentStatus = deviceMgtService.isEnrolled(deviceIdentifier); + Assert.assertFalse(enrollmentStatus); } @Test(expectedExceptions = DeviceManagementException.class) @@ -154,34 +134,22 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes } @Test - public void testNonExistentDeviceType() { + public void testNonExistentDeviceType() throws DeviceManagementException { Device device = TestDataHolder.generateDummyDeviceData("abc"); - try { - boolean enrollmentStatus = deviceMgtService.enrollDevice(device); - Assert.assertFalse(enrollmentStatus); - } catch (DeviceManagementException e) { - String msg = "Error occurred while enrolling device"; - Assert.fail(msg, e); - } + boolean enrollmentStatus = deviceMgtService.enrollDevice(device); + Assert.assertFalse(enrollmentStatus); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testReEnrollmentofSameDeviceUnderSameUser() { - Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); - - try { - boolean enrollment = deviceMgtService.enrollDevice(device); - - Assert.assertTrue(enrollment); - } catch (DeviceManagementException e) { - String msg = "Error occurred while enrolling device"; - Assert.fail(msg, e); - } + public void testReEnrollmentofSameDeviceUnderSameUser() throws DeviceManagementException { + Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)); + boolean enrollment = deviceMgtService.enrollDevice(device); + Assert.assertTrue(enrollment); } @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"}) - public void testReEnrollmentofSameDeviceWithOtherUser() { + public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException { EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); enrolmentInfo.setDateOfEnrolment(new Date().getTime()); @@ -190,76 +158,48 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); - Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE, + Device alternateDevice = TestDataHolder.generateDummyDeviceData(DEVICE_ID, DEVICE_TYPE, enrolmentInfo); + Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE)); - try { - Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE)); - - deviceMgtService.enrollDevice(alternateDevice); - Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice - .getDeviceIdentifier(), alternateDevice.getType())); + deviceMgtService.enrollDevice(alternateDevice); + Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice + .getDeviceIdentifier(), alternateDevice.getType())); - log.info(retrievedDevice1.getEnrolmentInfo().getOwner()); - log.info(retrievedDevice2.getEnrolmentInfo().getOwner()); - - Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase - (retrievedDevice2.getEnrolmentInfo().getOwner())); - } catch (DeviceManagementException e) { - String msg = "Error Occured while enrolling device"; - Assert.fail(msg, e); - } + Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase + (retrievedDevice2.getEnrolmentInfo().getOwner())); } @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"}) - public void testDisenrollment() { - Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); - try { - boolean disenrollmentStatus = deviceMgtService.disenrollDevice(new DeviceIdentifier - (device - .getDeviceIdentifier(), - device.getType())); - log.info(disenrollmentStatus); - - Assert.assertTrue(disenrollmentStatus); - } catch (DeviceManagementException e) { - String msg = "Error occurred while enrolling device"; - Assert.fail(msg, e); - } + public void testDisenrollment() throws DeviceManagementException { + Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)); + boolean disenrollmentStatus = deviceMgtService.disenrollDevice(new DeviceIdentifier + (device + .getDeviceIdentifier(), + device.getType())); + log.info(disenrollmentStatus); + + Assert.assertTrue(disenrollmentStatus); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDeviceCount() { - try { - int count = deviceMgtService.getDeviceCount(); - Assert.assertTrue(count > 0); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting the device count"; - Assert.fail(msg, e); - } + public void testGetDeviceCount() throws DeviceManagementException { + int count = deviceMgtService.getDeviceCount(); + Assert.assertTrue(count > 0); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDeviceCountForUser() { - try { - int count = deviceMgtService.getDeviceCount(TestDataHolder.OWNER); - Assert.assertTrue(count > 0); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting the device count"; - Assert.fail(msg, e); - } + public void testGetDeviceCountForUser() throws DeviceManagementException { + int count = deviceMgtService.getDeviceCount(TestDataHolder.OWNER); + Assert.assertTrue(count > 0); } @Test - public void testGetDeviceCountForNonExistingUser() { - try { - int count = deviceMgtService.getDeviceCount("ABCD"); - Assert.assertEquals(count, 0); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting the device count"; - Assert.fail(msg, e); - } + public void testGetDeviceCountForNonExistingUser() throws DeviceManagementException { + int count = deviceMgtService.getDeviceCount("ABCD"); + Assert.assertEquals(count, 0); } @Test(expectedExceptions = DeviceManagementException.class) @@ -268,214 +208,182 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testIsActive() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(TestDataHolder.initialDeviceIdentifier); - deviceIdentifier.setType(DEVICE_TYPE); - Assert.assertTrue(deviceMgtService.isActive(deviceIdentifier)); - } catch (DeviceManagementException e) { - String msg = "Error occurred while checking the device status"; - Assert.fail(msg, e); - } + public void testIsActive() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(TestDataHolder.initialDeviceIdentifier); + deviceIdentifier.setType(DEVICE_TYPE); + Assert.assertTrue(deviceMgtService.isActive(deviceIdentifier)); } @Test - public void testIsActiveForNonExistingDevice() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId("34535235235235235"); - deviceIdentifier.setType("TEST_TYPE"); - Assert.assertFalse(deviceMgtService.isActive(deviceIdentifier)); - } catch (DeviceManagementException e) { - String msg = "Error occurred while checking the device status"; - Assert.fail(msg, e); - } + public void testIsActiveForNonExistingDevice() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId("34535235235235235"); + deviceIdentifier.setType("TEST_TYPE"); + Assert.assertFalse(deviceMgtService.isActive(deviceIdentifier)); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testSetActive() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(TestDataHolder.initialDeviceIdentifier); - deviceIdentifier.setType(DEVICE_TYPE); - Assert.assertFalse(deviceMgtService.setActive(deviceIdentifier, true)); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testSetActive() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(TestDataHolder.initialDeviceIdentifier); + deviceIdentifier.setType(DEVICE_TYPE); + Assert.assertFalse(deviceMgtService.setActive(deviceIdentifier, true)); } @Test - public void testSetActiveForNonExistingDevice() { - try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId("34535235235235235"); - deviceIdentifier.setType("TEST_TYPE"); - Assert.assertFalse(deviceMgtService.setActive(deviceIdentifier, true)); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status for non-existing device"; - Assert.fail(msg, e); - } + public void testSetActiveForNonExistingDevice() throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId("34535235235235235"); + deviceIdentifier.setType("TEST_TYPE"); + Assert.assertFalse(deviceMgtService.setActive(deviceIdentifier, true)); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDeviceEnrolledTenants() { - try { - List tenants = deviceMgtService.getDeviceEnrolledTenants(); - Assert.assertEquals(tenants.size(), 1); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetDeviceEnrolledTenants() throws DeviceManagementException { + List tenants = deviceMgtService.getDeviceEnrolledTenants(); + Assert.assertEquals(tenants.size(), 1); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDevice() { - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345",DEVICE_TYPE)); - Assert.assertTrue(device.getDeviceIdentifier().equalsIgnoreCase("12345")); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetDevice() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)); + Assert.assertTrue(device.getDeviceIdentifier().equalsIgnoreCase(DEVICE_ID)); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDeviceWithInfo() { - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE) - , true); - Assert.assertTrue(device.getDeviceInfo() != null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetDeviceWithInfo() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE) + , true); + Assert.assertTrue(device.getDeviceInfo() != null); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetDeviceWithOutInfo() { - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE) - , false); - Assert.assertTrue(device.getDeviceInfo() == null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetDeviceWithOutInfo() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE) + , false); + Assert.assertTrue(device.getDeviceInfo() == null); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetAllDevicesOfRole() { - try { - List devices = deviceMgtService.getAllDevicesOfRole("admin"); - Assert.assertTrue(devices.size() > 0); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetAllDevicesOfRole() throws DeviceManagementException { + List devices = deviceMgtService.getAllDevicesOfRole("admin"); + Assert.assertTrue(devices.size() > 0); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testDeviceByOwner() { - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", - DEVICE_TYPE), "admin", true); - Assert.assertTrue(device != null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testDeviceByOwner() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE), "admin", true); + Assert.assertTrue(device != null); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testDeviceByDate() { - try { - Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier("12345", - DEVICE_TYPE)); - - DeviceManagementDAOFactory.beginTransaction(); - - //Device details table will be reffered when looking for last updated time - //This dao entry is to mimic a device info operation - deviceDetailsDAO.addDeviceInformation(initialDevice.getId(), TestDataHolder - .generateDummyDeviceInfo()); - } catch (DeviceManagementException e) { - e.printStackTrace(); - } catch (TransactionManagementException e) { - e.printStackTrace(); - } catch (DeviceDetailsMgtDAOException e) { - e.printStackTrace(); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", - DEVICE_TYPE), yesterday()); - Assert.assertTrue(device != null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testDeviceByDate() throws DeviceManagementException, TransactionManagementException, DeviceDetailsMgtDAOException { + Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE)); + + DeviceManagementDAOFactory.beginTransaction(); + + //Device details table will be reffered when looking for last updated time + //This dao entry is to mimic a device info operation + deviceDetailsDAO.addDeviceInformation(initialDevice.getId(), TestDataHolder + .generateDummyDeviceInfo()); + + DeviceManagementDAOFactory.closeConnection(); + + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE), yesterday()); + Assert.assertTrue(device != null); } @Test(dependsOnMethods = {"testDeviceByDate"}) - public void testDeviceByDateAndOwner() { - try { - Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", - DEVICE_TYPE), "admin", yesterday(), true); - Assert.assertTrue(device != null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testDeviceByDateAndOwner() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE), "admin", yesterday(), true); + Assert.assertTrue(device != null); } @Test - public void testGetAvaliableDeviceTypes() { - try { - List deviceTypes = deviceMgtService.getAvailableDeviceTypes(); - Assert.assertTrue(!deviceTypes.isEmpty()); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetAvaliableDeviceTypes() throws DeviceManagementException { + List deviceTypes = deviceMgtService.getAvailableDeviceTypes(); + Assert.assertTrue(!deviceTypes.isEmpty()); } @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) - public void testGetAllDevices() { - try { - List devices = deviceMgtService.getAllDevices(); - Assert.assertTrue(!devices.isEmpty()); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + public void testGetAllDevices() throws DeviceManagementException { + List devices = deviceMgtService.getAllDevices(); + Assert.assertTrue(!devices.isEmpty()); } - @Test(dependsOnMethods = {"testDeviceByDate"}) - public void testGetAllDevicesWithInfo() { - try { - List devices = deviceMgtService.getAllDevices(true); - Assert.assertTrue(!devices.isEmpty()); - Assert.assertTrue(devices.get(0).getDeviceInfo() != null); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesPaginated() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + PaginationResult result = deviceMgtService.getAllDevices(request); + Assert.assertTrue(result.getRecordsTotal() > 0); } - @Test(dependsOnMethods = {"testDeviceByDate"}) - public void testGetLicense() { - try { - License license = deviceMgtService.getLicense(DEVICE_TYPE, "ENG"); - Assert.assertTrue(license.getLanguage().equalsIgnoreCase("ENG")); - } catch (DeviceManagementException e) { - String msg = "Error occurred while updating the device status"; - Assert.fail(msg, e); - } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesByName() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID); + PaginationResult result = deviceMgtService.getDevicesByName(request); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesByNameAndType() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setDeviceName(DEVICE_TYPE + "-" + DEVICE_ID); + request.setDeviceType(DEVICE_TYPE); + List devices = deviceMgtService.getDevicesByNameAndType(request, true); + Assert.assertTrue(!devices.isEmpty()); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesByStatus() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setStatus(EnrolmentInfo.Status.ACTIVE.toString()); + PaginationResult result = deviceMgtService.getDevicesByStatus(request, true); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDevicesOfTypePaginated() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setDeviceType(DEVICE_TYPE); + PaginationResult result = deviceMgtService.getDevicesByType(request); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesWithInfo() throws DeviceManagementException { + List devices = deviceMgtService.getAllDevices(true); + Assert.assertTrue(!devices.isEmpty()); + Assert.assertTrue(devices.get(0).getDeviceInfo() != null); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesWithInfoPaginated() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + PaginationResult result = deviceMgtService.getAllDevices(request, true); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetTenantedDevice() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + HashMap deviceMap = deviceMgtService.getTenantedDevice(new + DeviceIdentifier + (DEVICE_ID, DEVICE_TYPE)); + Assert.assertTrue(!deviceMap.isEmpty()); + } + + @Test + public void testGetLicense() throws DeviceManagementException { + License license = deviceMgtService.getLicense(DEVICE_TYPE, "ENG"); + Assert.assertTrue(license.getLanguage().equalsIgnoreCase("ENG")); } @Test(expectedExceptions = DeviceManagementException.class) @@ -484,26 +392,83 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes Assert.assertTrue(false); } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviesOfUser() throws DeviceManagementException { + List devices = deviceMgtService.getDevicesOfUser("admin"); + Assert.assertTrue(!devices.isEmpty()); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDevieByStatus() throws DeviceManagementException { + Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, + DEVICE_TYPE), EnrolmentInfo.Status.ACTIVE); + Assert.assertTrue(device != null); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDevieByDate() throws DeviceManagementException { + List devices = deviceMgtService.getDevices(yesterday()); + Assert.assertTrue(!devices.isEmpty()); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviesOfUserPaginated() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setOwner("admin"); + PaginationResult result = deviceMgtService.getDevicesOfUser(request, true); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviesByOwnership() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setOwnership(EnrolmentInfo.OwnerShip.BYOD.toString()); + PaginationResult result = deviceMgtService.getDevicesByOwnership(request); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviesByStatus() throws DeviceManagementException { + PaginationRequest request = new PaginationRequest(0, 100); + request.setStatus("ACTIVE"); + PaginationResult result = deviceMgtService.getDevicesByStatus(request); + Assert.assertTrue(result.getRecordsTotal() > 0); + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviesOfUserAndDeviceType() throws DeviceManagementException { + List devices = deviceMgtService.getDevicesOfUser("admin", DEVICE_TYPE, true); + Assert.assertTrue(!devices.isEmpty() && devices.get(0).getType().equalsIgnoreCase + (DEVICE_TYPE) && devices.get(0).getDeviceInfo() != null); + } + + @Test + public void testSendRegistrationEmailSuccessFlow() throws ConfigurationManagementException, DeviceManagementException { + String recipient = "test-user@wso2.com"; + Properties props = new Properties(); + props.setProperty("first-name", "Test"); + props.setProperty("username", "User"); + props.setProperty("password", "!@#$$$%"); + + EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props); + + deviceMgtService.sendRegistrationEmail(metaInfo); + Assert.assertTrue(true); + } + @Test - public void testSendRegistrationEmailSuccessFlow() { - try { - String recipient = "test-user@wso2.com"; - Properties props = new Properties(); - props.setProperty("first-name", "Test"); - props.setProperty("username", "User"); - props.setProperty("password", "!@#$$$%"); - - EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props); - - deviceMgtService.sendRegistrationEmail(metaInfo); - Assert.assertTrue(true); - } catch (ConfigurationManagementException e) { - Assert.assertTrue(false, "Error in sending registration email : Configration " + - "related error" + e.getMessage()); - } catch (DeviceManagementException e) { - Assert.assertTrue(false, "Error in sending registration email" + - e.getMessage()); - } + public void testSendEnrollmentInvitation() throws ConfigurationManagementException, + DeviceManagementException { + String recipient = "test-user@wso2.com"; + Properties props = new Properties(); + props.setProperty("first-name", "Test"); + props.setProperty("username", "User"); + props.setProperty("password", "!@#$$$%"); + + EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props); + + deviceMgtService.sendEnrolmentInvitation("template-name", metaInfo); + Assert.assertTrue(true); } private Date yesterday() { @@ -511,6 +476,4 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes cal.add(Calendar.DATE, -1); return cal.getTime(); } - - } \ No newline at end of file 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 a49a023950..38ac1a6e3c 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.142-SNAPSHOT + 3.0.145-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 3e4e544022..9df80bc2b3 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.142-SNAPSHOT + 3.0.145-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 2545f5060e..53e2ea9c9f 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index d4274850f0..2e279f32cd 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.142-SNAPSHOT + 3.0.145-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 8f5bb39f68..0b6d67ddeb 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index fbc05caf90..4851cb18ee 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.142-SNAPSHOT + 3.0.145-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 309dd17fe5..94e2986e62 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 3.0.142-SNAPSHOT + 3.0.145-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 e07eb35b1a..7d93021323 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.142-SNAPSHOT + 3.0.145-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 0cece74011..b93a8d6705 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index ef4df9d920..1a37b1111b 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.142-SNAPSHOT + 3.0.145-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 eefd626421..b3821a1a77 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 3.0.142-SNAPSHOT + 3.0.145-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 fedd631a6d..3d818e3ddf 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 3.0.142-SNAPSHOT + 3.0.145-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 40522cfced..23ce16a1f3 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 3.0.142-SNAPSHOT + 3.0.145-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 ad76418365..71f4042212 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 3.0.142-SNAPSHOT + 3.0.145-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 b6b8338ee8..4853254787 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index 7b6eb4bb24..11e69580e0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -149,8 +149,8 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { deviceIdentifier.getId() + " - " + deviceIdentifier.getType()); } } catch (PolicyEvaluationException e) { - String msg = "Error occurred while getting the effective features from the PEP service " + - deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); + String msg = "Error occurred while getting the effective features from the PEP service " + + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); log.error(msg, e); throw new FeatureManagementException(msg, e); } 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 75e5bb69b8..e21fa59f4b 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,6 +19,7 @@ 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; @@ -39,6 +40,7 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; 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.common.policy.mgt.monitor.ComplianceFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; @@ -51,6 +53,8 @@ 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.policy.mgt.common.FeatureManagementException; +import org.wso2.carbon.policy.mgt.common.PolicyEvaluationException; 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; @@ -58,6 +62,7 @@ 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.services.SimplePolicyEvaluationTest; import org.wso2.carbon.policy.mgt.core.task.MonitoringTask; +import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService; import org.wso2.carbon.policy.mgt.core.util.PolicyManagementConstants; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; @@ -80,12 +85,16 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { private static final String GROUP1 = "group1"; private static final String POLICY1 = "policy1"; private static final String POLICY1_FEATURE1_CODE = "DISALLOW_ADJUST_VOLUME"; + private static final String POLICY1_CAM_FEATURE1_CODE = "DISALLOW_OPEN_CAM"; private static final String ADMIN_USER = "admin"; + 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; private Policy policy1; @@ -303,8 +312,11 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { complianceFeatures.add(complianceFeature); policyManagerService.checkCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); boolean deviceCompliance = policyManagerService.isCompliant(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); - Assert.assertFalse(deviceCompliance, "Policy was compliant even though the response was not compliant"); + List complianceFeatureList = policyManagerService. + checkPolicyCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); + Assert.assertNotNull(complianceFeature); + Assert.assertEquals(POLICY1_FEATURE1_CODE,complianceFeatureList.get(0).getFeatureCode()); } @Test(dependsOnMethods = "inactivatePolicy") @@ -326,9 +338,86 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { } @Test(dependsOnMethods = "updatePolicy") - public void deletePolicy() throws PolicyManagementException { + public void deletePolicyById() throws PolicyManagementException { policyManagerService.deletePolicy(policy1.getId()); Policy tempPolicy = policyManagerService.getPAP().getPolicy(policy1.getId()); Assert.assertNull(tempPolicy, "Policy was not deleted successfully"); } -} + + @Test(dependsOnMethods = "updatePolicy") + public void deletePolicyByPolicy() throws PolicyManagementException { + policyManagerService.deletePolicy(policy1); + Policy tempPolicy = policyManagerService.getPAP().getPolicy(policy1.getId()); + Assert.assertNull(tempPolicy, "Policy was not deleted successfully"); + } + + @Test(dependsOnMethods = "applyPolicy") + public void getEffectiveFeatures( ) throws Exception { + List effectiveFeatures = policyManagerService. + getEffectiveFeatures(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Assert.assertNotNull(effectiveFeatures); + Assert.assertEquals(POLICY1_FEATURE1_CODE,effectiveFeatures.get(0).getFeatureCode()); + try{ + policyManagerService.getEffectiveFeatures(new DeviceIdentifier(DEVICE_2, DEVICE_TYPE_B)); + }catch(FeatureManagementException ex){ + if(ex.getCause() instanceof PolicyEvaluationException){ + Assert.assertTrue(ex.getCause() instanceof PolicyEvaluationException); + }else { + throw ex; + } + } + } + + @Test(dependsOnMethods = "applyPolicy") + public void getDeviceCompliance() throws Exception{ + NonComplianceData deviceCompliance = policyManagerService. + getDeviceCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Assert.assertNotNull(deviceCompliance); + } + + @Test(dependsOnMethods = "applyPolicy") + public void getTaskScheduleService() throws Exception{ + TaskScheduleService taskScheduleService = policyManagerService.getTaskScheduleService(); + Assert.assertNotNull(taskScheduleService); + } + + @Test(dependsOnMethods = "applyPolicy") + public void addProfile() throws Exception{ + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + profile = new Profile(); + profile.setTenantId(tenantId); + profile.setCreatedDate(new Timestamp(System.currentTimeMillis())); + profile.setDeviceType(DEVICE_TYPE_A); + + List profileFeatures = new ArrayList(); + ProfileFeature profileFeature = new ProfileFeature(); + profileFeature.setContent("{'enable':'true'}"); + profileFeature.setDeviceType(DEVICE_TYPE_A); + profileFeature.setFeatureCode(POLICY1_FEATURE1_CODE); + profileFeatures.add(profileFeature); + profile.setProfileFeaturesList(profileFeatures); + profile.setProfileName("tp_profile2"); + profile.setUpdatedDate(new Timestamp(System.currentTimeMillis())); + Profile profile1 = policyManagerService.addProfile(profile); + Assert.assertNotNull(profile1); + Assert.assertEquals("tp_profile2",profile1.getProfileName()); + } + + @Test(dependsOnMethods = "addProfile") + public void updateProfile() throws Exception{ + Policy effectivePolicy = policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Profile currentProfile = effectivePolicy.getProfile(); + List profileFeatures = new ArrayList<>(); + ProfileFeature profileFeature = new ProfileFeature(); + profileFeature.setContent("{'enable':'true'}"); + profileFeature.setDeviceType(DEVICE_TYPE_A); + profileFeature.setFeatureCode(POLICY1_CAM_FEATURE1_CODE); + profileFeatures.add(profileFeature); + profile.setProfileFeaturesList(profileFeatures); + profile.setUpdatedDate(new Timestamp(System.currentTimeMillis())); + Profile updatedProfile = policyManagerService.updateProfile(this.profile); + Assert.assertNotNull(profile); + Assert.assertNotNull(currentProfile.getProfileFeaturesList().get(0).getFeatureCode(), + updatedProfile.getProfileFeaturesList().get(0).getFeatureCode()); + } +} \ 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/services/SimplePolicyEvaluationTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java index 0d22f62e49..97b8ee23b1 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java @@ -27,6 +27,7 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; import org.wso2.carbon.policy.mgt.common.*; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerServiceImpl; +import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import java.util.Collections; import java.util.List; @@ -35,16 +36,15 @@ public class SimplePolicyEvaluationTest implements PolicyEvaluationPoint { private static final Log log = LogFactory.getLog(SimplePolicyEvaluationTest.class); + public static final String DEVICE2 = "device2"; // assuming this device does not have valid policy @Override public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { Policy policy = new Policy(); - List policyList; PolicyAdministratorPoint policyAdministratorPoint; PolicyInformationPoint policyInformationPoint; PolicyManagerService policyManagerService = new PolicyManagerServiceImpl(); - try { if (policyManagerService != null) { @@ -76,7 +76,11 @@ SimplePolicyEvaluationTest implements PolicyEvaluationPoint { @Override public List getEffectiveFeatures(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { - return null; + if(DEVICE2.equals(deviceIdentifier.getId())) { + throw new PolicyEvaluationException(); + }else { + return getEffectivePolicy(deviceIdentifier).getProfile().getProfileFeaturesList(); + } } @Override diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 4d4521a79f..b84a5ae6a2 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 3.0.142-SNAPSHOT + 3.0.145-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 9adaf272a2..cb02da5e89 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 @@ -180,6 +180,9 @@ + + + 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 68ad696a79..91e841e87b 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 3.0.142-SNAPSHOT + 3.0.145-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 b36b0598b3..61f153ff18 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.142-SNAPSHOT + 3.0.145-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 06cc25aafe..515cb622c5 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 3d60cbe690..9bb9c65107 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 2b4187d9b4..45af0e550c 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 3.0.142-SNAPSHOT + 3.0.145-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 b3aca5b333..a28967e835 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 fed6b81353..52683ed0e4 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.142-SNAPSHOT + 3.0.145-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 2de7faf041..cabf1bedfe 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.142-SNAPSHOT + 3.0.145-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 d6c283973f..1ea2000f07 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.142-SNAPSHOT + 3.0.145-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 c224af3557..0162aa7b2c 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 d3f1d63986..e8bef3c938 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.142-SNAPSHOT + 3.0.145-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 8752e58f64..6f69cb3e7e 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 dd58a79be6..9bf90c182e 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 2f67a81dbc..15fed87eeb 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 a53465ddc6..afbb218f47 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 b1102044b1..44bcee1aac 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 3828be8178..02fdec375a 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.142-SNAPSHOT + 3.0.145-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 8e0e1db600..29aeb87ce4 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 4b5489c5a3..4d89a26501 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.142-SNAPSHOT + 3.0.145-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 8331e4fd91..bb58fe4ea7 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 444ff53c53..0dd438d200 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.142-SNAPSHOT + 3.0.145-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 d6fbe32da0..7b2780b2b7 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 d2abf09ebf..661fd66a96 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 4a465ceaeb..52e196bea5 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.142-SNAPSHOT + 3.0.145-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 343114a29c..c2b6e47d57 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 17e648a9a7..ca6357a730 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 3.0.142-SNAPSHOT + 3.0.145-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 b01e4d57ac..e19c3f09d9 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 9e89a33fdd..a8e4065dcc 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 3.0.142-SNAPSHOT + 3.0.145-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 a6368a37f2..55c92cbdd2 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 56085dde33..2f28bc923c 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.142-SNAPSHOT + 3.0.145-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 0a35f2805f..b56adb1dc7 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 7354bf80ae..149795038a 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.142-SNAPSHOT + 3.0.145-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 9cf0f37439..1f5420dbf1 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 3.0.142-SNAPSHOT + 3.0.145-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 1646932203..314a194c44 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.142-SNAPSHOT + 3.0.145-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 0b5533ee52..240fb9a0a6 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1863,7 +1863,7 @@ 1.2.11.wso2v10 - 3.0.142-SNAPSHOT + 3.0.145-SNAPSHOT 4.4.8