diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-02-25 13:15:07 +0100 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-02-25 13:15:41 +0100 |
commit | 32a008a60f1fa5031b6b838ea599c28d9819ffb9 (patch) | |
tree | 867cbb738d6cceda999c063509a947fd17f268fe | |
parent | 57af0e334073b329ca9f48b353ab4cc3bd2027a8 (diff) |
Removed MsoLogger in 'mso-catalog-db-adapter'
Removed MsoLogger from adapters ('mso-catalog-db-adapter')
Replaced MsoLogger with plain slf4j.
Refactored login output.
Fixed imports.
Change-Id: Ic61119892e9d4cb41498f2be2a65990f4d51bf0a
Issue-ID: LOG-631
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
3 files changed, 35 insertions, 26 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java index 5acd8359ec..c20acaf967 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.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 @@ -31,7 +33,8 @@ import org.flywaydb.core.api.migration.jdbc.JdbcMigration; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.FileInputStream; import java.io.IOException; @@ -51,7 +54,7 @@ import java.util.Collection; public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoProvider, MigrationChecksumProvider { public static final String FLYWAY = "FLYWAY"; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, R__CloudConfigMigration.class); + private static final Logger logger = LoggerFactory.getLogger(R__CloudConfigMigration.class); @JsonProperty("cloud_config") private CloudConfig cloudConfig; @@ -62,7 +65,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro @Override public void migrate(Connection connection) throws Exception { - LOGGER.debug("Starting migration for CloudConfig"); + logger.debug("Starting migration for CloudConfig"); CloudConfig cloudConfig = null; @@ -87,12 +90,12 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) { cloudConfig = loadCloudConfig(stream); }catch(Exception e){ - LOGGER.warnSimple("Error Loading override.yaml",e); + logger.warn("Error Loading override.yaml", e); } } if (cloudConfig == null) { - LOGGER.debug("No CloudConfig defined in " + configLocation); + logger.debug("No CloudConfig defined in {}", configLocation); // Try the application.yaml file try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) { @@ -100,7 +103,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro } if (cloudConfig == null) { - LOGGER.debug("No CloudConfig defined in " + getApplicationYamlName()); + logger.debug("No CloudConfig defined in {}", getApplicationYamlName()); } } @@ -138,7 +141,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro } private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws SQLException { - LOGGER.debug("Starting migration for CloudConfig-->IdentityService"); + logger.debug("Starting migration for CloudConfig-->IdentityService"); String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " + "VALUES (?,?,?,?,?,?,?,?,?,?);"; @@ -168,7 +171,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro } private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws SQLException { - LOGGER.debug("Starting migration for CloudConfig-->CloudSite"); + logger.debug("Starting migration for CloudConfig-->CloudSite"); String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " + "VALUES (?,?,?,?,?,?,?,?,?);"; diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java index aeee279002..b08b93eb87 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.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 @@ -44,7 +46,8 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.db.catalog.client.CatalogDbClientPortChanger; import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; @@ -61,7 +64,7 @@ public class CvnfcCatalogDbQueryTest { @Autowired private CvnfcCustomizationRepository cvnfcCustomizationRepository; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CvnfcCatalogDbQueryTest.class); + private static final Logger logger = LoggerFactory.getLogger(CvnfcCatalogDbQueryTest.class); @LocalServerPort private int port; diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java index 3154603292..89a7ba3d17 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.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 @@ -40,7 +42,8 @@ import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClientPortChanger; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; @@ -52,7 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner; @ActiveProfiles("test") public class NetworkCollectionCatalogDbQueryTest { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkCollectionCatalogDbQueryTest.class); + private static final Logger logger = LoggerFactory.getLogger(NetworkCollectionCatalogDbQueryTest.class); private static final String NETWORKCOLLECTION = "NetworkCollection"; private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671"; @@ -72,19 +75,19 @@ public class NetworkCollectionCatalogDbQueryTest { @Test @Transactional public void networkCollectionTest() { - msoLogger.debug("TEST IS STARTING UP..."); + logger.debug("TEST IS STARTING UP..."); String modelUUID = "4694a55f-58b3-4f17-92a5-796d6f5ffd0d"; boolean found = false; - msoLogger.debug(Integer.toString(port)); + logger.debug(Integer.toString(port)); InstanceGroup instanceGroup = null; List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupList = null; org.onap.so.db.catalog.beans.Service service = client.getServiceByID(modelUUID); if (service == null) { - msoLogger.debug("null"); + logger.debug("null"); } else { List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations(); if (customizations.isEmpty()) { - msoLogger.debug("No Network Collection found. CollectionResourceCustomizations is empty"); + logger.debug("No Network Collection found. CollectionResourceCustomizations is empty"); } for (CollectionResourceCustomization crc : customizations) { if(client.getNetworkCollectionResourceCustomizationByID(crc.getModelCustomizationUUID()) @@ -95,25 +98,25 @@ public class NetworkCollectionCatalogDbQueryTest { String toscaNodeType = crc.getCollectionResource() .getToscaNodeType(); if (toscaNodeType.contains(NETWORKCOLLECTION)) { - msoLogger.debug("Found a network collection"); + logger.debug("Found a network collection"); instanceGroup = crc.getCollectionResource().getInstanceGroup(); collectionInstanceGroupList = instanceGroup.getCollectionInstanceGroupCustomizations(); CollectionNetworkResourceCustomization collectionNetworkCust = instanceGroup.getCollectionNetworkResourceCustomizations().get(0); - msoLogger.debug("Found Collection Network Resource Customization: " + collectionNetworkCust.getModelCustomizationUUID()); + logger.debug("Found Collection Network Resource Customization: " + collectionNetworkCust.getModelCustomizationUUID()); } else { - msoLogger.debug( + logger.debug( "No Network Collection found. toscaNodeType does not contain NetworkCollection"); } } else { - msoLogger.debug("No Network Collection found. toscaNodeType is null"); + logger.debug("No Network Collection found. toscaNodeType is null"); } } else { - msoLogger.debug("No Network Collection found. collectionResource is null"); + logger.debug("No Network Collection found. collectionResource is null"); } found = true; } else { - msoLogger.debug("Not a Network Collection Resource Customization Instance"); + logger.debug("Not a Network Collection Resource Customization Instance"); } } } @@ -124,11 +127,11 @@ public class NetworkCollectionCatalogDbQueryTest { @Test public void buildingBlockDetailTest() { - msoLogger.debug("TEST IS STARTING UP..."); - msoLogger.debug(Integer.toString(port)); + logger.debug("TEST IS STARTING UP..."); + logger.debug(Integer.toString(port)); String buildingBlockFlowName = "CreateNetworkCollectionBB"; BuildingBlockDetail buildingBlockDetail = client.getBuildingBlockDetail(buildingBlockFlowName); - msoLogger.debug("" + buildingBlockDetail.getResourceType()); + logger.debug("" + buildingBlockDetail.getResourceType()); assertNotNull(buildingBlockDetail); } @@ -148,6 +151,6 @@ public class NetworkCollectionCatalogDbQueryTest { String modelCustId = "1a61be4b-3378-4c9a-91c8-c919519b2d01"; CollectionNetworkResourceCustomization collectionNetworkCust = client.getCollectionNetworkResourceCustomizationByID(modelCustId); assertNotNull(collectionNetworkCust); - msoLogger.debug(collectionNetworkCust.getModelCustomizationUUID()); + logger.debug(collectionNetworkCust.getModelCustomizationUUID()); } } |