summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorWitold Ficio Kopel <w.kopel@samsung.com>2019-03-21 11:54:04 +0100
committerWitold Ficio Kopel <w.kopel@samsung.com>2019-03-21 12:05:45 +0100
commitbf26eb2128ea7b77d6cbe6091deed50cd473035a (patch)
treef893da25b1ec95d727c3b53917541d4624b6ef16 /bpmn
parentb06919e6f39b0e9dcb40e02155f9406460d2f38d (diff)
Removed MsoUtils.log() calls from CatalogDbUtils
Refactored calls to MsoUtils.log() to use logger object already present in the CatalogDbUtils class. In addition the CatalogDbUtils class has been accepting MsoUtils object as parameter to constructor - which is not necessary and not aligned with style in rest of the groovy code. Change-Id: Ib80593294ead5b2779f667d8e58f128e958538f0 Issue-ID: LOG-631 Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy6
3 files changed, 15 insertions, 13 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 0d9b3c5b94..d5b0b31a39 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -51,13 +51,13 @@ class CatalogDbUtils {
private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
- private MsoUtils msoUtils
- private JsonUtils jsonUtils
+ private MsoUtils utils
+ private JsonUtils jsonUtils
static private String defaultDbAdapterVersion = "v2"
- CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) {
+ CatalogDbUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) {
this.httpClientFactory = httpClientFactory
- this.msoUtils = msoUtils
+ this.utils = new MsoUtils()
this.jsonUtils = jsonUtils
}
@@ -105,7 +105,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -488,7 +488,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -500,13 +500,13 @@ class CatalogDbUtils {
String encodedString = null
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
- encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- msoUtils.log("ERROR", dataErrorMessage)
+ logger.error(dataErrorMessage)
}
return encodedString
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
index faa0037169..bf7d07cbb3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 NOKIA.
* ================================================================================
+ * 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
@@ -26,6 +28,6 @@ import org.onap.so.client.HttpClientFactory
public class CatalogDbUtilsFactory {
CatalogDbUtils create() {
- return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils())
+ return new CatalogDbUtils(new HttpClientFactory(), new JsonUtils())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d6a7cf0634..d7438f80f9 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
+ * 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
@@ -51,7 +53,6 @@ class CatalogDbUtilsTest {
private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," +
"\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}"
private HttpClientFactory httpClientFactoryMock
- private MsoUtils msoUtilsMock
private JsonUtils jsonUtilsMock
private HttpClient httpClientMock
private DelegateExecutionFake executionFake
@@ -61,11 +62,10 @@ class CatalogDbUtilsTest {
@Before
void setUp() {
httpClientFactoryMock = mock(HttpClientFactory.class)
- msoUtilsMock = mock(MsoUtils.class)
jsonUtilsMock = mock(JsonUtils.class)
httpClientMock = mock(HttpClient.class)
executionFake = new DelegateExecutionFake()
- testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock)
+ testedObject = new CatalogDbUtils(httpClientFactoryMock, jsonUtilsMock)
}
@Test