From 39d0cf2f95c0a61b3d323692fc31db43555f5515 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Wed, 11 Oct 2017 18:10:08 +0530 Subject: [PATCH] code formatting --- .../publisher/APIPublisherServiceTest.java | 47 +- .../publisher/BaseAPIPublisherTest.java | 136 +--- .../webapp/publisher/DataSourceConfig.java | 76 -- .../apimgt/webapp/publisher/utils/Api.java | 86 +++ .../apimgt/webapp/publisher/utils/Utils.java | 48 -- .../repository/conf/apim-integration.xml | 34 - .../carbon-home/repository/conf/carbon.xml | 656 ------------------ .../config/datasource/data-source-config.xml | 33 - .../resources/config/operation/cdm-config.xml | 96 --- .../config/schema/app-mgt-config-schema.xsd | 31 - .../schema/device-mgt-config-schema.xsd | 48 -- .../src/test/resources/jwt.properties | 57 -- 12 files changed, 133 insertions(+), 1215 deletions(-) delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/DataSourceConfig.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Api.java delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Utils.java delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/apim-integration.xml delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/carbon.xml delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/datasource/data-source-config.xml delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/operation/cdm-config.xml delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/app-mgt-config-schema.xsd delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/device-mgt-config-schema.xsd delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/jwt.properties 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 index e70437eef96..74481ff7120 100644 --- 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 @@ -19,7 +19,6 @@ package org.wso2.carbon.apimgt.webapp.publisher; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; @@ -31,23 +30,28 @@ import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherExce 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); + initialise0OAuthApplication(); } + @Test(description = "Publishes an API | will fail if there are any exceptions") + public void publishAPI() throws NoSuchFieldException, IllegalAccessException, + APIManagerPublisherException { + apiPublisherService.publishAPI(apiConfig); + } - @Test - public void publishAPI() throws APIManagerPublisherException, NoSuchFieldException, IllegalAccessException { - APIPublisherServiceImpl apiPublisherService = new APIPublisherServiceImpl(); - - APIConfig apiConfig = new 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"); @@ -59,19 +63,13 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { apiConfig.setTags(new String[]{"windows", "device_management"}); apiConfig.setTenantDomain("carbon.super"); apiConfig.setSecured(false); - Map apiScopes = new HashMap<>(); Set scopes = new HashSet<>(apiScopes.values()); - - 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"; - - apiConfig.setScopes(scopes); + setAPIUrITemplates(apiConfig); + } - - + private void setAPIUrITemplates(APIConfig apiConfig) { Set uriTemplates = new LinkedHashSet<>(); ApiUriTemplate template = new ApiUriTemplate(); template.setAuthType("Application & Application User"); @@ -85,27 +83,18 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { scope.setDescription("Lock reset on Windows devices"); template.setScope(scope); uriTemplates.add(template); - apiConfig.setUriTemplates(uriTemplates); + } - + private void initialise0OAuthApplication() 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); - - apiPublisherService.publishAPI(apiConfig); } - @BeforeClass - @Override - public void init() throws Exception { - // do nothing - } } 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 index c8cf587722c..a8332c70c59 100644 --- 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 @@ -27,17 +27,13 @@ import org.wso2.carbon.apimgt.integration.client.internal.APIIntegrationClientDa 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.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 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.device.mgt.common.DeviceManagementException; 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.JWTClientConfigurationException; 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; @@ -47,153 +43,79 @@ 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.TenantManager; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.user.core.tenant.JDBCTenantManager; -import javax.sql.DataSource; import java.io.File; -import java.io.IOException; 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 initialise() 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 { - private void initServices() throws DeviceManagementException, RegistryException, IOException, JWTClientConfigurationException, NoSuchFieldException, JWTClientException, IllegalAccessException { - IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.class,Mockito.CALLS_REAL_METHODS); + IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.class, Mockito.CALLS_REAL_METHODS); APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService); - - PublisherClient publisherClient = Mockito.mock(PublisherClient.class,Mockito.CALLS_REAL_METHODS); + PublisherClient publisherClient = Mockito.mock(PublisherClient.class, Mockito.CALLS_REAL_METHODS); doReturn(publisherClient).when(integrationClientService).getPublisherClient(); - APIsApi api = new 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(); - } - }; - + APIsApi api = new Api(); Field field = PublisherClient.class.getDeclaredField("api"); field.setAccessible(true); - field.set(publisherClient,api); + field.set(publisherClient, api); AccessTokenInfo accessTokenInfo = new AccessTokenInfo(); - accessTokenInfo.setTokenType("type"); - String REQUIRED_SCOPE = + 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); + 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); - } + + 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(); -// TenantManager tenantManager = new JDBCTenantManager(dataSource, -// org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - // realmService.setTenantManager(tenantManager); 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(); } - - - private void initializeCarbonContext() throws UserStoreException, 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); - RegistryService registryService = this.getRegistryService(); - OSGiDataHolder.getInstance().setRegistryService(registryService); - JWTClientExtensionDataHolder.getInstance().setRegistryService(registryService); - - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants - .SUPER_TENANT_DOMAIN_NAME); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID); - } - } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/DataSourceConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/DataSourceConfig.java deleted file mode 100644 index f3e31968fe9..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/DataSourceConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014, 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 javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "DataSourceConfig") -public class DataSourceConfig { - - private String url; - private String driverClassName; - private String user; - private String password; - - @Override public String toString() { - return "DataSourceConfig[" + - " Url ='" + url + '\'' + - ", DriverClassName ='" + driverClassName + '\'' + - ", UserName ='" + user + '\'' + - ", Password ='" + password + '\'' + - "]"; - } - - @XmlElement(name = "Url", nillable = false) - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - @XmlElement(name = "DriverClassName", nillable = false) - public String getDriverClassName() { - return driverClassName; - } - - public void setDriverClassName(String driverClassName) { - this.driverClassName = driverClassName; - } - - @XmlElement(name = "User", nillable = false) - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - @XmlElement(name = "Password", nillable = false) - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - -} 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 00000000000..820da060a9d --- /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/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Utils.java deleted file mode 100644 index 21d6a7007a7..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/utils/Utils.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.w3c.dom.Document; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; - -/** - * This class handles the test utility tasks. - */ -public class Utils { - - public static Document convertToDocument(File file) throws DeviceManagementException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - int rwew = 222; - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - return docBuilder.parse(file); - } catch (Exception e) { - throw new DeviceManagementException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document", e); - } - } -} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/apim-integration.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/apim-integration.xml deleted file mode 100644 index 400b7a06b66..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/apim-integration.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register - https://${iot.gateway.host}:${iot.gateway.https.port}/token - https://localhost:9445/api/am/publisher/v0.11 - https://${iot.apimstore.host}:${iot.apimstore.https.port}/api/am/store/v0.11 - - https://localhost:9443/client-registration/v0.11/register - https://localhost:9443/token - https://localhost:9445/api/am/publisher/v0.11 - https://localhost:9445/api/am/store/v0.11 - - admin - admin - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/carbon.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/carbon.xml deleted file mode 100644 index 31752cf9b44..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/carbon.xml +++ /dev/null @@ -1,656 +0,0 @@ - - - - - - - - - ${product.name} - - - ${product.key} - - - ${product.version} - - - - - - - - - local:/${carbon.context}/services/ - - - - - - - ${default.server.role} - - - - - - - org.wso2.carbon - - - / - - - - - - - - - 15 - - - - - - - - - 0 - - - - - 9999 - - 11111 - - - - - - 10389 - - 8000 - - - - - - 10500 - - - - - - - org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory - - - - - - - - - java - - - - - - - - - - false - - - false - - - 600 - - - - false - - - - - - - - 30 - - - - - - - - - 15 - - - - - - ${carbon.home}/repository/deployment/server/ - - - 15 - - - ${carbon.home}/repository/conf/axis2/axis2.xml - - - 30000 - - - ${carbon.home}/repository/deployment/client/ - - ${carbon.home}/repository/conf/axis2/axis2_client.xml - - true - - - - - - - - - - admin - Default Administrator Role - - - user - Default User Role - - - - - - - - - - - - ${carbon.home}/repository/resources/security/wso2carbon.jks - - JKS - - wso2carbon - - wso2carbon - - wso2carbon - - - - - - ${carbon.home}/repository/resources/security/client-truststore.jks - - JKS - - wso2carbon - - - - - - - - - - - - - - - - - - - UserManager - - - false - - - - - - - ${carbon.home}/tmp/work - - - - - - true - - - 10 - - - 30 - - - - - - 100 - - - - keystore - certificate - * - - org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor - - - - - jarZip - - org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor - - - - dbs - - org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor - - - - tools - - org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor - - - - toolsAny - - org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor - - - - - - - info - org.wso2.carbon.core.transports.util.InfoProcessor - - - wsdl - org.wso2.carbon.core.transports.util.Wsdl11Processor - - - wsdl2 - org.wso2.carbon.core.transports.util.Wsdl20Processor - - - xsd - org.wso2.carbon.core.transports.util.XsdProcessor - - - - - - false - false - true - svn - http://svnrepo.example.com/repos/ - username - password - true - - - - - - - - - - - - - - - ${require.carbon.servlet} - - - - - true - - - - - - - default repository - ${p2.repo.url} - - - - - - - - true - - - - - - true - - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/datasource/data-source-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/datasource/data-source-config.xml deleted file mode 100644 index d9be5b3ac0e..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/datasource/data-source-config.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true - org.h2.Driver - wso2carbon - wso2carbon - - - - - - - - - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/operation/cdm-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/operation/cdm-config.xml deleted file mode 100644 index d4e1acb1397..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/operation/cdm-config.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - jdbc/DM_DS - - - - - 2 - 2000 - 2000 - true - - org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider - - org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider - - - - false - - - https://localhost:9443 - admin - admin - - - org.wso2.carbon.policy.mgt - true - 60000 - 5 - 8 - 20 - - - - Simple - - - - 20 - 20 - 20 - 20 - 20 - 20 - - - - true - - - - false - 600 - - 10000 - - - false - 86400 - - - false - false - - BYOD,COPE - - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/app-mgt-config-schema.xsd b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/app-mgt-config-schema.xsd deleted file mode 100644 index b2fc9d553e8..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/app-mgt-config-schema.xsd +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/device-mgt-config-schema.xsd b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/device-mgt-config-schema.xsd deleted file mode 100644 index 420980b4704..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/config/schema/device-mgt-config-schema.xsd +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/jwt.properties b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/jwt.properties deleted file mode 100644 index 0c9641fa2da..00000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/jwt.properties +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -# -# WSO2 Inc. licenses this file to you under the Apache License, -# Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -#issuer of the JWT -iss=wso2.org/products/iot - -TokenEndpoint=https://${iot.gateway.host}:${iot.gateway.https.port}/token?tenantDomain=carbon.super - -#audience of JWT claim -#comma seperated values -aud=devicemgt - -#expiration time of JWT (number of minutes from the current time) -exp=1000 - -#issued at time of JWT (number of minutes from the current time) -iat=0 - -#nbf time of JWT (number of minutes from current time) -nbf=0 - -#skew between IDP and issuer(seconds) -skew=0 - -# JWT Id -#jti=token123 - -#KeyStore to cryptographic credentials -#KeyStore=repository/resources/security/wso2carbon.jks - -#Password of the KeyStore -#KeyStorePassword=wso2carbon - -#Alias of the SP's private key -#PrivateKeyAlias=wso2carbon - -#Private key password to retrieve the private key used to sign -#AuthnRequest and LogoutRequest messages -#PrivateKeyPassword=wso2carbon - -#this will be used as the default IDP config if there isn't any config available for tenants. -default-jwt-client=true