diff options
29 files changed, 236 insertions, 518 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index aa9317c920..0977bf95fb 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -16,7 +16,7 @@ mso: spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml index 954e41aa68..a842c1d56b 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml @@ -14,7 +14,7 @@ mso: spring: datasource: - jdbc-url: jdbc:mariadb://localhost:3307/catalogdb + jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver 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/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 4e8d389998..a68372f833 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -18,7 +18,7 @@ mso: retryMultiplier: 60000 spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver 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-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index 781d49f908..051884d60d 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -77,7 +77,7 @@ mso: queue-capacity: 500 spring: datasource: - jdbc-url: jdbc:mariadb://localhost:3307/catalogdb + jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml index 5a0ef6df74..645a6e9e38 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml @@ -18,7 +18,7 @@ mso: # H2 spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver diff --git a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml index 94a132664e..522e6bb7a3 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml @@ -19,7 +19,7 @@ mso: period: 0
spring:
datasource:
- url: jdbc:mariadb://localhost:3307/requestdb
+ jdbcUrl: jdbc:mariadb://localhost:3307/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
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/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index d3d2c60a37..ee75ffa17d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -8,9 +8,16 @@ mso: spring: datasource: driver-class-name: org.mariadb.jdbc.Driver - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn username: ${DB_USERNAME} password: ${DB_PASSWORD} + flyway: + baselineOnMigrate: true + outOfOrder: true + table: FLYWAY_SCHEMA_HISTORY + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn + user: ${DB_ADMIN_USERNAME} + password: ${DB_ADMIN_PASSWORD} http: multipart: enabled: false diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml index 56a92cbd01..21ad485fdb 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml @@ -157,7 +157,7 @@ sniro: headers.latestVersion: 2 spring: datasource: - url: jdbc:mariadb://localhost:3307/camundabpmn + jdbcUrl: jdbc:mariadb://localhost:3307/camundabpmn username: root password: password driver-class-name: org.mariadb.jdbc.Driver 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/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml index 76e2caaca3..e709758223 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml @@ -29,11 +29,10 @@ mso: spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver - jpa: show-sql: true hibernate: @@ -46,7 +45,7 @@ spring: request: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver 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": [] + } + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml index 88cfd77e8c..712fbf54ca 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml @@ -84,7 +84,7 @@ mso: spring: datasource: - url: jdbc:mariadb://localhost:3307/catalogdb + jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver @@ -107,7 +107,7 @@ spring: role: InfraPortal-Client request: datasource: - url: jdbc:mariadb://localhost:3307/requestdb + jdbcUrl: jdbc:mariadb://localhost:3307/requestdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver |