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 2e139f028bf..e678e4927f5 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 @@ -17,7 +17,8 @@ ~ under the License. --> - + apimgt-extensions @@ -108,10 +109,10 @@ 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 @@ -160,25 +161,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; - * + * @@ -210,5 +211,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 index 74481ff7120..cf313fca214 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 @@ -42,7 +42,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { @BeforeTest public void initialConfigs() throws Exception { setApiConfigs(apiConfig); - initialise0OAuthApplication(); + initializeOAuthApplication(); } @Test(description = "Publishes an API | will fail if there are any exceptions") @@ -66,10 +66,10 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { Map apiScopes = new HashMap<>(); Set scopes = new HashSet<>(apiScopes.values()); apiConfig.setScopes(scopes); - setAPIUrITemplates(apiConfig); + setAPIURITemplates(apiConfig); } - private void setAPIUrITemplates(APIConfig apiConfig) { + private void setAPIURITemplates(APIConfig apiConfig) { Set uriTemplates = new LinkedHashSet<>(); ApiUriTemplate template = new ApiUriTemplate(); template.setAuthType("Application & Application User"); @@ -86,7 +86,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { apiConfig.setUriTemplates(uriTemplates); } - private void initialise0OAuthApplication() throws NoSuchFieldException, IllegalAccessException { + private void initializeOAuthApplication() throws NoSuchFieldException, IllegalAccessException { OAuthApplication oAuthApplication = new OAuthApplication(); oAuthApplication.setClientName("admin_api_integration_client"); oAuthApplication.setIsSaasApplication("true"); 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 a8332c70c59..e935b98e2a7 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 @@ -61,7 +61,7 @@ public abstract class BaseAPIPublisherTest { private static final Log log = LogFactory.getLog(BaseAPIPublisherTest.class); @BeforeSuite - public void initialise() throws Exception { + public void initialize() throws Exception { this.initializeCarbonContext(); this.initServices(); } @@ -73,13 +73,16 @@ public abstract class BaseAPIPublisherTest { File carbonHome = new File(resourceUrl.getFile()); System.setProperty("carbon.home", carbonHome.getAbsolutePath()); } - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); + 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 NoSuchFieldException, IllegalAccessException, + JWTClientException, UserStoreException, RegistryException { - 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); doReturn(publisherClient).when(integrationClientService).getPublisherClient(); @@ -95,7 +98,8 @@ public abstract class BaseAPIPublisherTest { "apim:subscription_view apim:subscription_block"; accessTokenInfo.setScopes(REQUIRED_SCOPE); - JWTClientManagerService jwtClientManagerService = Mockito.mock(JWTClientManagerServiceImpl.class, Mockito.CALLS_REAL_METHODS); + 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()); @@ -112,10 +116,10 @@ public abstract class BaseAPIPublisherTest { APIPublisherDataHolder.getInstance().setRealmService(realmService); RegistryDataHolder.getInstance().setRealmService(realmService); JWTClientExtensionDataHolder.getInstance().setRealmService(realmService); - InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml"); + 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/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/jwt.properties b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/jwt.properties deleted file mode 100644 index 0c9641fa2da..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/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 diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/jwt-config/jwt.properties b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/jwt-config/jwt.properties deleted file mode 100644 index 0c9641fa2da..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/jwt-config/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