aboutsummaryrefslogtreecommitdiffstats
path: root/blueprints-processor/adaptors/rest-adaptor-provider
diff options
context:
space:
mode:
Diffstat (limited to 'blueprints-processor/adaptors/rest-adaptor-provider')
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/pom.xml146
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorConstants.java1
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorException.java50
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/data/RestResponse.java76
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java274
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorService.java92
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java164
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestClientServiceAdapter.java38
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientAdapterImpl.java139
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java130
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java56
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/LoggingRequestInterceptor.java71
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml32
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/blueprints-processor-adaptor.properties35
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml32
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapterTest.java56
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientServiceTest.java118
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/SSLClientServiceTest.java118
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/utils/RestTemplateFactoryTest.java49
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/blueprints-processor-adaptor.properties45
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/keystore.client.p12bin1456 -> 0 bytes
-rw-r--r--blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/truststore.client.jksbin1228 -> 0 bytes
22 files changed, 0 insertions, 1722 deletions
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/pom.xml b/blueprints-processor/adaptors/rest-adaptor-provider/pom.xml
deleted file mode 100644
index 8c0cf0856..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.2-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features</groupId>
- <artifactId>blueprints-rest-adaptor-provider</artifactId>
- <version>0.7.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>ccsdk-features :: blueprints-processor-adaptor :: ${project.artifactId}</name>
- <url>http://maven.apache.org</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.6.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.21.0-GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>1.6.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-support</artifactId>
- <version>1.6.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-reflect</artifactId>
- <version>1.6.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-core</artifactId>
- <version>1.6.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <additionalparam>-Xdoclint:none</additionalparam>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>org.onap.ccsdk.features.rest.adaptor,
- org.onap.ccsdk.features.rest.adaptor.data,
- org.onap.ccsdk.features.rest.adaptor.service,
- org.onap.ccsdk.features.rest.adaptor.utils
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorConstants.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorConstants.java
deleted file mode 100644
index adb00a305..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorConstants.java
+++ /dev/null
@@ -1 +0,0 @@
-/* * Copyright © 2017-2018 AT&T Intellectual Property. * Modifications Copyright © 2018 IBM. * * Licensed 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.onap.ccsdk.features.rest.adaptor; public class ConfigRestAdaptorConstants { private ConfigRestAdaptorConstants() { } public static final String SDNC_ROOT_DIR_ENV_VAR_KEY = "SDNC_CONFIG_DIR"; public static final String REST_ADAPTOR_PROPERTIES_FILE_NAME = "blueprints-processor-adaptor.properties"; public static final String PROXY_URL_KEY = "proxyUrl"; public static final String PROXY_URLS_VALUE_SEPARATOR = ","; public static final String AAF_USERNAME_KEY = "aafUserName"; public static final String AAF_PSSWD_KEY = "aafPassword"; public static final String COMMON_SERVICE_VERSION_KEY = "commonServiceVersion"; public static final String PROPERTY_ENV_PROD = "field"; public static final String PROPERTY_ENV_SOLO = "solo"; public static final String REST_ADAPTOR_BASE_PROPERTY = "org.onap.ccsdk.features.blueprints.adaptors."; public static final String REST_ADAPTOR_ENV_TYPE = "envtype"; public static final String REST_ADAPTOR_TYPE_GENERIC = "generic"; public static final String REST_ADAPTOR_TYPE_SSL = "ssl"; public static final String SSL_SERVICE_BASEURL = ".url"; public static final String SSL_SERVICE_APP = ".application"; public static final String SSL_SERVICE_TRUST = ".ssl.trust"; public static final String SSL_SERVICE_TRUST_PSSWD = ".ssl.trust.psswd"; public static final String SSL_SERVICE_KEY = ".ssl.key"; public static final String SSL_SERVICE_KEY_PSSWD = ".ssl.key.psswd"; public static final String SERVICE_TYPE_PROPERTY = ".type"; public static final String SERVICE_EANABLED_PROPERTY = ".enable"; public static final String SERVICE_ENV_PROPERTY = ".env"; public static final String SERVICE_BASEURL_PROPERTY = ".url"; public static final String SERVICE_PROPERTYFILE = ".propertyfile"; public static final String SERVICE_USER_PROPERTY = ".user"; public static final String SERVICE_APPID_PROPERTY = ".appId"; public static final String SERVICE_PSSWD_PROPERTY = ".passwd"; public static final String SERVICE_CLIENTAUTH_PROPERTY = ".clientAuth"; public static final String SERVICE_AUTHORIZATION_PROPERTY = ".authorization"; public static final String SELECTOR_AAI = "aai"; public static final String SELECTOR_ALTS = "alts"; public static final String SELECTOR_EIPAM = "eipam"; public static final String SELECTOR_COSMS = "cosms"; public static final String SELECTOR_RESTCONF = "restconf"; public static final String SELECTOR_MODEL_SERVICE = "modelservice"; public static final String SELECTOR_POLICY_MANAGER = "policymanager"; public static final String SELECTOR_NRD = "networkresourcediscovery"; public static final String SELECTOR_NSM = "nsm"; } \ No newline at end of file
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorException.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorException.java
deleted file mode 100644
index 163c30423..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/ConfigRestAdaptorException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor;
-
-/**
- * ConfigRestAdaptorException.java Purpose: Provide Configuration Rest Adaptor Exception
- *
- * @version 1.0
- */
-public class ConfigRestAdaptorException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This is a ConfigRestAdaptorException constructor
- *
- * @param message
- */
- public ConfigRestAdaptorException(String message) {
- super(message);
- }
-
- /**
- * This is a ConfigRestAdaptorException constructor
- *
- * @param message
- */
- public ConfigRestAdaptorException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/data/RestResponse.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/data/RestResponse.java
deleted file mode 100644
index f1a3c7290..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/data/RestResponse.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.data;
-
-import java.util.Map;
-
-public class RestResponse {
-
- private String statusCode;
- private String body;
- private Map<String, String> parameters;
- private Map<String, String> responseHeaders;
- private Map<String, String> requestHeaders;
-
- public String getStatusCode() {
- return statusCode;
- }
-
- public void setStatusCode(String statusCode) {
- this.statusCode = statusCode;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public Map<String, String> getParameters() {
- return parameters;
- }
-
- public void setParameters(Map<String, String> parameters) {
- this.parameters = parameters;
- }
-
- public Map<String, String> getResponseHeaders() {
- return responseHeaders;
- }
-
- public void setResponseHeaders(Map<String, String> responseHeaders) {
- this.responseHeaders = responseHeaders;
- }
-
- public Map<String, String> getRequestHeaders() {
- return requestHeaders;
- }
-
- public void setRequestHeaders(Map<String, String> requestHeaders) {
- this.requestHeaders = requestHeaders;
- }
-
- @Override
- public String toString() {
- return "RestResponse [statusCode=" + statusCode + ", body=" + body + ", parameters=" + parameters
- + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + requestHeaders + "]";
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java
deleted file mode 100644
index 6cc4bdabf..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.net.ssl.SSLContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.conn.ssl.NoopHostnameVerifier;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.ssl.SSLContextBuilder;
-import org.apache.http.ssl.TrustStrategy;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-import org.onap.ccsdk.features.rest.adaptor.utils.BasicAuthorizationInterceptor;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.http.converter.ByteArrayHttpMessageConverter;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.ResourceHttpMessageConverter;
-import org.springframework.http.converter.StringHttpMessageConverter;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.http.converter.xml.SourceHttpMessageConverter;
-import org.springframework.util.ResourceUtils;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.RestTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServiceAdapter {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(AbstractConfigRestClientAdapter.class);
- private static final String MS_INIT_FAIL = "Failed to initialise microservice client restTemplate.";
-
- protected boolean isRestClientServiceAdapaterEnabled = false;
- protected boolean isSSLServiceAdapaterEnabled = true;
-
- protected Map<String, String> properties = new ConcurrentHashMap<>();
- protected String serviceSelector;
-
- protected RestTemplate restTemplate;
-
- protected AbstractConfigRestClientAdapter(Map<String, String> properties, String serviceSelector) {
- this.properties = properties;
- this.serviceSelector = serviceSelector;
- setRestClientServiceAdapaterEnabled();
- }
-
- private void setRestClientServiceAdapaterEnabled() {
- String isEnabledProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_EANABLED_PROPERTY;
- String isRestClientServiceAdapaterEnabledStr = properties.get(isEnabledProperty);
- logger.info("Service selector ({}) enable status ({}) ", serviceSelector,
- isRestClientServiceAdapaterEnabledStr);
- if (StringUtils.isNotBlank(isRestClientServiceAdapaterEnabledStr)
- && Boolean.parseBoolean(isRestClientServiceAdapaterEnabledStr)) {
- isRestClientServiceAdapaterEnabled = true;
- }
- }
-
- private List<HttpMessageConverter<?>> getMessageConverters() {
- List<HttpMessageConverter<?>> converters = new ArrayList<>();
- converters.add(new ByteArrayHttpMessageConverter());
- converters.add(new StringHttpMessageConverter());
- converters.add(new ResourceHttpMessageConverter());
- converters.add(new SourceHttpMessageConverter());
- converters.add(new MappingJackson2HttpMessageConverter());
- return converters;
- }
-
- public void initialise(String user, String pass) {
- logger.trace("Config rest template factory user ({}) ", user);
-
- CloseableHttpClient httpClient =
- HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
- HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
- requestFactory.setHttpClient(httpClient);
-
- restTemplate = new RestTemplate(getMessageConverters());
- restTemplate.setRequestFactory(requestFactory);
- if (StringUtils.isNotBlank(user) && StringUtils.isNotBlank(pass)) {
- restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor(user, pass));
- }
- }
-
- public void initialiseSSL(String keyStorePath, String trustStorePath, String keyPass, String trustPass)
- throws ConfigRestAdaptorException {
- logger.trace("SSL rest template factory");
-
- TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
- SSLContext sslContext = null;
-
- try (InputStream keyInput = new FileInputStream(keyStorePath)) {
- KeyStore keyStore = KeyStore.getInstance("PKCS12");
- keyStore.load(keyInput, keyPass.toCharArray());
-
- logger.info("key loaded successfully");
- sslContext = SSLContextBuilder.create().loadKeyMaterial(keyStore, keyPass.toCharArray()).loadTrustMaterial(
- ResourceUtils.getFile(trustStorePath), trustPass.toCharArray(), acceptingTrustStrategy).build();
- } catch (Exception e) {
- throw new ConfigRestAdaptorException(e.getMessage());
- }
-
- SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
- CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
- HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
-
- restTemplate = new RestTemplate(getMessageConverters());
- restTemplate.setRequestFactory(requestFactory);
- }
-
- public <T> T getResource(HttpHeaders headers, String url, Class<T> responseType) throws ConfigRestAdaptorException {
- ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.GET, null, responseType);
- return processResponse(response, url, HttpMethod.GET);
- }
-
- public <T> T postResource(HttpHeaders headers, String url, Object request, Class<T> responseType)
- throws ConfigRestAdaptorException {
- ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.POST, request, responseType);
- return processResponse(response, url, HttpMethod.POST);
- }
-
- public <T> T exchangeResource(HttpHeaders headers, String url, Object request, Class<T> responseType, String method)
- throws ConfigRestAdaptorException {
- ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.valueOf(method), request, responseType);
- return processResponse(response, url, HttpMethod.valueOf(method));
- }
-
- public RestResponse getResource(HttpHeaders headers, String url) throws ConfigRestAdaptorException {
- return exchangeForEntity(headers, url, HttpMethod.GET, null);
- }
-
- public RestResponse postResource(HttpHeaders headers, String url, Object request)
- throws ConfigRestAdaptorException {
- return exchangeForEntity(headers, url, HttpMethod.POST, request);
- }
-
- public RestResponse exchangeResource(HttpHeaders headers, String url, Object request, String method)
- throws ConfigRestAdaptorException {
- return exchangeForEntity(headers, url, HttpMethod.valueOf(method), request);
- }
-
- private RestResponse exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request)
- throws ConfigRestAdaptorException {
- RestResponse restResponse = new RestResponse();
- restResponse.setRequestHeaders(headers.toSingleValueMap());
- ResponseEntity<String> response = null;
-
- try {
- if (restTemplate == null) {
- logger.error(MS_INIT_FAIL);
- } else {
- logger.debug("Rest Operation: {}", httpMethod);
- logger.debug("url : ({})", url);
- logger.debug("headers: ({})", headers);
- logger.debug("request: ({})", request);
-
- if (HttpMethod.GET == httpMethod) {
- HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
- response = restTemplate.exchange(url, httpMethod, entity, String.class);
- } else {
- HttpEntity<?> entity = new HttpEntity<>(request, headers);
- response = restTemplate.exchange(url, httpMethod, entity, String.class);
- }
- logger.debug("response: ({})", response);
-
- if (response != null) {
- logger.debug("response status code: ({})", response.getStatusCode());
- restResponse.setBody(response.getBody());
- restResponse.setStatusCode(response.getStatusCode().toString());
- restResponse.setResponseHeaders(
- response.getHeaders() != null ? response.getHeaders().toSingleValueMap() : null);
- return restResponse;
- }
- throw new ConfigRestAdaptorException("Rest exchangeForEntity failed to perform ");
- }
- } catch (HttpClientErrorException clientError) {
- logger.debug("clientError: ({})", clientError);
- restResponse.setBody(StringUtils.isBlank(clientError.getResponseBodyAsString()) ? clientError.getMessage()
- : clientError.getResponseBodyAsString());
- restResponse.setStatusCode(clientError.getStatusCode().toString());
- } catch (Exception e) {
- throw new ConfigRestAdaptorException(
- String.format("httpMethod (%s) for url (%s) resulted in Exception (%s)", httpMethod, url, e));
- }
- return restResponse;
- }
-
- private <T> ResponseEntity<T> exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod,
- Object request, Class<T> responseType) throws ConfigRestAdaptorException {
- ResponseEntity<T> response = null;
-
- try {
- if (restTemplate == null) {
- logger.error(MS_INIT_FAIL);
- } else {
- logger.debug("Rest Operation: {}", httpMethod);
- logger.debug("url : ({})", url);
- logger.debug("headers: ({})", headers);
- logger.debug("request: ({})", request);
-
- if (HttpMethod.GET == httpMethod) {
- HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
- response = restTemplate.exchange(url, httpMethod, entity, responseType);
- } else {
- HttpEntity<?> entity = new HttpEntity<>(request, headers);
- response = restTemplate.exchange(url, httpMethod, entity, responseType);
- }
- logger.debug("response: ({})", response);
-
- if (response != null) {
- logger.debug("response status code: ({})", response.getStatusCode());
- } else {
- throw new ConfigRestAdaptorException("exchangeForEntity failed to perform ");
- }
- }
- } catch (Exception e) {
- throw new ConfigRestAdaptorException(
- String.format("httpMethod (%s) for url (%s) resulted in Exception (%s)", httpMethod, url, e));
- }
- return response;
- }
-
- protected synchronized <T> T processResponse(ResponseEntity<T> response, String url, HttpMethod httpMethod)
- throws ConfigRestAdaptorException {
- if (response != null) {
- if ((HttpMethod.DELETE == httpMethod && (response.getStatusCode() == HttpStatus.NO_CONTENT
- || response.getStatusCode() == HttpStatus.NOT_FOUND))
- || ((HttpMethod.GET == httpMethod || HttpMethod.PUT == httpMethod || HttpMethod.POST == httpMethod)
- && (response.getStatusCode() == HttpStatus.OK
- || response.getStatusCode() == HttpStatus.CREATED))) {
- return response.getBody();
- }
- throw new ConfigRestAdaptorException(
- String.format("Rest Operation is failed with response-code (%s) for the URL (%s)",
- response.getStatusCode(), url));
- }
- throw new ConfigRestAdaptorException(String.format("Rest Operation is failed for the URL (%s)", url));
- }
-
- protected synchronized String constructUrl(String baseUrl, String path) {
- if (StringUtils.isNotBlank(path)) {
- return baseUrl + path;
- } else {
- return baseUrl;
- }
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorService.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorService.java
deleted file mode 100644
index 12e734ad3..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorService.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-
-public interface ConfigRestAdaptorService {
-
- /**
- * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in
- * defined responseType.
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- * @param responseType the type of the return value
- */
- public <T> T getResource(String selectorName, String path, Class<T> responseType) throws ConfigRestAdaptorException;
-
- /**
- * Create a new resource by POSTing the given object to the URI template, and returns the response
- * as defined responseType
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- * @param request the Object to be POSTed, may be {@code null}
- * @param responseType the type of the return value
- */
- public <T> T postResource(String selectorName, String path, Object request, Class<T> responseType)
- throws ConfigRestAdaptorException;
-
- /**
- * Execute the HTTP method to the given URI template, writing the given request entity to the
- * request, and returns the response as defined responseType
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- * @param request the Object to be POSTed, may be {@code null}
- * @param responseType the type of the return value
- * @param method the HTTP method (GET, POST, etc)
- */
- public <T> T exchangeResource(String selectorName, String path, Object request, Class<T> responseType,
- String method) throws ConfigRestAdaptorException;
-
- /**
- * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in
- * defined responseType.
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- */
- public RestResponse getResource(String selectorName, String path) throws ConfigRestAdaptorException;
-
- /**
- * Create a new resource by POSTing the given object to the URI template, and returns the response
- * as defined responseType
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- * @param request the Object to be POSTed, may be {@code null}
- */
- public RestResponse postResource(String selectorName, String path, Object request)
- throws ConfigRestAdaptorException;
-
- /**
- * Execute the HTTP method to the given URI template, writing the given request entity to the
- * request, and returns the response as defined responseType
- *
- * @param selectorName the property selector
- * @param path the URI path which will append in baseURL mentioned in selector property
- * @param request the Object to be POSTed, may be {@code null}
- * @param method the HTTP method (GET, POST, etc)
- */
- public RestResponse exchangeResource(String selectorName, String path, Object request, String method)
- throws ConfigRestAdaptorException;
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java
deleted file mode 100644
index 0646e1f09..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-
-public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigRestAdaptorServiceImpl.class);
- private Map<String, String> restProperties = new ConcurrentHashMap<>();
-
- public ConfigRestAdaptorServiceImpl() {
- this(null);
- }
-
- public ConfigRestAdaptorServiceImpl(final String propertyFilePath) {
- loadProps(propertyFilePath);
- try {
- String envType = restProperties.get(ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY
- + ConfigRestAdaptorConstants.REST_ADAPTOR_ENV_TYPE);
-
- if (!(ConfigRestAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType)
- || ConfigRestAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) {
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
- Runnable task = () -> loadProps(propertyFilePath);
- executor.scheduleWithFixedDelay(task, 60, 15, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
-
-
- // propertyFilePath is only specified in test case.
- private void loadProps(final String propertyFilePath) {
- Properties properties = new Properties();
- if (propertyFilePath != null) {
- // Loading Default properties
- String propertyFile =
- propertyFilePath + File.separator + ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME;
- doLoadFromPath(propertyFile, properties);
- } else {
- // Try to load config from dir
- final String ccsdkConfigDir =
- System.getProperty(ConfigRestAdaptorConstants.SDNC_ROOT_DIR_ENV_VAR_KEY) + File.separator
- + ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME;
- try (FileInputStream in = new FileInputStream(ccsdkConfigDir)) {
- properties.load(in);
- logger.info("Loaded {} properties from file {}", properties.size(), ccsdkConfigDir);
- } catch (Exception e) {
- // Try to load config from jar
- final Bundle bundle = FrameworkUtil.getBundle(ConfigRestAdaptorServiceImpl.class);
- final BundleContext ctx = bundle.getBundleContext();
- final URL url = ctx.getBundle()
- .getResource(ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME);
- doLoadFromPath(url.getPath(), properties);
- }
- }
- restProperties.putAll(properties.entrySet().stream()
- .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString())));
- }
-
- private void doLoadFromPath(final String propertyFile, final Properties properties) {
- try (FileInputStream in = new FileInputStream(propertyFile)) {
- properties.load(in);
- logger.info("Loaded {} properties from file {}", properties.size(), propertyFile);
- } catch (Exception e) {
- logger.error("Failed to load properties for file: {} "
- + ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME, e);
- }
- }
-
- @Override
- public <T> T getResource(String serviceSelector, String path, Class<T> responseType)
- throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).getResource(path, responseType);
- }
-
- @Override
- public <T> T postResource(String serviceSelector, String path, Object request, Class<T> responseType)
- throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).postResource(path, request, responseType);
- }
-
- @Override
- public <T> T exchangeResource(String serviceSelector, String path, Object request, Class<T> responseType,
- String method) throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).exchangeResource(path, request, responseType,
- method);
- }
-
- @Override
- public RestResponse getResource(String serviceSelector, String path) throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).getResource(path);
- }
-
- @Override
- public RestResponse postResource(String serviceSelector, String path, Object request)
- throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).postResource(path, request);
- }
-
- @Override
- public RestResponse exchangeResource(String serviceSelector, String path, Object request, String method)
- throws ConfigRestAdaptorException {
- return getRestClientAdapterBySelectorName(serviceSelector).exchangeResource(path, request, method);
- }
-
- private ConfigRestClientServiceAdapter getRestClientAdapterBySelectorName(String serviceSelector)
- throws ConfigRestAdaptorException {
- String adoptorType = restProperties.get(ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_TYPE_PROPERTY);
- if (StringUtils.isNotBlank(adoptorType)) {
- if (ConfigRestAdaptorConstants.REST_ADAPTOR_TYPE_GENERIC.equalsIgnoreCase(adoptorType)) {
- return new GenericRestClientAdapterImpl(restProperties, serviceSelector);
- } else if (ConfigRestAdaptorConstants.REST_ADAPTOR_TYPE_SSL.equalsIgnoreCase(adoptorType)) {
- return new SSLRestClientAdapterImpl(restProperties, serviceSelector);
- } else {
- throw new ConfigRestAdaptorException(
- String.format("no implementation for rest adoptor type (%s) for the selector (%s).",
- adoptorType, serviceSelector));
- }
- } else {
- throw new ConfigRestAdaptorException(
- String.format("couldn't get rest adoptor type for the selector (%s)", serviceSelector));
- }
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestClientServiceAdapter.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestClientServiceAdapter.java
deleted file mode 100644
index 7ebc0ef48..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestClientServiceAdapter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-
-interface ConfigRestClientServiceAdapter {
-
- public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException;
-
- public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException;
-
- public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)
- throws ConfigRestAdaptorException;
-
- public RestResponse getResource(String path) throws ConfigRestAdaptorException;
-
- public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException;
-
- public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException;
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientAdapterImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientAdapterImpl.java
deleted file mode 100644
index 6f9840a0b..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientAdapterImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import java.util.Map;
-import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapter {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(GenericRestClientAdapterImpl.class);
- private String baseUrl = "";
-
- public GenericRestClientAdapterImpl(Map<String, String> properties, String serviceSelector)
- throws ConfigRestAdaptorException {
- super(properties, serviceSelector);
- init(serviceSelector);
- }
-
- private void init(String serviceSelector) throws ConfigRestAdaptorException {
- try {
- if (isRestClientServiceAdapaterEnabled) {
- String baseUrlProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_BASEURL_PROPERTY;
- String userProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_USER_PROPERTY;
- String passProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_PSSWD_PROPERTY;
-
- baseUrl = properties.get(baseUrlProperty);
- String userId = properties.get(userProperty);
- String pass = properties.get(passProperty);
-
- initialise(userId, pass);
- logger.info("Initialised restconf adaptor service for selector ({})", serviceSelector);
- if (restTemplate == null) {
- throw new ConfigRestAdaptorException("couldn't initialise rest selector (" + serviceSelector + ")");
- }
- } else {
- throw new ConfigRestAdaptorException("rest selector (" + serviceSelector + ") is not enabled");
- }
-
- } catch (Exception e) {
- throw new ConfigRestAdaptorException("GenericRestClientServiceAdapter : " + e.getMessage(), e);
- }
- }
-
- @Override
- public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException {
- return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType);
- }
-
- @Override
- public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException {
- return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType);
- }
-
- @Override
- public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)
- throws ConfigRestAdaptorException {
- return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType, method);
- }
-
- @Override
- public RestResponse getResource(String path) throws ConfigRestAdaptorException {
- return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path));
- }
-
- @Override
- public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException {
- return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request);
- }
-
- @Override
- public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException {
- return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, method);
- }
-
- private HttpHeaders formHttpHeaders() {
-
- HttpHeaders headers = new HttpHeaders();
-
- headers.setContentType(MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
- headers.add("X-TransactionId", generateUUID());
- headers.add("X-ECOMP-RequestID", headers.getFirst("X-TransactionId"));
-
- String appIDPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_APPID_PROPERTY;
- String environmentPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_ENV_PROPERTY;
- String clientAuthPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_CLIENTAUTH_PROPERTY;
- String authorizationPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SERVICE_AUTHORIZATION_PROPERTY;
-
- if (StringUtils.isNotBlank(properties.get(appIDPath))) {
- headers.add("X-FromAppId", properties.get(appIDPath));
- }
- if (StringUtils.isNotBlank(properties.get(clientAuthPath))) {
- headers.add("ClientAuth", properties.get(clientAuthPath));
- }
- if (StringUtils.isNotBlank(properties.get(authorizationPath))) {
- headers.add("Authorization", properties.get(authorizationPath));
- }
- if (StringUtils.isNotBlank(properties.get(environmentPath))) {
- headers.add("Environment", properties.get(environmentPath));
- }
-
- return headers;
- }
-
- private synchronized String generateUUID() {
- return UUID.randomUUID().toString();
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java
deleted file mode 100644
index f7ec439d5..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import java.util.Map;
-import java.util.UUID;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(SSLRestClientAdapterImpl.class);
- private String baseUrl = "";
- private String application = "";
-
- public SSLRestClientAdapterImpl(Map<String, String> properties, String serviceSelector)
- throws ConfigRestAdaptorException {
- super(properties, serviceSelector);
- init(serviceSelector);
- }
-
- private void init(String serviceSelector) throws ConfigRestAdaptorException {
- try {
- if (isSSLServiceAdapaterEnabled) {
-
- logger.info("Initializing SSL client for selector ({}), properties ({})", serviceSelector, properties);
-
- String baseUrlProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_BASEURL;
- String applicationProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_APP;
- String keyStorePathProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_KEY;
- String keyStorePassProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_KEY_PSSWD;
- String trustStorePathProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_TRUST;
- String trustStorePassProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector
- + ConfigRestAdaptorConstants.SSL_SERVICE_TRUST_PSSWD;
-
- baseUrl = properties.get(baseUrlProp);
- application = properties.get(applicationProp);
-
- String keyStorePath = properties.get(keyStorePathProp);
- String trustStorePath = properties.get(trustStorePathProp);
- String keyStorePass = properties.get(keyStorePassProp);
- String trustStorePass = properties.get(trustStorePassProp);
-
- initialiseSSL(keyStorePath, trustStorePath, keyStorePass, trustStorePass);
- logger.info("Initialised SSL Client Service adaptor service for selector ({})", serviceSelector);
- if (restTemplate == null) {
- throw new ConfigRestAdaptorException(
- "couldn't initialise SSL Client selector (" + serviceSelector + ")");
- }
- } else {
- throw new ConfigRestAdaptorException("SSL Client selector (" + serviceSelector + ") is not enabled");
- }
-
- } catch (Exception e) {
- throw new ConfigRestAdaptorException("SSLRestClientAdapterImpl : " + e.getMessage(), e);
- }
- }
-
- @Override
- public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException {
- return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType);
- }
-
- @Override
- public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException {
- return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType);
- }
-
- @Override
- public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)
- throws ConfigRestAdaptorException {
- return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType, method);
- }
-
- @Override
- public RestResponse getResource(String path) throws ConfigRestAdaptorException {
- return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path));
- }
-
- @Override
- public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException {
- return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request);
- }
-
- @Override
- public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException {
- return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, method);
- }
-
- private HttpHeaders formHttpHeaders() {
-
- HttpHeaders headers = new HttpHeaders();
-
- headers.setContentType(MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
- headers.add("X-FromAppId", application);
- headers.add("X-TransactionId", generateUUID());
-
- return headers;
- }
-
- private synchronized String generateUUID() {
- return UUID.randomUUID().toString();
- }
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java
deleted file mode 100644
index c3e2288d1..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.utils;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Base64;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-import org.springframework.util.Assert;
-
-public class BasicAuthorizationInterceptor implements ClientHttpRequestInterceptor {
- private static final Charset UTF_8 = Charset.forName("UTF-8");
-
- private final String username;
-
- private final String pass;
-
- /**
- * Create a new interceptor which adds a BASIC authorization header for the given username and pass.
- *
- * @param username the username to use
- * @param pass the password to use
- */
- public BasicAuthorizationInterceptor(String username, String pass) {
- Assert.hasLength(username, "Username must not be empty");
- this.username = username;
- this.pass = (pass != null ? pass : "");
- }
-
- @Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
- throws IOException {
-
- String token = Base64.getEncoder().encodeToString((this.username + ":" + this.pass).getBytes(UTF_8));
- request.getHeaders().add("Authorization", "Basic " + token);
- return execution.execute(request, body);
- }
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/LoggingRequestInterceptor.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/LoggingRequestInterceptor.java
deleted file mode 100644
index cb618d05a..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/LoggingRequestInterceptor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.utils;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(LoggingRequestInterceptor.class);
-
- @Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
- throws IOException {
- traceRequest(request, body);
- ClientHttpResponse response = execution.execute(request, body);
- traceResponse(response);
- return response;
- }
-
- @SuppressWarnings({"squid:S2629", "squid:S3457"})
- private void traceRequest(HttpRequest request, byte[] body) throws IOException {
- logger.info("===========================request begin================================================");
- logger.info("URI : {}", request.getURI());
- logger.info("Method : {}", request.getMethod());
- logger.info("Headers : {}", request.getHeaders());
- logger.info("Request body: {}", new String(body, "UTF-8"));
- logger.debug("==========================request end================================================");
- }
-
- @SuppressWarnings({"squid:S2629", "squid:S3457"})
- private void traceResponse(ClientHttpResponse response) throws IOException {
- StringBuilder inputStringBuilder = new StringBuilder();
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), "UTF-8"));
- String line = bufferedReader.readLine();
- while (line != null) {
- inputStringBuilder.append(line);
- inputStringBuilder.append('\n');
- line = bufferedReader.readLine();
- }
- logger.info("============================response begin==========================================");
- logger.info("Status code : {}", response.getStatusCode());
- logger.info("Status text : {}", response.getStatusText());
- logger.info("Headers : {}", response.getHeaders());
- logger.debug("Response body: {}", inputStringBuilder.toString());
- logger.debug("=======================response end=================================================");
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
deleted file mode 100644
index 8788f6482..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configRestAdaptorService"
- class="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorServiceImpl">
- </bean>
-
- <service ref="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
-</blueprint>
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/blueprints-processor-adaptor.properties b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/blueprints-processor-adaptor.properties
deleted file mode 100644
index a3dcf674d..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/blueprints-processor-adaptor.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-###
-# Copyright � 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright � 2018 IBM.
-#
-# Licensed 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.
-###
-#
-# Configuration file for SDNC Controller Module
-#
-
-org.onap.ccsdk.features.blueprints.adaptors.envtype=solo
-
-# Config Generator Microservices
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.type=generic
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.enable=true
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.url=http://controller-blueprints:8080/api/v1/
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.user=ccsdkapps
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.passwd=ccsdkapps
-
-# Generic RESTCONF Adaptor
-org.onap.ccsdk.features.blueprints.adaptors.restconf.type=generic
-org.onap.ccsdk.features.blueprints.adaptors.restconf.enable=true
-org.onap.ccsdk.features.blueprints.adaptors.restconf.user=admin
-org.onap.ccsdk.features.blueprints.adaptors.restconf.passwd=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
-org.onap.ccsdk.features.blueprints.adaptors.restconf.url=http://sdnc:8282/restconf/
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
deleted file mode 100644
index 8788f6482..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configRestAdaptorService"
- class="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorServiceImpl">
- </bean>
-
- <service ref="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
-</blueprint>
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapterTest.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapterTest.java
deleted file mode 100644
index b6891a059..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapterTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.stream.Collectors;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AbstractConfigRestClientAdapterTest {
-
- Map<String, String> properties = new HashMap<>();
-
- @Before
- public void setup() throws Exception {
- String propertyfile = "src/test/resources/blueprints-processor-adaptor.properties";
-
- Properties restProperties = new Properties();
- restProperties.load(new FileInputStream(propertyfile));
-
- properties.putAll(restProperties.entrySet().stream()
- .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString())));
- }
-
- @Test
- public void testInitGenericRestClient() throws Exception {
- ConfigRestClientServiceAdapter genericRestClient = new GenericRestClientAdapterImpl(properties, "modelservice");
- Assert.assertNotNull(genericRestClient);
- }
-
- @Test
- public void testInitSSLClient() throws Exception {
- ConfigRestClientServiceAdapter sslClient = new SSLRestClientAdapterImpl(properties, "aai");
- Assert.assertNotNull(sslClient);
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientServiceTest.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientServiceTest.java
deleted file mode 100644
index 36599cc6f..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/GenericRestClientServiceTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
-import static org.powermock.api.mockito.PowerMockito.whenNew;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-@SuppressWarnings("unchecked")
-@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("javax.net.ssl.*")
-@PrepareForTest({AbstractConfigRestClientAdapter.class})
-public class GenericRestClientServiceTest {
-
- ConfigRestAdaptorService configRestAdaptorService;
-
- RestTemplate mockRestTemplate = mock(RestTemplate.class);
-
- String path = "path";
-
- @Before
- public void before() throws Exception {
- whenNew(RestTemplate.class).withAnyArguments().thenReturn(mockRestTemplate);
-
- String propertyDir = "src/test/resources";
- configRestAdaptorService = new ConfigRestAdaptorServiceImpl(propertyDir);
- }
-
- @Test
- public void testGetResource() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.getResource("modelservice", path, String.class);
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test
- public void testPostResource() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.POST), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.postResource("modelservice", path, null, String.class);
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test
- public void testExchange() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.exchangeResource("modelservice", path, null, String.class, "GET");
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testGetResourceError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.getForEntity(Matchers.endsWith(path), Matchers.any())).thenReturn(response);
-
- configRestAdaptorService.getResource("modelservice", path, String.class);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testPostResourceError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.postForEntity(Matchers.endsWith(path), Matchers.anyObject(), Matchers.any()))
- .thenReturn(response);
-
- configRestAdaptorService.postResource("modelservice", path, null, String.class);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testExchangeError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- configRestAdaptorService.exchangeResource("modelservice", path, null, String.class, "GET");
- }
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/SSLClientServiceTest.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/SSLClientServiceTest.java
deleted file mode 100644
index 8e09f1be4..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/service/SSLClientServiceTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.service;
-
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
-import static org.powermock.api.mockito.PowerMockito.whenNew;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-@SuppressWarnings("unchecked")
-@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("javax.net.ssl.*")
-@PrepareForTest({AbstractConfigRestClientAdapter.class})
-public class SSLClientServiceTest {
-
- ConfigRestAdaptorService configRestAdaptorService;
-
- RestTemplate mockRestTemplate = mock(RestTemplate.class);
-
- String path = "path";
-
- @Before
- public void before() throws Exception {
- whenNew(RestTemplate.class).withAnyArguments().thenReturn(mockRestTemplate);
-
- String propertyDir = "src/test/resources";
- configRestAdaptorService = new ConfigRestAdaptorServiceImpl(propertyDir);
- }
-
- @Test
- public void testGetResource() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.getResource("aai", path, String.class);
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test
- public void testPostResource() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.POST), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.postResource("aai", path, null, String.class);
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test
- public void testExchange() throws Exception {
- String responseBody = "sampleBodyString";
- ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- String body = configRestAdaptorService.exchangeResource("aai", path, null, String.class, "GET");
-
- Assert.assertEquals(responseBody, body);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testGetResourceError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.getForEntity(Matchers.endsWith(path), Matchers.any())).thenReturn(response);
-
- configRestAdaptorService.getResource("aai", path, String.class);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testPostResourceError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.postForEntity(Matchers.endsWith(path), Matchers.anyObject(), Matchers.any()))
- .thenReturn(response);
-
- configRestAdaptorService.postResource("aai", path, null, String.class);
- }
-
- @Test(expected = ConfigRestAdaptorException.class)
- public void testExchangeError() throws Exception {
- ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);
- when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),
- Matchers.any(Class.class))).thenReturn(response);
-
- configRestAdaptorService.exchangeResource("aai", path, null, String.class, "GET");
- }
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/utils/RestTemplateFactoryTest.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/utils/RestTemplateFactoryTest.java
deleted file mode 100644
index cee91d297..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/features/rest/adaptor/utils/RestTemplateFactoryTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed 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.onap.ccsdk.features.rest.adaptor.utils;
-
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorServiceImpl;
-
-@SuppressWarnings("squid:S2187")
-public class RestTemplateFactoryTest {
-
- public static void main(String[] args) {
-
- String propertyFile = RestTemplateFactoryTest.class.getClassLoader().getResource(".").getPath();
- System.out.println(" Property : " + propertyFile);
-
- try {
- ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl = new ConfigRestAdaptorServiceImpl(propertyFile);
- String restconfResponse = genericRestGetMDSALOperation(args, configRestAdaptorServiceImpl);
- System.out.println("RestTemplateFactoryTest.main Completed with response :" + restconfResponse);
- } catch (ConfigRestAdaptorException e) {
- e.printStackTrace();
- }
- }
-
- public static String genericRestGetMDSALOperation(String[] args,
- ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl) throws ConfigRestAdaptorException {
- String path = "config/Dummy-API:services/service-list/dummy-1234";
- String restconfResponse = configRestAdaptorServiceImpl.getResource(ConfigRestAdaptorConstants.SELECTOR_RESTCONF,
- path, String.class);
- return restconfResponse;
- }
-
-}
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/blueprints-processor-adaptor.properties b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/blueprints-processor-adaptor.properties
deleted file mode 100644
index 82f4fcb9d..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/blueprints-processor-adaptor.properties
+++ /dev/null
@@ -1,45 +0,0 @@
-###
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-#
-# Licensed 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.
-###
-#
-# Configuration file for SDNC Controller Module
-#
-
-org.onap.ccsdk.features.blueprints.adaptors.envtype=solo
-
-# Config Generator Microservices
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.type=generic
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.enable=true
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.url=http://localhost:8080/configgenerator/service/
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.user=admin
-org.onap.ccsdk.features.blueprints.adaptors.modelservice.passwd=admin
-
-# Generic RESTCONF Adaptor
-org.onap.ccsdk.features.blueprints.adaptors.restconf.type=generic
-org.onap.ccsdk.features.blueprints.adaptors.restconf.enable=true
-org.onap.ccsdk.features.blueprints.adaptors.restconf.user=admin
-org.onap.ccsdk.features.blueprints.adaptors.restconf.passwd=admin
-org.onap.ccsdk.features.blueprints.adaptors.restconf.url=http://localhost:8181/restconf/
-
-# SSL AAI Adaptor
-org.onap.ccsdk.features.blueprints.adaptors.aai.propertyfile=aai.properties
-org.onap.ccsdk.features.blueprints.adaptors.aai.type=ssl
-org.onap.ccsdk.features.blueprints.adaptors.aai.enable=true
-org.onap.ccsdk.features.blueprints.adaptors.aai.url=https://localhost:8443/onap-aai/
-org.onap.ccsdk.features.blueprints.adaptors.aai.ssl.trust=src/test/resources/truststore.client.jks
-org.onap.ccsdk.features.blueprints.adaptors.aai.ssl.trust.psswd=changeme
-org.onap.ccsdk.features.blueprints.adaptors.aai.ssl.key=src/test/resources/keystore.client.p12
-org.onap.ccsdk.features.blueprints.adaptors.aai.ssl.key.psswd=changeme
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/keystore.client.p12 b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/keystore.client.p12
deleted file mode 100644
index c28c8cb79..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/keystore.client.p12
+++ /dev/null
Binary files differ
diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/truststore.client.jks b/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/truststore.client.jks
deleted file mode 100644
index d38a5e57d..000000000
--- a/blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/truststore.client.jks
+++ /dev/null
Binary files differ