summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java298
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java55
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java12
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java24
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java57
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java24
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java33
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java49
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java33
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java9
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java11
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java10
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java46
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java11
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java31
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java10
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java13
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java27
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java9
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java182
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json55
40 files changed, 491 insertions, 736 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java
deleted file mode 100644
index 6c646f3e63..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-
-import java.security.GeneralSecurityException;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.annotation.PostConstruct;
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-/**
- * This is the class that is used to POST replies from the MSO adapters to the BPEL engine.
- * It can be configured via property file, or modified using the member methods.
- * The properties to use are:
- * org.onap.so.adapters.vnf.bpelauth encrypted authorization string to send to BEPL engine
- * org.onap.so.adapters.vnf.sockettimeout socket timeout value
- * org.onap.so.adapters.vnf.connecttimeout connect timeout value
- * org.onap.so.adapters.vnf.retrycount number of times to retry failed connections
- * org.onap.so.adapters.vnf.retryinterval interval (in seconds) between retries
- * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code
- * 900 means "connection was not established")
- */
-@Component("NetworkBpel")
-@Scope("prototype")
-public class BpelRestClient {
- public static final String MSO_PROP_NETWORK_ADAPTER = "MSO_PROP_NETWORK_ADAPTER";
- private static final String PROPERTY_DOMAIN = "org.onap.so.adapters.network";
- private static final String BPEL_AUTH_PROPERTY = PROPERTY_DOMAIN+".bpelauth";
- private static final String SOCKET_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".sockettimeout";
- private static final String CONN_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".connecttimeout";
- private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount";
- private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval";
- private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist";
- private static final String ENCRYPTION_KEY_PROP = PROPERTY_DOMAIN + ".encryptionKey";
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class);
-
- @Autowired
- private Environment env;
- /** Default socket timeout (in seconds) */
- public static final int DEFAULT_SOCKET_TIMEOUT = 5;
- /** Default connect timeout (in seconds) */
- public static final int DEFAULT_CONNECT_TIMEOUT = 5;
- /** By default, retry up to five times */
- public static final int DEFAULT_RETRY_COUNT = 5;
- /** Default interval to wait between retries (in seconds), negative means use backoff algorithm */
- public static final int DEFAULT_RETRY_INTERVAL = -15;
- /** Default list of response codes to trigger a retry */
- public static final String DEFAULT_RETRY_LIST = "408,429,500,502,503,504,900"; // 900 is "connection failed"
- /** Default credentials */
- public static final String DEFAULT_CREDENTIALS = "";
-
- // Properties of the BPEL client -- all are configurable
- private int socketTimeout;
- private int connectTimeout;
- private int retryCount;
- private int retryInterval;
- private Set<Integer> retryList;
- private String credentials;
-
- // last response from BPEL engine
- private int lastResponseCode;
- private String lastResponse;
-
- /**
- * Create a client to send results to the BPEL engine, using configuration from the
- * MSO_PROP_NETWORK_ADAPTER properties.
- */
- public BpelRestClient() {
- socketTimeout = DEFAULT_SOCKET_TIMEOUT;
- connectTimeout = DEFAULT_CONNECT_TIMEOUT;
- retryCount = DEFAULT_RETRY_COUNT;
- retryInterval = DEFAULT_RETRY_INTERVAL;
- setRetryList(DEFAULT_RETRY_LIST);
- credentials = DEFAULT_CREDENTIALS;
- lastResponseCode = 0;
- lastResponse = "";
-
- }
-
- @PostConstruct
- protected void init() {
-
- socketTimeout = env.getProperty(SOCKET_TIMEOUT_PROPERTY, Integer.class, DEFAULT_SOCKET_TIMEOUT);
- connectTimeout = env.getProperty(CONN_TIMEOUT_PROPERTY, Integer.class, DEFAULT_CONNECT_TIMEOUT);
- retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT);
- retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL);
- setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST));
- credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, env.getProperty(ENCRYPTION_KEY_PROP));
- }
-
- public int getSocketTimeout() {
- return socketTimeout;
- }
-
- public void setSocketTimeout(int socketTimeout) {
- this.socketTimeout = socketTimeout;
- }
-
- public int getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(int connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-
- public int getRetryCount() {
- return retryCount;
- }
-
- public void setRetryCount(int retryCount) {
- int retCnt = 0;
- if (retryCount < 0)
- retCnt = DEFAULT_RETRY_COUNT;
- this.retryCount = retCnt;
- }
-
- public int getRetryInterval() {
- return retryInterval;
- }
-
- public void setRetryInterval(int retryInterval) {
- this.retryInterval = retryInterval;
- }
-
- public String getCredentials() {
- return credentials;
- }
-
- public void setCredentials(String credentials) {
- this.credentials = credentials;
- }
-
- public String getRetryList() {
- if (retryList.isEmpty())
- return "";
- String t = retryList.toString();
- return t.substring(1, t.length()-1);
- }
-
- public void setRetryList(String retryList) {
- Set<Integer> s = new TreeSet<>();
- for (String t : retryList.split("[, ]")) {
- try {
- s.add(Integer.parseInt(t));
- } catch (NumberFormatException x) {
- LOGGER.debug("Exception while parsing", x);
- }
- }
- this.retryList = s;
- }
-
- public int getLastResponseCode() {
- return lastResponseCode;
- }
-
- public String getLastResponse() {
- return lastResponse;
- }
-
- /**
- * Post a response to the URL of the BPEL engine. As long as the response code is one of those in
- * the retryList, the post will be retried up to "retrycount" times with an interval (in seconds)
- * of "retryInterval". If retryInterval is negative, then each successive retry interval will be
- * double the previous one.
- * @param toBpelStr the content (XML or JSON) to post
- * @param bpelUrl the URL to post to
- * @param isxml true if the content is XML, otherwise assumed to be JSON
- * @return true if the post succeeded, false if all retries failed
- */
- public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- debug("Sending response to BPEL: " + toBpelStr);
- int totalretries = 0;
- int retryint = retryInterval;
- while (true) {
- sendOne(toBpelStr, bpelUrl, isxml);
- // Note: really should handle response code 415 by switching between content types if needed
- if (!retryList.contains(lastResponseCode)) {
- debug("Got response code: " + lastResponseCode + ": returning.");
- return true;
- }
- if (totalretries >= retryCount) {
- debug("Retried " + totalretries + " times, giving up.");
- LOGGER.error(MessageEnum.RA_SEND_VNF_NOTIF_ERR, "Could not deliver response to BPEL after "+totalretries+" tries: "+toBpelStr, "Camunda", "", MsoLogger.ErrorCode.DataError, "Could not deliver response to BPEL");
- return false;
- }
- totalretries++;
- int sleepinterval = retryint;
- if (retryint < 0) {
- // if retry interval is negative double the retry on each pass
- sleepinterval = -retryint;
- retryint *= 2;
- }
- debug("Sleeping for " + sleepinterval + " seconds.");
- try {
- Thread.sleep(sleepinterval * 1000L);
- } catch (InterruptedException e) {
- LOGGER.debug("Exception while Thread sleep", e);
- Thread.currentThread().interrupt();
- }
- }
- }
- private void debug(String m) {
- LOGGER.debug(m);
- }
- private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- LOGGER.debug("Sending to BPEL server: "+bpelUrl);
- LOGGER.debug("Content is: "+toBpelStr);
-
- //POST
- HttpPost post = new HttpPost(bpelUrl);
- if (credentials != null && !credentials.isEmpty())
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
-
- //ContentType
- ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
- post.setEntity(new StringEntity(toBpelStr, ctype));
-
- //Timeouts
- RequestConfig requestConfig = RequestConfig
- .custom()
- .setSocketTimeout(socketTimeout * 1000)
- .setConnectTimeout(connectTimeout * 1000)
- .build();
- post.setConfig(requestConfig);
-
- //Client 4.3+
- //Execute & GetResponse
- try (CloseableHttpClient client = HttpClients.createDefault()) {
- CloseableHttpResponse response = client.execute(post);
- if (response != null) {
- lastResponseCode = response.getStatusLine().getStatusCode();
- HttpEntity entity = response.getEntity();
- lastResponse = (entity != null) ? EntityUtils.toString(entity) : "";
- } else {
- lastResponseCode = 900;
- lastResponse = "";
- }
- } catch (Exception e) {
- String error = "Error sending Bpel notification:" + toBpelStr;
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e);
- lastResponseCode = 900;
- lastResponse = "";
- }
- LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
- LOGGER.debug("Response body is: "+lastResponse);
- }
-
- private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- if (env.getProperty(key) != null) {
- try {
- return CryptoUtils.decrypt(env.getProperty(key), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e);
- }
- }
- return defaultValue;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index 8d08b3b52c..fd658244ee 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -59,6 +59,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.adapters.vnf.BpelRestClient;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 5fa21c64b1..4b02b73786 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -57,7 +57,7 @@ import org.springframework.stereotype.Component;
* org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code
* 900 means "connection was not established")
*/
-@Component("VnfBpel")
+@Component()
@Scope("prototype")
public class BpelRestClient {
public static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
@@ -249,6 +249,8 @@ public class BpelRestClient {
if (credentials != null && !credentials.isEmpty())
post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
+ LOGGER.debug("HTTPPost Headers: " + post.getAllHeaders());
+
//ContentType
ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
post.setEntity(new StringEntity(toBpelStr, ctype));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
deleted file mode 100644
index 02a5f25b41..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.inject.Provider;
-
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.web.server.LocalServerPort;
-
-public class BpelRestClientTest extends BaseRestTestUtils {
-
-
- @LocalServerPort
- private int port;
- @Autowired
- @Qualifier("NetworkBpel")
- private Provider<BpelRestClient> clientProvider;
-
- @Test
- public void verifyPropertiesRead() {
- BpelRestClient client = clientProvider.get();
-
- assertEquals(5, client.getRetryCount());
- assertEquals(5, client.getConnectTimeout());
- assertEquals("test:test", client.getCredentials());
- assertEquals(5, client.getSocketTimeout());
- assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList());
- assertEquals(-15, client.getRetryInterval());
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
index 20a3e62ade..4b2fa8138a 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
@@ -35,7 +35,6 @@ public class BpelRestClientTest extends BaseRestTestUtils{
@LocalServerPort
private int port;
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> clientProvider;
@Test
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index e74dd64bb3..5deec41d94 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,8 @@ import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -46,7 +49,7 @@ import org.onap.so.logger.MsoLogger;
targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1")
public class SDNCAdapterService extends Service {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterService.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterService.class);
private static final String SDNC_ADAPTER_WSDL="SDNCAdapter.wsdl";
public static final URL WSDL_LOCATION;
@@ -58,16 +61,19 @@ public class SDNCAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
- logger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
- logger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
- } else {
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ } else {
try {
- logger.info(MessageEnum.RA_PRINT_URL, SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "");
+ logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString());
} catch (Exception e) {
- logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e);
- }
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - print URL", e);
+ }
}
WSDL_LOCATION = wsdlUrl;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 7ec20afffd..3dcd008ba5 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -33,6 +35,9 @@ import javax.xml.bind.annotation.XmlType;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* <p>Java class for anonymous complex type.
*
@@ -67,7 +72,7 @@ public class SDNCAdapterCallbackRequest {
@XmlElement(name = "RequestData")
protected Object requestData;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterCallbackRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterCallbackRequest.class);
/**
* Gets the value of the callbackHeader property.
@@ -130,8 +135,9 @@ public class SDNCAdapterCallbackRequest {
}
catch (Exception e)
{
- msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e);
- }
+ logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - MARSHING_ERROR", e);
+ }
return "";
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index e4882090bf..fd288c6a04 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -31,6 +33,8 @@ import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -44,7 +48,7 @@ import org.onap.so.logger.MsoLogger;
targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
public class SDNCCallbackAdapterService extends Service {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCCallbackAdapterService.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCCallbackAdapterService.class);
private static final String SDNC_CALLBACK_ADAPTER_WSDL="SDNCCallbackAdapter.wsdl";
public static final URL WSDL_LOCATION;
public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
@@ -54,16 +58,20 @@ public class SDNCCallbackAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
- msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
- } else {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ } else {
try {
- msoLogger.info(MessageEnum.RA_PRINT_URL, SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC");
- } catch (Exception e) {
- msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e);
- }
+ logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ wsdlUrl.toURI().toString(), "SDNC");
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Exception - URL convention problem", e);
+ }
}
WSDL_LOCATION = wsdlUrl;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index a5800fc73d..6262f2d86f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,8 @@ package org.onap.so.adapters.sdnc.impl;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -31,7 +34,7 @@ import org.springframework.stereotype.Component;
@Component
public class MapRequestTunables {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapRequestTunables.class);
+ private static Logger logger = LoggerFactory.getLogger(MapRequestTunables.class);
public static final String GENERATED_KEY = "Generated key: ";
@Autowired
@@ -44,14 +47,14 @@ public class MapRequestTunables {
String key;
if ("query".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + ".." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
}
else if ("put".equals(reqTunable.getAction()) || "restdelete".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "..." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
} else {
key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + "." + reqTunable.getOperation() +"." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
}
String value;
@@ -61,31 +64,32 @@ public class MapRequestTunables {
String[] parts = value.split("\\|"); //escape pipe
if (parts.length < 3) {
- msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
+ logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
}
for (int i = 0; i < parts.length; i++) {
if (i == 0) {
reqTunable.setReqMethod(parts[i]) ;
- msoLogger.debug("Request Method is set to: " + reqTunable.getReqMethod());
+ logger.debug("Request Method is set to: {}", reqTunable.getReqMethod());
} else if (i == 1) {
reqTunable.setTimeout( parts[i]);
- msoLogger.debug("Timeout is set to: " + reqTunable.getTimeout());
+ logger.debug("Timeout is set to: {}", reqTunable.getTimeout());
} else if (i == 2) {
reqTunable.setSdncUrl(env.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i],""));
if (reqTunable.getOperation() != null && reqTunable.getSdncUrl() != null) {
reqTunable.setSdncUrl(reqTunable.getSdncUrl() + reqTunable.getOperation());
}
- msoLogger.debug("SDNC Url is set to: " + reqTunable.getSdncUrl());
+ logger.debug("SDNC Url is set to: {}", reqTunable.getSdncUrl());
} else if (i == 3) {
reqTunable.setHeaderName(parts[i]);
- msoLogger.debug("HeaderName is set to: " + reqTunable.getHeaderName());
+ logger.debug("HeaderName is set to: {}", reqTunable.getHeaderName());
} else if (i == 4) {
reqTunable.setNamespace(parts[i]);
- msoLogger.debug("NameSpace is set to: " + reqTunable.getNamespace());
+ logger.debug("NameSpace is set to: {}", reqTunable.getNamespace());
} else if (i == 5) {
reqTunable.setAsyncInd(parts[i]);
- msoLogger.debug("AsyncInd is set to: " + reqTunable.getAsyncInd());
+ logger.debug("AsyncInd is set to: {}", reqTunable.getAsyncInd());
}
}
@@ -96,9 +100,10 @@ public class MapRequestTunables {
error = "Missing configuration for:" + key;
}
if (error != null) {
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
}
- msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString());
+ logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
return reqTunable;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 4a6ac9f5e2..cf81ae4be0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -30,6 +32,8 @@ import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,7 +44,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterPortTypeImpl.class);
@Autowired
@@ -48,7 +52,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@PostConstruct
public void init () {
- msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType", "");
+ logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
}
/**
@@ -57,7 +61,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@Override
public void healthCheck ()
{
- msoLogger.debug("Health check call in SDNC Adapter");
+ logger.debug("Health check call in SDNC Adapter");
}
@@ -70,7 +74,8 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
}
catch (Exception e){
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
- msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e);
+ logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 59884f25b8..d7f2c11d0b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -55,6 +55,8 @@ import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
@@ -74,7 +76,7 @@ public class SDNCRestClient{
@Autowired
private MapRequestTunables tunablesMapper;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG="Exception while evaluate xpath";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@@ -83,7 +85,7 @@ public class SDNCRestClient{
public void executeRequest(SDNCAdapterRequest bpelRequest)
{
- msoLogger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request:" + bpelRequest.toString());
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
@@ -124,11 +126,9 @@ public class SDNCRestClient{
}
long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
- msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null);
- msoLogger.debug ("Got the SDNC Response: " + sdncResp.getSdncRespXml());
+ logger.debug ("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- msoLogger.recordMetricEvent (bpelStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send reauest to BPEL", "BPMN", callbackUrl, null);
return;
}
@@ -142,8 +142,8 @@ public class SDNCRestClient{
SDNCResponse sdncResp = new SDNCResponse(rt.getReqId());
StringBuilder response = new StringBuilder();
- msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC.name() + ":\n" + rt.toString(), "SDNC", "");
- msoLogger.trace("SDNC Request Body:\n" + sdncReqBody);
+ logger.info("{} :\n {} {}", MessageEnum.RA_SEND_REQUEST_SDNC.name(), rt.toString(), "SDNC");
+ logger.trace("SDNC Request Body:{} \n", sdncReqBody);
try {
@@ -186,12 +186,13 @@ public class SDNCRestClient{
}
sdncResp.setSdncRespXml(response.toString());
- msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC.name() + ":\n" + sdncResp.toString(), "SDNC", "");
+ logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return(sdncResp);
}
catch (Exception e)
{
- msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
//default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
String respMsg = "Error processing request to SDNC. ";
@@ -231,7 +232,8 @@ public class SDNCRestClient{
eType = xpath.evaluate("error-type", error);
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eTag = null;
@@ -239,7 +241,8 @@ public class SDNCRestClient{
eTag = xpath.evaluate( "error-tag", error);
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eMsg = null;
@@ -247,15 +250,18 @@ public class SDNCRestClient{
eMsg = xpath.evaluate("error-message", error);
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
}
} catch (Exception e2) {
- msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2);
+ logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} //is != null
} catch (Exception e1) {
- msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} //con != null
@@ -266,7 +272,8 @@ public class SDNCRestClient{
sdncResp.setRespMsg(respMsg);
- msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
}
@@ -289,14 +296,15 @@ public class SDNCRestClient{
{
cbReq.setRequestData(sdncResp.getSdncRespXml());
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), CAMUNDA, "");
+ logger.info("{} :\n {} {}", MessageEnum.RA_CALLBACK_BPEL.name(), cbReq.toString(), CAMUNDA);
URL wsdlUrl = null;
try {
wsdlUrl = new URL (bpelUrl);
} catch (MalformedURLException e1) {
error = "Caught exception initializing Callback wsdl " + e1.getMessage();
- msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1);
+ logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -310,7 +318,7 @@ public class SDNCRestClient{
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
}
else {
- msoLogger.debug("wsdlUrl is NULL:");
+ logger.debug("wsdlUrl is NULL:");
}
//authentication
@@ -326,22 +334,23 @@ public class SDNCRestClient{
}
catch (Exception e2) {
error = "Unable to set authorization in callback request " + e2.getMessage();
- msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2);
+ logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Exception - Unable to set authorization in callback request", e2);
}
- msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl);
+ logger.debug("Invoking Bpel Callback. BpelCallbackUrl:{}", bpelUrl);
cbPort.sdncAdapterCallback(cbReq);
}
catch (Exception e)
{
error = "Error sending BpelCallback request" + e.getMessage();
- msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e);
-
+ logger.error("Error {} - {} - {}", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, "");
+ logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
return;
}
-
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 55af0d7cad..96e7dcf51a 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -33,13 +35,15 @@ import javax.xml.transform.stream.StreamResult;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class Utils {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, Utils.class);
+ private static Logger logger = LoggerFactory.getLogger(Utils.class);
private Utils() {
}
@@ -94,11 +98,12 @@ public class Utils {
}
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncReq:\n" + s);
+ logger.debug("Formatted SdncReq:\n", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
}
@@ -127,11 +132,12 @@ public class Utils {
}
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncPutReq:\n" + s);
+ logger.debug("Formatted SdncPutReq:\n {}", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
}
@@ -161,11 +167,12 @@ public class Utils {
root.appendChild(elem3);
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncReq:" + s);
+ logger.debug("Formatted SdncReq: {}", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
}
@@ -191,7 +198,8 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e);
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError
+ .getValue(), "Exception - domToStr", e);
}
}
return null;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index e427423763..6a66770d29 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +39,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.onap.so.utils.CryptoUtils;
@@ -49,7 +52,7 @@ import org.springframework.core.env.Environment;
*/
@Component
public class BPRestCallback {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class);
+ private static final Logger logger = LoggerFactory.getLogger(BPRestCallback.class);
private static final String CAMUNDA="Camunda";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@@ -66,7 +69,7 @@ public class BPRestCallback {
* @return true if the message was consumed successfully by the endpoint
*/
public boolean send(String workflowMessageUrl, String messageType, String correlator, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
+ logger.debug(getClass().getSimpleName() + ".send("
+ "workflowMessageUrl=" + workflowMessageUrl
+ " messageType=" + messageType
+ " correlator=" + correlator
@@ -91,12 +94,13 @@ public class BPRestCallback {
* @return true if the message was consumed successfully by the endpoint
*/
public boolean send(String url, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
+ logger.debug(getClass().getSimpleName() + ".send("
+ "url=" + url
+ " message=" + message
+ ")");
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, CAMUNDA, "");
+ logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message,
+ CAMUNDA);
HttpPost method = null;
HttpResponse httpResponse = null;
@@ -129,8 +133,8 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID,MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME,"SO-SDNCAdapter");
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Unable to set authorization in callback request", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e);
error = true;
}
@@ -146,14 +150,15 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
+ logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, MsoLogger.ErrorCode
+ .BusinessProcesssError.getValue(), msg);
}
}
return true;
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Error sending callback request", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
if (httpResponse != null) {
@@ -161,7 +166,7 @@ public class BPRestCallback {
EntityUtils.consume(httpResponse.getEntity());
httpResponse = null;
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
@@ -169,10 +174,10 @@ public class BPRestCallback {
try {
method.reset();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, CAMUNDA, "","");
+ logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
}
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 6f40ba07a9..fd9ce4c719 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -34,9 +37,7 @@ import org.springframework.stereotype.Component;
@Component
public class MapTypedRequestTunablesData {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class);
-
-
+ private static Logger logger = LoggerFactory.getLogger(MapTypedRequestTunablesData.class);
private static final String MISSING_CONFIGURATION_ERROR_MSG= "Missing configuration for: ";
private static final String MISSING_CONFIG_PARAM_ERROR_MSG="Missing config param";
@@ -54,7 +55,8 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -63,41 +65,42 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error="Invalid configuration for: " + reqTunable.getKey();
- msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
-
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
reqTunable.setReqMethod(parts[0]);
- msoLogger.trace("Request Method is set to: " + reqTunable.getReqMethod());
+ logger.trace("Request Method is set to: {}", reqTunable.getReqMethod());
reqTunable.setTimeout(parts[1]);
- msoLogger.trace("Timeout is set to: " + reqTunable.getTimeout());
+ logger.trace("Timeout is set to: {}", reqTunable.getTimeout());
String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2];
reqTunable.setSdncUrl(env.getProperty(urlPropKey, ""));
if ("".equals(reqTunable.getSdncUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
- msoLogger.trace("SDNC Url is set to: " + reqTunable.getSdncUrl());
+ logger.trace("SDNC Url is set to: {}", reqTunable.getSdncUrl());
reqTunable.setHeaderName(parts[3]);
- msoLogger.trace("Header Name is set to: " + reqTunable.getHeaderName());
+ logger.trace("Header Name is set to: {}", reqTunable.getHeaderName());
reqTunable.setNamespace(parts[4]);
- msoLogger.trace("Namespace is set to: " + reqTunable.getNamespace());
+ logger.trace("Namespace is set to: {}", reqTunable.getNamespace());
reqTunable.setMyUrl(env.getProperty(Constants.MY_URL_PROP, ""));
if ("".equals(reqTunable.getMyUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -108,7 +111,7 @@ public class MapTypedRequestTunablesData {
reqTunable.setMyUrl(reqTunable.getMyUrl().concat(reqTunable.getMyUrlSuffix()));
- msoLogger.debug(reqTunable.toString());
+ logger.debug(reqTunable.toString());
return reqTunable;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
index dcb1fdae8c..8cafbda325 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -21,11 +23,11 @@
package org.onap.so.adapters.sdnc.sdncrest;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -35,7 +37,7 @@ import org.w3c.dom.NodeList;
* Utility methods used by SDNCAdapterRest.
*/
public final class SDNCAdapterUtils {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterUtils.class);
/**
* Instantiation is not allowed.
*/
@@ -67,4 +69,4 @@ public final class SDNCAdapterUtils {
public static String encodeURLPathSegment(String pathSegment) {
return UriUtils.encodePathSegment(pathSegment, "UTF-8");
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 3ecf6337cf..06e7ab23a6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +55,8 @@ import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -68,7 +71,7 @@ import org.springframework.core.env.Environment;
*/
@Component
public abstract class SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCConnector.class);
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
private static final String XPATH_EXCEPTION="XPath Exception";
@@ -76,8 +79,8 @@ public abstract class SDNCConnector {
private Environment env;
public SDNCResponseCommon send(String content, TypedRequestTunables rt) {
- LOGGER.debug("SDNC URL: " + rt.getSdncUrl());
- LOGGER.debug("SDNC Request Body:\n" + content);
+ logger.debug("SDNC URL: {}", rt.getSdncUrl());
+ logger.debug("SDNC Request Body:\n {}", content);
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -122,7 +125,7 @@ public abstract class SDNCConnector {
method.setHeader("Accept", "application/yang.data+xml");
}
else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
@@ -137,8 +140,8 @@ public abstract class SDNCConnector {
int statusCode = httpResponse.getStatusLine().getStatusCode();
String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
- LOGGER.debug("SDNC Response: " + statusCode + " " + statusMessage
- + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+ logger.debug("SDNC Response: {} {}", statusCode,
+ statusMessage + (responseContent == null ? "" : System.lineSeparator() + responseContent));
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String errMsg = "SDNC returned " + statusCode + " " + statusMessage;
@@ -159,12 +162,12 @@ public abstract class SDNCConnector {
method.reset();
}
else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
method = null;
- LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
+ logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
@@ -182,7 +185,7 @@ public abstract class SDNCConnector {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
@@ -190,22 +193,20 @@ public abstract class SDNCConnector {
try {
method.reset();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
}
}
protected void logError(String errMsg) {
- LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
- MsoLogger.ErrorCode.AvailabilityError, errMsg);
-
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
- LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
- MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
-
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
/**
@@ -288,8 +289,8 @@ public abstract class SDNCConnector {
String errorType = xpath.evaluate("error-type", error);
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -299,8 +300,8 @@ public abstract class SDNCConnector {
}
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -310,8 +311,8 @@ public abstract class SDNCConnector {
}
info += "error-message:" + errorMessage;
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
if (!info.isEmpty()) {
@@ -323,8 +324,8 @@ public abstract class SDNCConnector {
}
}
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
return output.toString();
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index 8ca14501e5..57051e570e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +39,8 @@ import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceResponse;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -52,17 +54,17 @@ import org.xml.sax.SAXException;
@Component
public class SDNCServiceRequestConnector extends SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,SDNCServiceRequestConnector.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCServiceRequestConnector.class);
@Override
protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage,
String responseContent, TypedRequestTunables rt) {
try {
return parseResponseContent(responseContent);
} catch (ParseException e) {
- LOGGER.error(e);
+ logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
}catch (Exception e) {
- LOGGER.error(e);
+ logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index deb39ac54e..62233273b1 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -34,12 +36,13 @@ import javax.xml.transform.stream.StreamResult;
import org.apache.http.HttpStatus;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdncrest.RequestInformation;
-import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -48,7 +51,7 @@ import org.w3c.dom.Element;
@Component
public class SDNCServiceRequestTask {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCServiceRequestTask.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCServiceRequestTask.class);
@Autowired
private SDNCServiceRequestConnector connector;
@@ -91,24 +94,8 @@ public class SDNCServiceRequestTask {
long sdncStartTime = System.currentTimeMillis();
SDNCResponseCommon response = connector.send(xml, mappedTunables);
- if (response instanceof SDNCErrorCommon) {
- LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Received success response from SDNC", "SDNC", sdncService + "." + sdncOperation, null);
- } else {
- LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Received error response from SDNC", "SDNC", sdncService + "." + sdncOperation, null);
- }
-
long bpStartTime = System.currentTimeMillis();
boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson());
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", request.getBPNotificationUrl(), null);
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", request.getBPNotificationUrl(), null);
- }
}
private Element addChild(Element parent, String tag) {
@@ -206,8 +193,8 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "content-type", contentType);
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -225,12 +212,12 @@ public class SDNCServiceRequestTask {
transformer.transform(new DOMSource(doc), new StreamResult(writer));
xml = writer.toString();
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "",
- MsoLogger.ErrorCode.DataError, "Exception - domToStr", e);
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - domToStr", e);
return null;
}
- LOGGER.trace("Formatted SDNC service request XML:\n" + xml);
+ logger.trace("Formatted SDNC service request XML:\n {}", xml);
return xml;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 48bc2d84bb..75a0b07643 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +36,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -47,7 +50,7 @@ import org.springframework.stereotype.Component;
@Path("/")
@Component
public class SNIROResponse {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class);
+ private static final Logger logger = LoggerFactory.getLogger(SNIROResponse.class);
@Autowired
@@ -61,34 +64,18 @@ public class SNIROResponse {
@Consumes("*/*")
@Produces({MediaType.TEXT_PLAIN})
public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
- LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/SNIROResponse");
-
- long startTime = System.currentTimeMillis();
+ logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
+ "SDNCNotify/SNIROResponse");
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP,
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
}
-
- long bpStartTime = System.currentTimeMillis();
- boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content);
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification");
- }
-
return Response.status(204).build();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
index 6331d6aaae..4ff6dbc9a6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -22,7 +24,8 @@ package org.onap.so.adapters.sdnc.sdncrest;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.onap.so.adapters.sdnc.impl.Constants;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Typed Request Tunables. Each entry is identified by a TYPE in the property name.
@@ -39,7 +42,7 @@ import org.onap.so.logger.MsoLogger;
*/
public class TypedRequestTunables {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, TypedRequestTunables.class);
+ private static final Logger logger = LoggerFactory.getLogger(TypedRequestTunables.class);
private String reqId;
private String myUrlSuffix;
@@ -82,7 +85,7 @@ public class TypedRequestTunables {
*/
public void setServiceKey(String service, String operation) {
key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation;
- LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key);
+ logger.debug("Generated {} key: {}", getClass().getSimpleName(), key);
}
/**
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
index f2fba5900f..d72775399f 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,7 +22,8 @@
package org.onap.so.adapters.sdnc;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@@ -30,7 +33,7 @@ import java.io.InputStream;
*/
public class FileUtil {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
/**
* Read the specified resource file and return the contents as a String.
@@ -53,7 +56,7 @@ public class FileUtil {
return "";
}
} catch (IOException e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
index ce5637baa3..5d9b7ce558 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (C) 2018 CMCC All rights reserved.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,10 +27,10 @@ import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
-import org.onap.so.logger.MsoLogger;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* NS Create Input Parameter For VFC Adapter<br>
@@ -40,7 +41,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
*/
public class NSResourceInputParameter {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NSResourceInputParameter.class);
+ private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class);
private NsOperationKey nsOperationKey;
@@ -114,7 +115,7 @@ public class NSResourceInputParameter {
mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
return jsonString;
}
@@ -128,7 +129,7 @@ public class NSResourceInputParameter {
marshaller.marshal(this, bs);
return bs.toString();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
index c39a165338..52fd8fb103 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -27,8 +29,8 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@@ -44,7 +46,7 @@ import org.springframework.stereotype.Component;
@Component
public class HealthCheckHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, HealthCheckHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(HealthCheckHandler.class);
private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
@@ -57,8 +59,6 @@ public class HealthCheckHandler {
@Path("/healthcheck")
@Produces("text/html")
public Response healthcheck(@QueryParam("requestId") String requestId) {
- MsoLogger.setServiceName("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, msoLogger);
return HEALTH_CHECK_RESPONSE;
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
index 0f0a14c8f5..db613ea988 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +37,8 @@ import org.onap.so.adapters.vfc.model.NsOperationKey;
import org.onap.so.adapters.vfc.model.RestfulResponse;
import org.onap.so.adapters.vfc.util.JsonUtil;
import org.onap.so.adapters.vfc.util.ValidateUtil;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -52,7 +54,7 @@ import org.springframework.stereotype.Component;
@Path("/v1/vfcadapter")
public class VfcAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class);
+ private static final Logger logger = LoggerFactory.getLogger(VfcAdapterRest.class);
private static final String REQUEST_DEBUG_MSG="body from request is {}";
private static final String APPLICATION_EXCEPTION="ApplicationException: ";
@Autowired
@@ -76,12 +78,12 @@ public class VfcAdapterRest {
public Response createNfvoNs(String data) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
RestfulResponse rsp = driverMgr.createNs(nsInput);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -102,12 +104,12 @@ public class VfcAdapterRest {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -127,12 +129,12 @@ public class VfcAdapterRest {
public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -152,12 +154,12 @@ public class VfcAdapterRest {
public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -177,12 +179,12 @@ public class VfcAdapterRest {
public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -201,16 +203,16 @@ public class VfcAdapterRest {
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response scaleNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
- try {
- ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug("Scale Ns Request Received.Body from request is {}" + data);
- NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput);
- return buildResponse(rsp);
- } catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
- return e.buildErrorResponse();
- }
+ try {
+ ValidateUtil.assertObjectNotNull(data);
+ logger.debug("Scale Ns Request Received.Body from request is {}" + data);
+ NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
+ RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ logger.debug(APPLICATION_EXCEPTION, e);
+ return e.buildErrorResponse();
+ }
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index 64032e25f5..66ed6953a2 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Interface for json analyzing.<br/>
@@ -47,7 +50,7 @@ public class JsonUtil {
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, JsonUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
/**
* Mapper.
@@ -83,7 +86,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -101,7 +104,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -118,7 +121,7 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
"fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index bb7fa70bda..9a23861bf6 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +45,8 @@ import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.vfc.model.RestfulResponse;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -63,7 +66,7 @@ public class RestfulUtil {
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(RestfulUtil.class);
private static final int DEFAULT_TIME_OUT = 60000;
@@ -88,7 +91,7 @@ public class RestfulUtil {
Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
String msbEndpoint = UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString();
- LOGGER.debug("msbEndpoint in vfc adapter: " + msbEndpoint);
+ logger.debug("msbEndpoint in vfc adapter: {}", msbEndpoint);
return msbEndpoint;
}
@@ -99,7 +102,7 @@ public class RestfulUtil {
public RestfulResponse send(String url, String methodType, String content) {
String msbUrl = getMsbHost() + url;
- LOGGER.debug("Begin to sent message " + methodType +": " + msbUrl);
+ logger.debug("Begin to sent message {}: {}", methodType, msbUrl);
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -132,14 +135,6 @@ public class RestfulUtil {
method = httpDelete;
}
- // now VFC have no auth
- // String userCredentials =
- // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
- // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
- // String authorization = "Basic " +
- // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- // method.setHeader("Authorization", authorization);
-
httpResponse = client.execute(method);
String responseContent = null;
@@ -150,7 +145,7 @@ public class RestfulUtil {
int statusCode = httpResponse.getStatusLine().getStatusCode();
String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
- LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
+ logger.debug("VFC Response: {} {}", statusCode, statusMessage
+ (responseContent == null ? "" : System.lineSeparator() + responseContent));
if(httpResponse.getStatusLine().getStatusCode() >= 300) {
@@ -164,7 +159,7 @@ public class RestfulUtil {
if(null != method) {
method.reset();
} else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
method = null;
@@ -185,7 +180,7 @@ public class RestfulUtil {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch(Exception e) {
- LOGGER.debug("Exception :", e);
+ logger.debug("Exception :", e);
}
}
@@ -193,18 +188,20 @@ public class RestfulUtil {
try {
method.reset();
} catch(Exception e) {
- LOGGER.debug("Exception :", e);
+ logger.debug("Exception :", e);
}
}
}
}
private static void logError(String errMsg, Throwable t) {
- LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
+ logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
- LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
+ logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ MsoLogger.ErrorCode.AvailabilityError.toString(), errMsg);
}
private static RestfulResponse createResponse(int statusCode, String content) {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
index 286526445c..ede515650e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,14 +22,14 @@
package org.onap.so.bpmn.core;
-import org.onap.so.logger.MsoLogger;
-import org.jboss.logging.MDC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class BPMNLogger {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BPMNLogger.class);
+ private static Logger logger = LoggerFactory.getLogger(BPMNLogger.class);
public static void debug (String isDebugLogEnabled, String LogText) {
- msoLogger.debug(LogText);
+ logger.debug(LogText);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
index 5100085020..0c88e3ed88 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -23,7 +25,8 @@ package org.onap.so.bpmn.core;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
@@ -36,7 +39,7 @@ import org.springframework.stereotype.Component;
@Component
@Configuration
public class UrnPropertiesReader {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,UrnPropertiesReader.class);
+ private static final Logger logger = LoggerFactory.getLogger(UrnPropertiesReader.class);
private static Environment environment;
@Autowired
@@ -56,13 +59,15 @@ public class UrnPropertiesReader {
public static String getVariable(String variableName, DelegateExecution execution) {
Object value = execution.getVariable(variableName);
if (value != null) {
- LOGGER.trace("Retrieved value for the URN variable, " + variableName + ", from the execution object: " + String.valueOf(value));
+ logger.trace("Retrieved value for the URN variable, {}, from the execution object: {}", variableName,
+ String.valueOf(value));
return String.valueOf(value);
}
String variableValue = null;
if (environment != null && environment.getProperty(variableName) != null) {
variableValue = environment.getProperty(variableName);
- LOGGER.trace("Retrieved value for the URN variable, " + variableName + ", from the environment variable: " + variableValue);
+ logger.trace("Retrieved value for the URN variable, {}, from the environment variable: {}", variableName,
+ variableValue);
execution.setVariable(variableName, variableValue);
return variableValue;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
index a725933024..c3eefcd3cd 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -34,10 +36,9 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.onap.so.logger.MsoLogger;
-//import com.fasterxml.jackson.map.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -49,7 +50,7 @@ import org.onap.so.logger.MsoLogger;
@JsonInclude(Include.NON_NULL)
public abstract class JsonWrapper implements Serializable {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, JsonWrapper.class);
+ private static final Logger logger = LoggerFactory.getLogger(JsonWrapper.class);
@JsonInclude(Include.NON_NULL)
public String toJsonString(){
@@ -65,7 +66,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e){
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
return jsonString;
}
@@ -79,13 +80,13 @@ public abstract class JsonWrapper implements Serializable {
try {
json = new JSONObject(mapper.writeValueAsString(this));
} catch (JsonGenerationException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
} catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
} catch (JSONException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
} catch (IOException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
return json;
}
@@ -98,11 +99,11 @@ public abstract class JsonWrapper implements Serializable {
try {
jsonString = mapper.writeValueAsString(list);
} catch (JsonGenerationException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
} catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
} catch (IOException e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
return jsonString;
}
@@ -120,7 +121,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e){
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
return jsonString;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java
index be7851362c..89f61fec75 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -29,14 +31,15 @@ import org.onap.so.bpmn.core.domain.NetworkResource;
import org.onap.so.bpmn.core.domain.ServiceDecomposition;
import org.onap.so.bpmn.core.domain.ServiceInstance;
import org.onap.so.bpmn.core.domain.VnfResource;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DecomposeJsonUtil implements Serializable {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeJsonUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(DecomposeJsonUtil.class);
/**
*
*/
@@ -140,4 +143,4 @@ public class DecomposeJsonUtil implements Serializable {
throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index 35f76908e3..ccc5ea667e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -37,7 +39,6 @@ import org.json.JSONObject;
import org.json.XML;
import org.onap.so.bpmn.core.xml.XmlTool;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.fge.jackson.JsonLoader;
@@ -45,6 +46,8 @@ import com.github.fge.jsonschema.core.exceptions.ProcessingException;
import com.github.fge.jsonschema.core.report.ProcessingReport;
import com.github.fge.jsonschema.main.JsonSchemaFactory;
import com.github.fge.jsonschema.main.JsonValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility class for JSON processing
@@ -59,7 +62,7 @@ import com.github.fge.jsonschema.main.JsonValidator;
*/
public class JsonUtils {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, JsonUtils.class);
+ private static Logger logger = LoggerFactory.getLogger(JsonUtils.class);
private static int MSOJsonIndentFactor = 3;
/**
@@ -80,7 +83,7 @@ public class JsonUtils {
return jsonObj.toString(MSOJsonIndentFactor);
}
} catch (Exception e){
- msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString(), e);
+ logger.debug("xml2json(): unable to parse xml and convert to json. Exception was: {}", e.toString(), e);
return null;
}
}
@@ -110,16 +113,14 @@ public class JsonUtils {
try {
JSONObject jsonObj = new JSONObject(jsonStr);
if (pretty) {
-// return XmlTool.normalize(XML.toString(jsonObj));
// use the local class method which properly handles certain JSONArray content
return XmlTool.normalize(toXMLString(jsonObj, null));
} else {
-// return XML.toString(jsonObj);
// use the local class method which properly handles certain JSONArray content
return toXMLString(jsonObj, null);
}
} catch (Exception e){
- msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString(), e);
+ logger.debug("json2xml(): unable to parse json and convert to xml. Exception was: {}", e.toString(), e);
return null;
}
}
@@ -144,10 +145,8 @@ public class JsonUtils {
String str;
Object curObj;
if (obj instanceof JSONObject) {
- // msoLogger.debug("toXMLString(): is a JSONObject");
// append "<tagName>" to the XML output
if (tagName != null) {
-// msoLogger.debug("toXMLString(): adding opening tagName: " + tagName);
strBuf.append("<");
strBuf.append(tagName);
strBuf.append(">");
@@ -157,7 +156,6 @@ public class JsonUtils {
keys = jsonObj.keys();
while (keys.hasNext()) {
key = keys.next();
- // msoLogger.debug("toXMLString(): key is " + k);
curObj = jsonObj.opt(key);
if (curObj == null) {
curObj = "";
@@ -185,7 +183,6 @@ public class JsonUtils {
} else if (curObj instanceof JSONArray) {
jsonArr = (JSONArray) curObj;
len = jsonArr.length();
-// msoLogger.debug("toXMLString(): found JSONArray: " + key + ", size: " + len);
for (i = 0; i < len; i += 1) {
curObj = jsonArr.get(i);
if (curObj instanceof JSONArray) {
@@ -199,7 +196,6 @@ public class JsonUtils {
// strBuf.append(key);
// strBuf.append(">");
} else {
-// msoLogger.debug("toXMLString(): recursive call toXML() with tagName null");
// append the opening tag for the array (before 1st element)
if (i == 0) {
strBuf.append("<");
@@ -222,14 +218,11 @@ public class JsonUtils {
strBuf.append(key);
strBuf.append("/>");
} else {
-// msoLogger.debug("toXMLString(): recursive call toXMLString() with tagName: " + key);
strBuf.append(toXMLString(curObj, key));
}
- // msoLogger.debug("toXML(): partial XML: " + strBuf.toString());
}
if (tagName != null) {
// append the closing tag "</tagName>" to the XML output
-// msoLogger.debug("toXMLString(): adding closing tagName: " + tagName);
strBuf.append("</");
strBuf.append(tagName);
strBuf.append(">");
@@ -247,7 +240,6 @@ public class JsonUtils {
}
return strBuf.toString();
} else {
-// msoLogger.debug("toXML(): in else block with tagName: " + tagName);
str = (obj == null) ? "null" : XML.escape(obj.toString());
return (tagName == null) ? "\"" + str + "\""
: (str.length() == 0) ? "<" + tagName + "/>" : "<"
@@ -272,12 +264,11 @@ public class JsonUtils {
* @return String containing the formatted JSON doc
*/
public static String prettyJson(String jsonStr) {
-// String isDebugLogEnabled = "true";
try {
JSONObject jsonObj = new JSONObject(jsonStr);
return jsonObj.toString(MSOJsonIndentFactor);
} catch (Exception e){
- msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString(), e);
+ logger.debug("prettyJson(): unable to parse/format json input. Exception was: {}", e.toString(), e);
return null;
}
}
@@ -332,22 +323,22 @@ public class JsonUtils {
* @return String field value associated with keys
*/
public static String getJsonValue(String jsonStr, String keys) {
-// String isDebugLogEnabled = "true";
try {
Object rawValue = getJsonRawValue(jsonStr, keys);
if (rawValue == null) {
return null;
} else {
if (rawValue instanceof String) {
- msoLogger.debug("getJsonValue(): the raw value is a String Object=" + rawValue);
+ logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- msoLogger.debug("getJsonValue(): the raw value is NOT a String Object=" + rawValue.toString());
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
return rawValue.toString();
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ logger.debug("getJsonValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
return null;
}
@@ -361,22 +352,22 @@ public class JsonUtils {
* @return String field value associated with keys
*/
public static String getJsonNodeValue(String jsonStr, String keys) {
-// String isDebugLogEnabled = "true";
try {
Object rawValue = getJsonRawValue(jsonStr, keys, true);
if (rawValue == null) {
return null;
} else {
if (rawValue instanceof String) {
- msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + rawValue);
+ logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString());
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
return rawValue.toString();
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString(), e);
+ logger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
return null;
}
@@ -393,22 +384,22 @@ public class JsonUtils {
* @return String field value associated with keys
*/
public static int getJsonIntValue(String jsonStr, String keys) {
-// String isDebugLogEnabled = "true";
try {
Object rawValue = getJsonRawValue(jsonStr, keys);
if (rawValue == null) {
return 0;
} else {
if (rawValue instanceof Integer) {
- msoLogger.debug("getJsonIntValue(): the raw value is an Integer Object=" + ((String) rawValue).toString());
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", ((String) rawValue).toString());
return (Integer) rawValue;
} else {
- msoLogger.debug("getJsonIntValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
return 0;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonIntValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ logger.debug("getJsonIntValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
return 0;
}
@@ -428,15 +419,16 @@ public class JsonUtils {
return false;
} else {
if (rawValue instanceof Boolean) {
- msoLogger.debug("getJsonBooleanValue(): the raw value is a Boolean Object=" + rawValue);
+ logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
return (Boolean) rawValue;
} else {
- msoLogger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue.toString());
return false;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ logger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
return false;
}
@@ -467,28 +459,26 @@ public class JsonUtils {
* @return String param value associated with field name
*/
public static String getJsonParamValue(String jsonStr, String keys, String name, int index) {
-// String isDebugLogEnabled = "true";
try {
Object rawValue = getJsonRawValue(jsonStr, keys);
if (rawValue == null) {
return null;
} else {
if (rawValue instanceof JSONArray) {
- msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + rawValue.toString());
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
int arrayLen = ((JSONArray) rawValue).length();
if (index < 0 || arrayLen < index+1) {
- msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen);
+ logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index, arrayLen);
return null;
}
int foundCnt = 0;
for (int i = 0; i < arrayLen; i++) {
- msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString());
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i).toString());
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
-// msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject");
JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
if (parmValue != null) {
- msoLogger.debug("getJsonParamValue(): found value: " + parmValue + " for name: " + name + " and index: " + i);
+ logger.debug("getJsonParamValue(): found value: {} for name: {} and index: {}", parmValue, name, i);
if (foundCnt == index) {
return parmValue;
} else {
@@ -499,23 +489,24 @@ public class JsonUtils {
continue;
}
} else {
- msoLogger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject=" + rawValue.toString());
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue.toString());
return null;
}
}
- msoLogger.debug("getJsonParamValue(): content value NOT found for name: " + name);
+ logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
return null;
} else {
- msoLogger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object=" + rawValue.toString());
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue.toString());
return null;
}
}
} catch (Exception e) {
- // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("getJsonParamValue(): failed to retrieve param value for keys:" + keys + ", name=" + name + ": " + e.getMessage());
+ logger.debug("getJsonParamValue(): failed to retrieve param value for keys:{}, name={} : {}", keys, name,
+ e.getMessage());
} else {
- msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ logger.debug("getJsonParamValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
}
return null;
@@ -535,7 +526,8 @@ public class JsonUtils {
JSONObject jsonObj = new JSONObject(jsonStr);
return getJsonValueForKey(jsonObj, key);
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
+ logger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}", key,
+ e.toString(), e);
}
return null;
}
@@ -554,37 +546,34 @@ public class JsonUtils {
try {
if (jsonObj.has(key)) {
Object value = jsonObj.get(key);
- msoLogger.debug("getJsonValueForKey(): found value=" + (String) value + ", for key=" + key);
+ logger.debug("getJsonValueForKey(): found value={}, for key={}", (String) value, key);
if (value == null) {
return null;
} else {
return ((String) value);
}
} else {
-// msoLogger.debug("getJsonValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
-// msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call on: " +
-// ((JSONObject) obj).toString(MSOJsonIndentFactor));
keyValue = getJsonValueForKey((JSONObject) obj, key);
if (keyValue != null) {
-// msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
+ logger.debug("getJsonValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
}
}
}
} catch (Exception e) {
// JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("getJsonValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ logger.debug("getJsonValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
} else {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
+ logger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was {}", key,
+ e.toString(), e);
}
keyValue = null;
}
@@ -600,37 +589,34 @@ public class JsonUtils {
* @return String field value associated with key
*/
public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) {
-// String isDebugLogEnabled = "true";
Integer keyValue = null;
try {
if (jsonObj.has(key)) {
Integer value = (Integer) jsonObj.get(key);
- msoLogger.debug("getJsonIntValueForKey(): found value=" + value + ", for key=" + key);
+ logger.debug("getJsonIntValueForKey(): found value={}, for key={}", value, key);
return value;
} else {
-// msoLogger.debug("getJsonIntValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
-// msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonIntValueForKey((JSONObject) obj, key);
if (keyValue != null) {
-// msoLogger.debug("getJsonIntValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
- msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
+ logger.debug("getJsonIntValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
}
}
}
} catch (Exception e) {
// JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("getJsonIntValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ logger.debug("getJsonIntValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
} else {
- msoLogger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ logger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}", key,
+ e.toString(), e);
}
keyValue = null;
}
@@ -650,32 +636,30 @@ public class JsonUtils {
try {
if (jsonObj.has(key)) {
Boolean value = (Boolean) jsonObj.get(key);
- msoLogger.debug("getJsonBooleanValueForKey(): found value=" + value + ", for key=" + key);
+ logger.debug("getJsonBooleanValueForKey(): found value={}, for key={}", value, key);
return value;
} else {
-// msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
-// msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonBooleanValueForKey((JSONObject) obj, key);
if (keyValue != null) {
-// msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
- msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
+ logger.debug("getJsonBooleanValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
}
}
}
} catch (Exception e) {
// JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ logger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
} else {
- msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ logger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ key, e.toString(), e);
}
keyValue = null;
}
@@ -714,7 +698,7 @@ public class JsonUtils {
if (!jsonValueExists(jsonStr, keys)) {
return putJsonValue(jsonStr, keys, value);
} else {
- msoLogger.debug("addJsonValue(): JSON add failed, key=" + keys + "/value=" + value + " already exists");
+ logger.debug("addJsonValue(): JSON add failed, key={}/value={} already exists", keys, value);
return jsonStr;
}
}
@@ -730,12 +714,11 @@ public class JsonUtils {
* @return String containing the updated JSON doc
*/
public static String updJsonValue(String jsonStr, String keys, String newValue) {
-// String isDebugLogEnabled = "true";
// only attempt to modify the key/value pair if it exists
if (jsonValueExists(jsonStr, keys)) {
return putJsonValue(jsonStr, keys, newValue);
} else {
- msoLogger.debug("updJsonValue(): JSON update failed, no value exists for key=" + keys);
+ logger.debug("updJsonValue(): JSON update failed, no value exists for key={}", keys);
return jsonStr;
}
}
@@ -756,7 +739,7 @@ public class JsonUtils {
// passing a null value results in a delete
return putJsonValue(jsonStr, keys, null);
} else {
- msoLogger.debug("delJsonValue(): JSON delete failed, no value exists for key=" + keys);
+ logger.debug("delJsonValue(): JSON delete failed, no value exists for key={}", keys);
return jsonStr;
}
}
@@ -797,11 +780,10 @@ public class JsonUtils {
keyStr = keyTokens.nextToken();
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
-// msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
if (keyTokens.hasMoreElements()) {
- msoLogger.debug("getJsonRawValue(): value found prior to last key for key=" + keyStr);
+ logger.debug("getJsonRawValue(): value found prior to last key for key={}", keyStr);
}
return keyValue;
}
@@ -822,9 +804,10 @@ public class JsonUtils {
} catch (Exception e) {
// JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("getJsonRawValue(): failed to retrieve param value for key=" + keyStr + ": " + e.getMessage());
+ logger.debug("getJsonRawValue(): failed to retrieve param value for key={}: {}", keyStr, e.getMessage());
} else {
- msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ logger.debug("getJsonRawValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
}
}
return null;
@@ -849,10 +832,9 @@ public class JsonUtils {
if (keyTokens.hasMoreElements()) {
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
-// msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
- msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue);
+ logger.debug("putJsonValue(): key={} not the last key but points to non-json object: {}", keyStr, keyValue);
return null;
}
} else { // at the last/new key value
@@ -866,9 +848,10 @@ public class JsonUtils {
} catch (Exception e) {
// JSONObject::get() throws a "not found" exception if one of the specified keys is not found
if (e.getMessage().contains("not found")) {
- msoLogger.debug("putJsonValue(): failed to put param value for key=" + keyStr + ": " + e.getMessage());
+ logger.debug("putJsonValue(): failed to put param value for key={}: {}", keyStr, e.getMessage());
} else {
- msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e);
+ logger.debug("putJsonValue(): unable to parse json to put value for key={}. Exception was: {}", keys, e.toString(),
+ e);
}
}
return null;
@@ -884,7 +867,7 @@ public class JsonUtils {
* @return Map - a Map containing the entries
*/
public Map<String, String> jsonStringToMap(DelegateExecution execution, String entry) {
- msoLogger.debug("Started Json String To Map Method");
+ logger.debug("Started Json String To Map Method");
Map<String, String> map = new HashMap<>();
@@ -900,8 +883,8 @@ public class JsonUtils {
final String key = keys.next();
map.put(key, obj.getString(key));
}
- msoLogger.debug("Outgoing Map is: " + map);
- msoLogger.debug("Completed Json String To Map Method");
+ logger.debug("Outgoing Map is: {}", map);
+ logger.debug("Completed Json String To Map Method");
return map;
}
@@ -917,7 +900,7 @@ public class JsonUtils {
*
*/
public Map<String, String> entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) {
- msoLogger.debug("Started Entry Array To Map Util Method");
+ logger.debug("Started Entry Array To Map Util Method");
Map<String, String> map = new HashMap<>();
//Populate Map
@@ -930,7 +913,7 @@ public class JsonUtils {
String value = jo.get(valueNode).toString();
map.put(key, value);
}
- msoLogger.debug("Completed Entry Array To Map Util Method");
+ logger.debug("Completed Entry Array To Map Util Method");
return map;
}
@@ -945,7 +928,7 @@ public class JsonUtils {
*
*/
public Map<String, String> entryArrayToMap(String entryArray, String keyNode, String valueNode){
- msoLogger.debug("Started Entry Array To Map Util Method");
+ logger.debug("Started Entry Array To Map Util Method");
Map<String, String> map = new HashMap<>();
String entryListJson = "{ \"wrapper\":" + entryArray + "}";
@@ -957,7 +940,7 @@ public class JsonUtils {
String value = jo.get(valueNode).toString();
map.put(key, value);
}
- msoLogger.debug("Completed Entry Array To Map Util Method");
+ logger.debug("Completed Entry Array To Map Util Method");
return map;
}
@@ -972,7 +955,7 @@ public class JsonUtils {
* @author cb645j
*/
public List<String> StringArrayToList(Execution execution, String jsonArray){
- msoLogger.debug("Started String Array To List Util Method");
+ logger.debug("Started String Array To List Util Method");
List<String> list = new ArrayList<>();
// Populate List
@@ -984,8 +967,8 @@ public class JsonUtils {
String s = arr.get(i).toString();
list.add(s);
}
- msoLogger.debug("Outgoing List is: " + list);
- msoLogger.debug("Completed String Array To List Util Method");
+ logger.debug("Outgoing List is: {}", list);
+ logger.debug("Completed String Array To List Util Method");
return list;
}
@@ -999,7 +982,7 @@ public class JsonUtils {
* @author cb645j
*/
public List<String> StringArrayToList(String jsonArray){
- msoLogger.debug("Started Json Util String Array To List");
+ logger.debug("Started Json Util String Array To List");
List<String> list = new ArrayList<>();
JSONArray arr = new JSONArray(jsonArray);
@@ -1007,7 +990,7 @@ public class JsonUtils {
String s = arr.get(i).toString();
list.add(s);
}
- msoLogger.debug("Completed Json Util String Array To List");
+ logger.debug("Completed Json Util String Array To List");
return list;
}
@@ -1021,14 +1004,14 @@ public class JsonUtils {
* @author cb645j
*/
public List<String> StringArrayToList(JSONArray jsonArray){
- msoLogger.debug("Started Json Util String Array To List");
+ logger.debug("Started Json Util String Array To List");
List<String> list = new ArrayList<>();
for(int i = 0; i < jsonArray.length(); i++){
String s = jsonArray.get(i).toString();
list.add(s);
}
- msoLogger.debug("Completed Json Util String Array To List");
+ logger.debug("Completed Json Util String Array To List");
return list;
}
@@ -1050,7 +1033,7 @@ public class JsonUtils {
return !(rawValue == null);
} catch(Exception e){
- msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(), e);
+ logger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: {}", e.toString(), e);
}
return true;
}
@@ -1065,22 +1048,21 @@ public class JsonUtils {
*/
public static String jsonSchemaValidation(String jsonStr, String jsonSchemaPath) throws ValidationException {
try {
- msoLogger.debug("JSON document to be validated: " + jsonStr);
+ logger.debug("JSON document to be validated: {}", jsonStr);
JsonNode document = JsonLoader.fromString(jsonStr);
-// JsonNode document = JsonLoader.fromFile(jsonDoc);
JsonNode schema = JsonLoader.fromPath(jsonSchemaPath);
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
JsonValidator validator = factory.getValidator();
ProcessingReport report = validator.validate(schema, document);
- msoLogger.debug("JSON schema validation report: " + report.toString());
+ logger.debug("JSON schema validation report: {}", report.toString());
return report.toString();
} catch (IOException e) {
- msoLogger.debug("IOException performing JSON schema validation on document: " + e.toString());
+ logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
throw new ValidationException(e.getMessage());
} catch (ProcessingException e) {
- msoLogger.debug("ProcessingException performing JSON schema validation on document: " + e.toString());
+ logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
throw new ValidationException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
index d7a9ff1cf7..7632831111 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -139,7 +139,7 @@ public class GeneralTopologyObjectMapper {
vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
}
else {
- vfModuleInformation.setFromPreload(null);
+ vfModuleInformation.setFromPreload(false);
}
return vfModuleInformation;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
index c039e308f8..bf2cd347c0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -361,7 +361,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup {
assertNull(gcRequestInput.getOnapModelInformation());
assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
assertNotNull(gcRequestInput.getVfModuleId());
- assertNull(gcRequestInput.getFromPreload());
+ assertFalse(gcRequestInput.getFromPreload());
}
@Test
@@ -385,7 +385,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup {
assertNull(gcRequestInput.getOnapModelInformation());
assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
assertNotNull(gcRequestInput.getVfModuleId());
- assertNull(gcRequestInput.getFromPreload());
+ assertFalse(gcRequestInput.getFromPreload());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
index f06d72a806..cecb4c1dc7 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -22,7 +22,7 @@
},
"vf-module-information" : {
"vf-module-id" : "testVfModuleId",
- "from-preload": null
+ "from-preload": false
},
"vnf-information" : {
"vnf-id" : "testVnfId",
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
index ee15e10e01..fecbf59c36 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -60,16 +60,18 @@ public class AAISingleTransactionClient extends GraphInventoryTransactionClient<
*/
@Override
public void execute() throws BulkProcessFailed {
- RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
try {
- SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class);
- if (response != null) {
- final Optional<String> errorMessage = this.locateErrorMessages(response);
- if (errorMessage.isPresent()) {
- throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ if (!this.request.getOperations().isEmpty()) {
+ RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
+ SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class);
+ if (response != null) {
+ final Optional<String> errorMessage = this.locateErrorMessages(response);
+ if (errorMessage.isPresent()) {
+ throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ }
+ } else {
+ throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
- } else {
- throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
} finally {
this.request.getOperations().clear();
diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 474ae89ff9..9fb6cd7706 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -82,16 +82,18 @@ public class AAITransactionalClient extends GraphInventoryTransactionClient<AAIT
*/
@Override
public void execute() throws BulkProcessFailed {
- RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
try {
- Response response = client.put(this.transactions);
- if (response.hasEntity()) {
- final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
- if (errorMessage.isPresent()) {
- throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ if (!this.transactions.getTransactions().isEmpty()) {
+ RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
+ Response response = client.put(this.transactions);
+ if (response.hasEntity()) {
+ final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
+ if (errorMessage.isPresent()) {
+ throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ }
+ } else {
+ throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
- } else {
- throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
} finally {
this.transactions.getTransactions().clear();
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
index 8d1a945c1b..4c228b2ea3 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -84,10 +84,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
if(!this.exists(uri)){
if (obj.isPresent()) {
this.create(uri, obj.get());
- incrementActionAmount();
} else {
this.createEmpty(uri);
- incrementActionAmount();
}
}
@@ -194,7 +192,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
protected abstract boolean exists(Uri uri);
protected abstract String getGraphDBName();
-
+
/**
* @param obj - can be any object which will marshal into a valid A&AI payload
* @param uri
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
index 0b438a1b17..edb92ef68b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
@@ -21,8 +21,6 @@
package org.onap.so.apihandlerinfra.validation;
-import java.util.Map;
-
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.exceptions.ValidationException;
@@ -75,7 +73,7 @@ public class RequestParametersValidation implements ValidationRule{
if(action == Action.createInstance || action == Action.updateInstance){
if(requestParameters.isUsePreload() == null){
if(reqVersion >= 4){
- if (requestParameters.getALaCarte() == false) {
+ if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == false) {
requestParameters.setUsePreload(false);
}
else {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
index 3fc5a16d9d..2813ef7b70 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
@@ -55,6 +55,21 @@ public class RequestParametersValidationTest extends BaseTest{
}
@Test
+ public void testVfModuleWithNoALaCarte() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance,
+ 6, false, sir.getRequestDetails().getRequestParameters());
+ info.setRequestScope("vfModule");
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ RequestParametersValidation validation = new RequestParametersValidation();
+ validation.validate(info);
+
+ assertFalse(info.getReqParameters().getUsePreload());
+ }
+
+ @Test
public void testVfModuleWithTrueALaCarte() throws IOException, ValidationException {
String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.json")));
ObjectMapper mapper = new ObjectMapper();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json
new file mode 100644
index 0000000000..304065f930
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json
@@ -0,0 +1,55 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "InframsoVsamp10a2..vSAMP10a_addon_2..module-1",
+ "modelVersionId": "dcd3d939-67cd-438c-a55f-48073811f83f",
+ "modelInvariantId": "b42d49f3-6429-4c2e-a73c-29bef87ca1b9",
+ "modelVersion": "1",
+ "modelCustomizationId": "3bec51f8-b410-40f5-b470-25d31f7210dc"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "CloudOwner",
+ "lcpCloudRegionId": "mtn6",
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8"
+ },
+ "requestInfo": {
+ "instanceName": "InfraMSO-vSAMP10a_6.0-VF-Module_1-1902-est01-GR_API-101",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "bs7527"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "43075e6e-4d95-4bca-b9e5-712d0a14fbc2",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "InfraMSO_vSAMP10a_Service",
+ "modelVersionId": "8f6fba78-8eab-4149-8be1-491ef7f63cf7",
+ "modelInvariantId": "653030db-85e2-4bd1-8c61-3764ebf5860a",
+ "modelVersion": "6.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "7c1ff5bc-fb41-48a7-b997-f9fdb3ab4a77",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelName": "InfraMSO_vSAMP10a-2",
+ "modelVersionId": "cb79c25f-b30d-4d95-afb5-97be4021f3db",
+ "modelInvariantId": "e93d3a7a-446d-486b-ae48-d474a9156064",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "034226ae-879a-46b5-855c-d02babcb6cb6",
+ "modelCustomizationName": "InfraMSO_vSAMP10a-2 0"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "testApi": "GR_API",
+ "userParams": []
+ }
+ }
+}