Build sanity docker execute automation

Change-Id: Iab282ea167d12fba4a3f425a5d300397ab435b44
Issue-Id: SDC-315
Signed-off-by: Michael Lando <ml636r@att.com>
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
index cfd132d..ad1e8dd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
@@ -20,20 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.api;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.Status;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanVertex;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.ImmutableTriple;
@@ -46,11 +39,7 @@
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-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.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -59,26 +48,21 @@
 import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
-import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.slf4j.LoggerFactory;
 import org.testng.ITestContext;
 import org.testng.ITestResult;
 import org.testng.annotations.*;
 
-import com.aventstack.extentreports.ExtentTest;
-import com.aventstack.extentreports.Status;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.*;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
 
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 
 public abstract class ComponentBaseTest {
 
@@ -138,18 +122,22 @@
 	@BeforeMethod(alwaysRun = true)
 	public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
 
-      
-    boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
-	String className = method.getDeclaringClass().getName();
-		if (emptyDataProvider && !className.contains("ToscaValidationTest") ) {
-			System.out.println("ExtentReport instance started from BeforeMethod...");
-			String suiteName = ExtentManager.getSuiteName(context);
+
+		    String suiteName = ExtentManager.getSuiteName(context);
 			ExtentTestManager.startTest(method.getName());
 			ExtentTestManager.assignCategory(this.getClass());
-			
-		} else {
-			System.out.println("ExtentReport instance started from Test...");
-		}
+      
+//    boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
+//	String className = method.getDeclaringClass().getName();
+//		if (emptyDataProvider)  {
+//			System.out.println("ExtentReport instance started from BeforeMethod...");
+//			String suiteName = ExtentManager.getSuiteName(context);
+//			ExtentTestManager.startTest(method.getName());
+//			ExtentTestManager.assignCategory(this.getClass());
+//
+//		} else {
+//			System.out.println("ExtentReport instance started from Test...");
+//		}
       
 
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
index 2b341f5..ec83b05 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
@@ -115,8 +115,8 @@
 		ExtentTestActions.log(Status.INFO, String.format("Certify Service"));
 		service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
 
-		ExtentTestActions.log(Status.INFO, String.format("Distribute Service"));
-		AtomicOperationUtils.distributeService(service, true);
+//		ExtentTestActions.log(Status.INFO, String.format("Distribute Service"));
+//		AtomicOperationUtils.distributeService(service, true);
 		
 		ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
index 77be6df..b82e6a0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
@@ -284,7 +284,7 @@
 	public static void deleteDirectory(String directoryPath) {
 		File dir = new File(directoryPath);
 		try {
-			FileUtils.deleteDirectory(dir);
+			FileUtils.cleanDirectory(dir);
 		} catch (IOException e) {
 			System.out.println("Failed to delete " + dir);
 			ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
index a1838b6..f6d3e58 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -39,24 +39,16 @@
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.ExtentTestActions;
 import org.openecomp.sdc.ci.tests.config.Config;
-
 import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
-import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
-
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
-
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 
-import org.testng.Assert;
-
 import java.io.*;
 import java.nio.file.FileSystems;
 import java.util.*;
-import java.util.stream.Collectors;
 
 import static org.testng.AssertJUnit.assertEquals;
 
@@ -493,7 +485,7 @@
 		jObject.put("description", "new VSP description");
 		jObject.put("category", "resourceNewCategory.generic");
 		jObject.put("subCategory", "resourceNewCategory.generic.database");
-		jObject.put("onboardingMethod", "HEAT");
+		jObject.put("onboardingMethod", "NetworkPackage");
 		jObject.put("licensingVersion", jlicensingVersionObj);
 		jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
 		jObject.put("vendorId", amdocsLicenseMembers.getVendorId());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
index 22a352c..39afff9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
@@ -372,7 +372,7 @@
 			String userRemarks, DistributionStatusEnum reqDistributionStatus) throws Exception {
 		String uniqueId = serviceDetails.getUniqueId();
 		Config config = Utils.getConfig();
-		String environmentName = "PROD-Andreys-Only";
+		String environmentName = "AUTO";
 //		String environmentName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0);
 		DistributionStatusEnum distributionStatusEnum = DistributionStatusEnum.findState(reqDistributionStatus.getValue());
 		switch(distributionStatusEnum){
diff --git a/test-apis-ci/src/main/resources/ci/testSuites/onap.xml b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml
new file mode 100644
index 0000000..c075f10
--- /dev/null
+++ b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="2" data-provider-thread-count="2">
+	<test name="ExternalApis"> 
+		<classes>	
+			
+			<class name="org.openecomp.sdc.ci.tests.sanity.Onboard"/>
+
+<!-- 	      <class name="org.openecomp.sdc.ci.tests.execute.product.ChangeServiceInstanceVersionTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCheckinTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCheckoutTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductComponentInstanceCRUDTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCreateWithValidationsTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCrudTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductGetFollowedTest"/>
+			      <class name="org.openecomp.sdc.ci.tests.execute.product.ProductUndoCheckoutTest"/>    -->
+			
+			
+		</classes>
+	</test>
+</suite> 
\ No newline at end of file