From bf26eb2128ea7b77d6cbe6091deed50cd473035a Mon Sep 17 00:00:00 2001 From: Witold Ficio Kopel Date: Thu, 21 Mar 2019 11:54:04 +0100 Subject: 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 --- .../onap/so/bpmn/common/scripts/CatalogDbUtils.groovy | 18 +++++++++--------- .../bpmn/common/scripts/CatalogDbUtilsFactory.groovy | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') 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()) } } -- cgit 1.2.3-korg