From d2cc0336c4dd9875e717e096d8f9bf815cb783b7 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Tue, 4 Sep 2018 21:22:01 -0400 Subject: SDN Controller Blueprints Data Adaptor Formatting, Organizing Imports, Code Cleanup for SDN Controller Blueprints Data Adaptor Component Change-Id: I029da1d9660129ae3415429661d37b9ea13bcb8b Issue-ID: CCSDK-495 Signed-off-by: Singal, Kapil (ks220y) --- .../rest/adaptor/ConfigRestAdaptorConstants.java | 31 +++++---- .../rest/adaptor/ConfigRestAdaptorException.java | 23 +++--- .../config/rest/adaptor/data/RestResponse.java | 41 ++++++----- .../service/AbstractConfigRestClientAdapter.java | 66 +++++++++--------- .../adaptor/service/ConfigRestAdaptorService.java | 29 ++++---- .../service/ConfigRestAdaptorServiceImpl.java | 49 +++++++------ .../service/ConfigRestClientServiceAdapter.java | 29 ++++---- .../service/GenericRestClientAdapterImpl.java | 55 ++++++++------- .../adaptor/service/SSLRestClientAdapterImpl.java | 55 ++++++++------- .../utils/BasicAuthorizationInterceptor.java | 25 ++++--- .../adaptor/utils/LoggingRequestInterceptor.java | 25 ++++--- .../org/opendaylight/blueprint/impl-blueprint.xml | 1 + .../AbstractConfigRestClientAdapterTest.java | 29 ++++---- .../service/GenericRestClientServiceTest.java | 56 +++++++-------- .../rest/adaptor/service/SSLClientServiceTest.java | 56 +++++++-------- .../adaptor/utils/RestTemplateFactoryTest.java | 81 +++++++++++++--------- .../test/resources/config-rest-adaptor.properties | 74 ++++++++++++-------- 17 files changed, 398 insertions(+), 327 deletions(-) (limited to 'blueprints-processor/adaptors/rest-adaptor-provider') diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorConstants.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorConstants.java index 4b0941652..af6b9f2b8 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorConstants.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorConstants.java @@ -1,24 +1,27 @@ /* * 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 + * 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. + * 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.config.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 = "config-rest-adaptor.properties"; public static final String PROXY_URL_KEY = "proxyUrl"; @@ -26,22 +29,22 @@ public class ConfigRestAdaptorConstants { 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.config.rest.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"; @@ -52,7 +55,7 @@ public class ConfigRestAdaptorConstants { 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"; @@ -62,5 +65,5 @@ public class ConfigRestAdaptorConstants { public static final String SELECTOR_POLICY_MANAGER = "policymanager"; public static final String SELECTOR_NRD = "networkresourcediscovery"; public static final String SELECTOR_NSM = "nsm"; - + } diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorException.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorException.java index 3bb04a207..c6593f128 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorException.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorException.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor; @@ -20,12 +23,12 @@ package org.onap.ccsdk.config.rest.adaptor; * @version 1.0 */ public class ConfigRestAdaptorException extends Exception { - + /** * */ private static final long serialVersionUID = 1L; - + /** * This is a ConfigRestAdaptorException constructor * @@ -34,7 +37,7 @@ public class ConfigRestAdaptorException extends Exception { public ConfigRestAdaptorException(String message) { super(message); } - + /** * This is a ConfigRestAdaptorException constructor * @@ -43,5 +46,5 @@ public class ConfigRestAdaptorException extends Exception { public ConfigRestAdaptorException(String message, Throwable cause) { super(message, cause); } - + } diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/data/RestResponse.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/data/RestResponse.java index ed39ea925..d31aa7e8a 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/data/RestResponse.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/data/RestResponse.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.data; @@ -17,57 +20,57 @@ package org.onap.ccsdk.config.rest.adaptor.data; import java.util.Map; public class RestResponse { - + private String statusCode; private String body; private Map parameters; private Map responseHeaders; private Map 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 getParameters() { return parameters; } - + public void setParameters(Map parameters) { this.parameters = parameters; } - + public Map getResponseHeaders() { return responseHeaders; } - + public void setResponseHeaders(Map responseHeaders) { this.responseHeaders = responseHeaders; } - + public Map getRequestHeaders() { return requestHeaders; } - + public void setRequestHeaders(Map 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/config/rest/adaptor/service/AbstractConfigRestClientAdapter.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/AbstractConfigRestClientAdapter.java index 7ccb6274d..97302620e 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/AbstractConfigRestClientAdapter.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/AbstractConfigRestClientAdapter.java @@ -53,24 +53,24 @@ 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 properties = new ConcurrentHashMap<>(); protected String serviceSelector; - + protected RestTemplate restTemplate; - + protected AbstractConfigRestClientAdapter(Map 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; @@ -82,7 +82,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic isRestClientServiceAdapaterEnabled = true; } } - + private List> getMessageConverters() { List> converters = new ArrayList<>(); converters.add(new ByteArrayHttpMessageConverter()); @@ -92,85 +92,85 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic 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 getResource(HttpHeaders headers, String url, Class responseType) throws ConfigRestAdaptorException { ResponseEntity response = exchangeForEntity(headers, url, HttpMethod.GET, null, responseType); return processResponse(response, url, HttpMethod.GET); } - + public T postResource(HttpHeaders headers, String url, Object request, Class responseType) throws ConfigRestAdaptorException { ResponseEntity response = exchangeForEntity(headers, url, HttpMethod.POST, request, responseType); return processResponse(response, url, HttpMethod.POST); } - + public T exchangeResource(HttpHeaders headers, String url, Object request, Class responseType, String method) throws ConfigRestAdaptorException { ResponseEntity response = exchangeForEntity(headers, url, HttpMethod.resolve(method), request, responseType); return processResponse(response, url, HttpMethod.resolve(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.resolve(method), request); } - + private RestResponse exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request) throws ConfigRestAdaptorException { RestResponse restResponse = new RestResponse(); restResponse.setRequestHeaders(headers.toSingleValueMap()); ResponseEntity response = null; - + try { if (restTemplate == null) { logger.error(MS_INIT_FAIL); @@ -179,7 +179,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic logger.debug("url : ({})", url); logger.debug("headers: ({})", headers); logger.debug("request: ({})", request); - + if (HttpMethod.GET == httpMethod) { HttpEntity entity = new HttpEntity<>("parameters", headers); response = restTemplate.exchange(url, httpMethod, entity, String.class); @@ -188,7 +188,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic 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()); @@ -210,11 +210,11 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic } return restResponse; } - + private ResponseEntity exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request, Class responseType) throws ConfigRestAdaptorException { ResponseEntity response = null; - + try { if (restTemplate == null) { logger.error(MS_INIT_FAIL); @@ -223,7 +223,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic logger.debug("url : ({})", url); logger.debug("headers: ({})", headers); logger.debug("request: ({})", request); - + if (HttpMethod.GET == httpMethod) { HttpEntity entity = new HttpEntity<>("parameters", headers); response = restTemplate.exchange(url, httpMethod, entity, responseType); @@ -232,7 +232,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic response = restTemplate.exchange(url, httpMethod, entity, responseType); } logger.debug("response: ({})", response); - + if (response != null) { logger.debug("response status code: ({})", response.getStatusCode()); } else { @@ -245,7 +245,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic } return response; } - + protected synchronized T processResponse(ResponseEntity response, String url, HttpMethod httpMethod) throws ConfigRestAdaptorException { if (response != null) { @@ -262,7 +262,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic } 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; @@ -270,5 +270,5 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic return baseUrl; } } - + } diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorService.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorService.java index e15f4ae71..98c598acb 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorService.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorService.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.service; @@ -18,7 +21,7 @@ import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException; import org.onap.ccsdk.config.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. @@ -28,7 +31,7 @@ public interface ConfigRestAdaptorService { * @param responseType the type of the return value */ public T getResource(String selectorName, String path, Class responseType) throws ConfigRestAdaptorException; - + /** * Create a new resource by POSTing the given object to the URI template, and returns the response * as defined responseType @@ -40,7 +43,7 @@ public interface ConfigRestAdaptorService { */ public T postResource(String selectorName, String path, Object request, Class 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 @@ -53,7 +56,7 @@ public interface ConfigRestAdaptorService { */ public T exchangeResource(String selectorName, String path, Object request, Class 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. @@ -62,7 +65,7 @@ public interface ConfigRestAdaptorService { * @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 @@ -73,7 +76,7 @@ public interface ConfigRestAdaptorService { */ 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 @@ -85,5 +88,5 @@ public interface ConfigRestAdaptorService { */ 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/config/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java index b17ed2262..65b9defd3 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.service; @@ -31,16 +34,16 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService { - + private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigRestAdaptorServiceImpl.class); private Map restProperties = new ConcurrentHashMap<>(); - + public ConfigRestAdaptorServiceImpl(String propertyPath) { initializeProperties(propertyPath); 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); @@ -53,72 +56,72 @@ public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService { logger.error(e.getMessage(), e); } } - + private void initializeProperties(String propertyPath) { logger.trace("Initialising Config rest adaptor Service with property directory ({})", propertyPath); try { if (StringUtils.isBlank(propertyPath)) { propertyPath = System.getProperty(ConfigRestAdaptorConstants.SDNC_ROOT_DIR_ENV_VAR_KEY); } - + if (StringUtils.isBlank(propertyPath)) { throw new ConfigRestAdaptorException( String.format("Failed to get the property directory (%s)", propertyPath)); } - + // Loading Default config-rest-adaptor.properties String propertyFile = propertyPath + File.separator + ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME; - + Properties properties = new Properties(); properties.load(new FileInputStream(propertyFile)); - + logger.trace("Initializing properties details for property file ({}) properties ({})", propertyFile, properties); restProperties.putAll(properties.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString()))); - + } catch (Exception e) { logger.error(e.getMessage(), e); } } - + @Override public T getResource(String serviceSelector, String path, Class responseType) throws ConfigRestAdaptorException { return getRestClientAdapterBySelectorName(serviceSelector).getResource(path, responseType); } - + @Override public T postResource(String serviceSelector, String path, Object request, Class responseType) throws ConfigRestAdaptorException { return getRestClientAdapterBySelectorName(serviceSelector).postResource(path, request, responseType); } - + @Override public T exchangeResource(String serviceSelector, String path, Object request, Class 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 @@ -138,5 +141,5 @@ public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService { 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/config/rest/adaptor/service/ConfigRestClientServiceAdapter.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestClientServiceAdapter.java index e1adb3814..46e954fb6 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestClientServiceAdapter.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestClientServiceAdapter.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.service; @@ -18,18 +21,18 @@ import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException; import org.onap.ccsdk.config.rest.adaptor.data.RestResponse; interface ConfigRestClientServiceAdapter { - + public T getResource(String path, Class responseType) throws ConfigRestAdaptorException; - + public T postResource(String path, Object request, Class responseType) throws ConfigRestAdaptorException; - + public T exchangeResource(String path, Object request, Class 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/config/rest/adaptor/service/GenericRestClientAdapterImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/GenericRestClientAdapterImpl.java index 55cdca40b..8cb5e9bea 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/GenericRestClientAdapterImpl.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/GenericRestClientAdapterImpl.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.service; @@ -26,16 +29,16 @@ 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 properties, String serviceSelector) throws ConfigRestAdaptorException { super(properties, serviceSelector); init(serviceSelector); } - + private void init(String serviceSelector) throws ConfigRestAdaptorException { try { if (isRestClientServiceAdapaterEnabled) { @@ -45,11 +48,11 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte + 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) { @@ -58,52 +61,52 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte } else { throw new ConfigRestAdaptorException("rest selector (" + serviceSelector + ") is not enabled"); } - + } catch (Exception e) { throw new ConfigRestAdaptorException("GenericRestClientServiceAdapter : " + e.getMessage(), e); } } - + @Override public T getResource(String path, Class responseType) throws ConfigRestAdaptorException { return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType); } - + @Override public T postResource(String path, Object request, Class responseType) throws ConfigRestAdaptorException { return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType); } - + @Override public T exchangeResource(String path, Object request, Class 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 @@ -112,7 +115,7 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte + 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)); } @@ -125,12 +128,12 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte 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/config/rest/adaptor/service/SSLRestClientAdapterImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/SSLRestClientAdapterImpl.java index 7d31b812e..e444d9f17 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/SSLRestClientAdapterImpl.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/SSLRestClientAdapterImpl.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.service; @@ -25,23 +28,23 @@ 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 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 @@ -54,15 +57,15 @@ public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter { + 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) { @@ -72,55 +75,55 @@ public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter { } else { throw new ConfigRestAdaptorException("SSL Client selector (" + serviceSelector + ") is not enabled"); } - + } catch (Exception e) { throw new ConfigRestAdaptorException("SSLRestClientAdapterImpl : " + e.getMessage(), e); } } - + @Override public T getResource(String path, Class responseType) throws ConfigRestAdaptorException { return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType); } - + @Override public T postResource(String path, Object request, Class responseType) throws ConfigRestAdaptorException { return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType); } - + @Override public T exchangeResource(String path, Object request, Class 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/config/rest/adaptor/utils/BasicAuthorizationInterceptor.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/BasicAuthorizationInterceptor.java index bc486f4de..2318fd6ca 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/BasicAuthorizationInterceptor.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/BasicAuthorizationInterceptor.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.utils; @@ -25,11 +28,11 @@ import org.springframework.util.Base64Utils; 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. * @@ -41,11 +44,11 @@ public class BasicAuthorizationInterceptor implements ClientHttpRequestIntercept this.username = username; this.pass = (pass != null ? pass : ""); } - + @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { - + String token = Base64Utils.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/config/rest/adaptor/utils/LoggingRequestInterceptor.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/LoggingRequestInterceptor.java index 0fcc4654e..4095d62fe 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/LoggingRequestInterceptor.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/LoggingRequestInterceptor.java @@ -1,15 +1,18 @@ /* * 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 + * 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. + * 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.config.rest.adaptor.utils; @@ -25,9 +28,9 @@ 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 { @@ -36,7 +39,7 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor { traceResponse(response); return response; } - + @SuppressWarnings({"squid:S2629", "squid:S3457"}) private void traceRequest(HttpRequest request, byte[] body) throws IOException { logger.info("===========================request begin================================================"); @@ -46,7 +49,7 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor { 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(); @@ -64,5 +67,5 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor { logger.debug("Response body: {}", inputStringBuilder.toString()); logger.debug("=======================response end================================================="); } - + } 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 index e6b26944d..0b6a6ae11 100644 --- 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 @@ -1,6 +1,7 @@