Remove vulnerable dependency
[sdc.git] / integration-tests / src / test / java / org / onap / sdc / backend / ci / tests / api / ComponentBaseTest.java
index e9986db..9f481de 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -33,8 +33,6 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.onap.sdc.backend.ci.tests.config.Config;
 import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
 import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
@@ -43,6 +41,12 @@ import org.onap.sdc.backend.ci.tests.utils.Utils;
 import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
 import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
 import org.onap.sdc.backend.ci.tests.utils.general.FileHandling;
+import org.onap.sdc.backend.ci.tests.utils.rest.BaseRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.CatalogRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.ProductRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.ResourceRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.ResponseParser;
+import org.onap.sdc.backend.ci.tests.utils.rest.ServiceRestUtils;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.model.Component;
@@ -50,13 +54,8 @@ import org.openecomp.sdc.be.model.Product;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.be.model.User;
-import org.onap.sdc.backend.ci.tests.utils.rest.BaseRestUtils;
-import org.onap.sdc.backend.ci.tests.utils.rest.CatalogRestUtils;
-import org.onap.sdc.backend.ci.tests.utils.rest.ProductRestUtils;
-import org.onap.sdc.backend.ci.tests.utils.rest.ResourceRestUtils;
-import org.onap.sdc.backend.ci.tests.utils.rest.ResponseParser;
-import org.onap.sdc.backend.ci.tests.utils.rest.ServiceRestUtils;
-import org.slf4j.LoggerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.testng.ITestContext;
 import org.testng.ITestResult;
 import org.testng.annotations.AfterMethod;
@@ -66,9 +65,9 @@ import org.testng.annotations.BeforeSuite;
 
 public abstract class ComponentBaseTest {
 
-    protected static Logger logger = LogManager.getLogger(ComponentBaseTest.class);
+    protected static Logger logger = LoggerFactory.getLogger(ComponentBaseTest.class);
 
-    protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
+    protected static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator + "API" + File.separator;
     private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
     public static Config config;
     protected static ITestContext myContext;
@@ -85,7 +84,7 @@ public abstract class ComponentBaseTest {
     }
 
     public ComponentBaseTest() {
-        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+        LoggerContext lc = (LoggerContext) org.slf4j.LoggerFactory.getILoggerFactory();
         lc.getLogger("com.thinkaurelius").setLevel(Level.INFO);
         lc.getLogger("com.datastax").setLevel(Level.INFO);
         lc.getLogger("io.netty").setLevel(Level.INFO);
@@ -108,7 +107,7 @@ public abstract class ComponentBaseTest {
     @BeforeMethod(alwaysRun = true)
     public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
         if (!"onboardVNFShotFlow".equals(method.getName()) &&
-            !"onboardPNFFlow".equals(method.getName()) ) {
+            !"onboardPNFFlow".equals(method.getName())) {
             logger.info("ExtentReport instance started from BeforeMethod...");
             ExtentTestManager.startTest(method.getName());
             ExtentTestManager.assignCategory(this.getClass());
@@ -147,16 +146,18 @@ public abstract class ComponentBaseTest {
     }
 
     public void setLog(String fromDataProvider) {
-        ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "      " + fromDataProvider);
+        ExtentTestManager
+            .startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "      " + fromDataProvider);
         ExtentTestManager.assignCategory(this.getClass());
     }
 
     protected static void performClean() throws Exception {
-        if (!config.getSystemUnderDebug()) {
+        if (!config.isSystemUnderDebug()) {
             deleteCreatedComponents(getCatalogAsMap());
             FileHandling.overWriteExistindDir("target/outputCsar");
         } else {
-            System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ...");
+            System.out.println(
+                "Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ...");
         }
     }
 
@@ -184,16 +185,15 @@ public abstract class ComponentBaseTest {
 
     protected static List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
 
-
         List<String> genericCollection = new ArrayList<>();
-        if(resourcesArrayList.get(0) != null) {
+        if (resourcesArrayList.get(0) != null) {
             ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
             resourcesArrayList.stream().filter(Objects::nonNull).
-                    filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).
-                    filter(f -> f.getUniqueId() != null).
-                    map(Component::getUniqueId).
-                    collect(Collectors.toList()).
-                    forEach((i) -> buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i));
+                filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).
+                filter(f -> f.getUniqueId() != null).
+                map(Component::getUniqueId).
+                collect(Collectors.toList()).
+                forEach((i) -> buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i));
         }
         return genericCollection;
     }
@@ -219,7 +219,6 @@ public abstract class ComponentBaseTest {
 
                     break;
 
-
                 case PRODUCT:
                     RestResponse product = ProductRestUtils.getProduct(i);
                     Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());