Merge "Removed MsoUtils.log() calls from CatalogDbUtils"
authorSteve Smokowski <ss835w@att.com>
Thu, 21 Mar 2019 18:40:40 +0000 (18:40 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 21 Mar 2019 18:40:40 +0000 (18:40 +0000)
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy

index 0d9b3c5..d5b0b31 100644 (file)
@@ -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
        }
index faa0037..bf7d07c 100644 (file)
@@ -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())
     }
 }
index d6a7cf0..d7438f8 100644 (file)
@@ -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