diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml
index 5376a03..d76639d 100644
--- a/test-apis-ci/pom.xml
+++ b/test-apis-ci/pom.xml
@@ -29,6 +29,11 @@
             <version>${junit.version}</version>
             <scope>compile</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
         <!--<dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest-core</artifactId>
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
index 337ce9a..f2c295c 100644
--- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
@@ -38,6 +38,6 @@
       :CASSANDRA_PWD => node['cassandra'][:cassandra_password],
       :CASSANDRA_USR => node['cassandra'][:cassandra_user],
       :rep_factor => replication_factor,
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment
+      :DC_NAME      => node['cassandra']['datacenter_name']+node.chef_environment
    })
 end
\ No newline at end of file
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java
index f9752fe..e675676 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java
@@ -20,19 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.api;
 
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.junit.*;
 import org.junit.rules.TestName;
 import org.junit.rules.TestWatcher;
 import org.openecomp.sdc.ci.tests.config.Config;
@@ -43,8 +33,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
 
 public abstract class AttSdcTest {
 
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 1d0b404..c0f209f 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,577 +20,264 @@
 
 package org.openecomp.sdc.ci.tests.api;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
+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.TitanGraph;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.log4j.Logger;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+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;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+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.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.slf4j.LoggerFactory;
+import org.testng.ITestContext;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
 
 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 org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.ImmutableTriple;
-import org.apache.log4j.Logger;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-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.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-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.general.FileHandling;
-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.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 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 {
 
-//	private static Logger logger = LoggerFactory.getLogger(ComponentBaseTest.class.getName());
-	
-	protected static Logger logger= Logger.getLogger(ComponentBaseTest.class);	
-	
+    protected static Logger logger = Logger.getLogger(ComponentBaseTest.class);
 
-//	 public ComponentBaseTest(TestName testName, String className) {
-//	 super(testName, className);
-//	 }
+    protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
+    private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
+    private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
+    protected static TitanGraph titanGraph;
+    public static Config config;
+    protected static ITestContext myContext;
 
-	protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
-	private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
-	private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
-	protected static TitanGraph titanGraph;
-	public static Config config;
-	protected static ITestContext myContext;
-	
-	
-	
-	/**************** METHODS ****************/
-	public static ExtentTest getExtendTest() {
-		SomeInterface testManager = new ExtentTestManager(); 
-		return testManager.getTest();
-	}
 
-	public static enum ComponentOperationEnum {
-		CREATE_COMPONENT, UPDATE_COMPONENT, GET_COMPONENT, DELETE_COMPONENT, CHANGE_STATE_CHECKIN, CHANGE_STATE_CHECKOUT, CHANGE_STATE_UNDO_CHECKOUT
-	};
+    /**************** METHODS ****************/
+    public static ExtentTest getExtendTest() {
+        SomeInterface testManager = new ExtentTestManager();
+        return testManager.getTest();
+    }
 
-	public ComponentBaseTest(TestName name, String name2) {
-		LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
-		lc.getLogger("com.thinkaurelius").setLevel(Level.INFO);
-		lc.getLogger("com.datastax").setLevel(Level.INFO);
-		lc.getLogger("io.netty").setLevel(Level.INFO);
-		lc.getLogger("c.d").setLevel(Level.INFO);
-	}
-	
-	public static String getReportFolder() {
-		return REPORT_FOLDER;
-	}
+    public static enum ComponentOperationEnum {
+        CREATE_COMPONENT, UPDATE_COMPONENT, GET_COMPONENT, DELETE_COMPONENT, CHANGE_STATE_CHECKIN, CHANGE_STATE_CHECKOUT, CHANGE_STATE_UNDO_CHECKOUT
+    }
 
-	@BeforeSuite(alwaysRun = true)
-	public void setupBeforeSuite(ITestContext context) throws Exception {
-		config = Utils.getConfig();
-		myContext=context;
-		ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);	
-		AtomicOperationUtils.createDefaultConsumer(true);
-//		openTitanLogic();
-		performClean();
-		
-		
+    public ComponentBaseTest(TestName name, String name2) {
+        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+        lc.getLogger("com.thinkaurelius").setLevel(Level.INFO);
+        lc.getLogger("com.datastax").setLevel(Level.INFO);
+        lc.getLogger("io.netty").setLevel(Level.INFO);
+        lc.getLogger("c.d").setLevel(Level.INFO);
+    }
 
-	}
-	
-	@BeforeMethod(alwaysRun = true)
-	public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
-		
-		System.out.println(" method.getName() " + method.getName());
-		if (!method.getName().equals("onboardVNFShotFlow"))  {
-//			System.out.println("ExtentReport instance started from BeforeMethod...");
-			logger.info("ExtentReport instance started from BeforeMethod...");
-			ExtentTestManager.startTest(method.getName());
-			ExtentTestManager.assignCategory(this.getClass());
+    public static String getReportFolder() {
+        return REPORT_FOLDER;
+    }
 
-		} else {
-//			System.out.println("ExtentReport instance started from Test...");
-			logger.debug("ExtentReport instance started from Test...");
-		}
-      
-	}
-	
-	@AfterMethod(alwaysRun = true)
-	public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
+    @BeforeSuite(alwaysRun = true)
+    public void setupBeforeSuite(ITestContext context) throws Exception {
+        config = Utils.getConfig();
+        myContext = context;
+        ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);
+        AtomicOperationUtils.createDefaultConsumer(true);
+        performClean();
+    }
 
-		String testName = result.getName();
-		Throwable throwable = result.getThrowable();
-		int status = result.getStatus();
-		
-		switch(status){
-		case ITestResult.SUCCESS:				
-			getExtendTest().log(Status.PASS, "Test Result : <span class='label success'>Success</span>");
-			break;
-				
-		case ITestResult.FAILURE:
-			getExtendTest().log(Status.ERROR, "ERROR - The following exepction occured");
-			getExtendTest().log(Status.ERROR, result.getThrowable());
-			getExtendTest().log(Status.FAIL, "<span class='label failure'>Failure</span>");
-			break;
-			
-		case ITestResult.SKIP:
-			getExtendTest().log(Status.SKIP, "SKIP - The following exepction occured");
-			break;
-		default:
-			break;
-		}
+    @BeforeMethod(alwaysRun = true)
+    public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
 
+        System.out.println(" method.getName() " + method.getName());
+        if (!method.getName().equals("onboardVNFShotFlow")) {
+            logger.info("ExtentReport instance started from BeforeMethod...");
+            ExtentTestManager.startTest(method.getName());
+            ExtentTestManager.assignCategory(this.getClass());
 
-	   	ExtentTestManager.endTest();
-    	
-		
-	}
+        } else {
+            logger.debug("ExtentReport instance started from Test...");
+        }
 
-/*	@AfterClass(alwaysRun = true)
-	public synchronized static void cleanAfterClass() throws Exception{
+    }
 
-//		System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass());
-//		System.out.println("<<<<<<<<class name>>>>>"+method.getName());
+    @AfterMethod(alwaysRun = true)
+    public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
 
+        String testName = result.getName();
+        Throwable throwable = result.getThrowable();
+        int status = result.getStatus();
 
-		System.out.println("delete components AfterClass");
-		if(!config.getSystemUnderDebug()){
-			deleteCreatedComponents(getCatalogAsMap());
-//			CassandraUtils.truncateAllKeyspaces();
-		}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 ...");
-		}
-//		extentReport.flush();
+        switch (status) {
+            case ITestResult.SUCCESS:
+                getExtendTest().log(Status.PASS, "Test Result : <span class='label success'>Success</span>");
+                break;
 
-	}*/
-	
-	@AfterSuite(alwaysRun = true)
-	public static void shutdownTitan() throws Exception {
-		
-		performClean();
-//		shutdownTitanLogic();
+            case ITestResult.FAILURE:
+                getExtendTest().log(Status.ERROR, "ERROR - The following exepction occured");
+                getExtendTest().log(Status.ERROR, result.getThrowable());
+                getExtendTest().log(Status.FAIL, "<span class='label failure'>Failure</span>");
+                break;
 
-	}
-	protected static void openTitanLogic() throws Exception {
-	
-		logger.trace(config.toString());
-		String titanConfigFilePath = config.getTitanPropertiesFile();
-		titanGraph = TitanFactory.open(titanConfigFilePath);
-		assertNotNull(titanGraph);
-		
-	}
+            case ITestResult.SKIP:
+                getExtendTest().log(Status.SKIP, "SKIP - The following exepction occured");
+                break;
+            default:
+                break;
+        }
 
 
-	protected static void shutdownTitanLogic() {
-		if (titanGraph.isOpen()) {
-			titanGraph.close();
-		}
-		CassandraUtils.close();
-	}
+        ExtentTestManager.endTest();
 
-	
 
-	public void setLog(String fromDataProvider) {
+    }
 
-		String suiteName = ExtentManager.getSuiteName(myContext);
-		ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
-		ExtentTestManager.assignCategory(this.getClass());
+    @AfterSuite(alwaysRun = true)
+    public static void shutdownTitan() throws Exception {
+        performClean();
+    }
 
-	}
+    public void setLog(String fromDataProvider) {
 
-	protected static void performClean() throws Exception, FileNotFoundException {
-//		cleanComponents();
-		if(!config.getSystemUnderDebug()){
-			deleteCreatedComponents(getCatalogAsMap());
-//			CassandraUtils.truncateAllKeyspaces();
-			FileHandling.overWriteExistindDir("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 ...");
-		}
-	}
+        String suiteName = ExtentManager.getSuiteName(myContext);
+        ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+        ExtentTestManager.assignCategory(this.getClass());
 
-	public void verifyErrorCode(RestResponse response, String action, int expectedCode) {
-		assertNotNull("check response object is not null after " + action, response);
-		assertNotNull("check error code exists in response after " + action, response.getErrorCode());
-		assertEquals("Check response code after  + action" + action, expectedCode, response.getErrorCode().intValue());
-	}
+    }
 
-	private static void cleanComponents() throws Exception {
+    protected static void performClean() throws Exception, FileNotFoundException {
+        if (!config.getSystemUnderDebug()) {
+            deleteCreatedComponents(getCatalogAsMap());
+            FileHandling.overWriteExistindDir("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 ...");
+        }
+    }
 
-		// Components to delete
-		List<String> vfResourcesToDelete = new ArrayList<String>();
-		List<String> nonVfResourcesToDelete = new ArrayList<String>();
-		List<String> servicesToDelete = new ArrayList<String>();
-		List<String> productsToDelete = new ArrayList<String>();
+    public void verifyErrorCode(RestResponse response, String action, int expectedCode) {
+        assertNotNull("check response object is not null after " + action, response);
+        assertNotNull("check error code exists in response after " + action, response.getErrorCode());
+        assertEquals("Check response code after  + action" + action, expectedCode, response.getErrorCode().intValue());
+    }
 
-		// Categories to delete
-		List<ImmutableTriple<String, String, String>> productGroupingsToDelete = new ArrayList<>();
-		List<ImmutablePair<String, String>> productSubsToDelete = new ArrayList<>();
-		List<ImmutablePair<String, String>> resourceSubsToDelete = new ArrayList<>();
-		List<String> productCategoriesToDelete = new ArrayList<>();
-		List<String> resourceCategoriesToDelete = new ArrayList<String>();
-		List<String> serviceCategoriesToDelete = new ArrayList<String>();
+    private static void deleteCreatedComponents(Map<String, List<Component>> convertCatalogResponseToJavaObject) throws IOException {
+        final String userId = UserRoleEnum.DESIGNER.getUserId();
 
-		List<String> resourcesNotToDelete = config.getResourcesNotToDelete();
-		List<String> resourceCategoriesNotToDelete = config.getResourceCategoriesNotToDelete();
-		List<String> serviceCategoriesNotToDelete = config.getServiceCategoriesNotToDelete();
+    /*    List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.PRODUCT_PARAM_NAME);
+        if (resourcesArrayList.size() > 0) {
+            List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+            for (String uId : collect) {
+                ProductRestUtils.deleteProduct(uId, userId);
+            }
+        }*/
 
-		Iterable<TitanVertex> vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex vertex = iter.next();
-				Boolean isAbstract = vertex.value(GraphPropertiesDictionary.IS_ABSTRACT.getProperty());
-				// if (!isAbstract) {
-				String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
-				String version = vertex.value(GraphPropertiesDictionary.VERSION.getProperty());
+        List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
+        if (!CollectionUtils.isEmpty(resourcesArrayList)) {
+            List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+            for (String uId : collect) {
+                ResourceRestUtils.markResourceToDelete(uId, userId);
+            }
+            ResourceRestUtils.deleteMarkedResources(userId);
+        }
 
-				if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && !version.equals("1.0"))) {
-					String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-					String resourceType = vertex.value(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty());
-					if (name.startsWith("ci")) {
-						if (resourceType.equals(ResourceTypeEnum.VF.name())) {
-							vfResourcesToDelete.add(id);
-						} else {
-							nonVfResourcesToDelete.add(id);
-						}
-					}
-				} else if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && version.equals("1.0"))) {
-					if ((boolean) vertex.value(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) == false) {
-						vertex.property(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
-					}
-				}
-				// }
-			}
-		}
-		vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Service.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex vertex = iter.next();
-				String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-				String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
-				if (name.startsWith("ci")) {
-					servicesToDelete.add(id);
-				}
-			}
-		}
+        resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
+        if (resourcesArrayList.size() > 0) {
+            List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+            for (String uId : collect) {
+                ServiceRestUtils.markServiceToDelete(uId, userId);
+            }
+            ServiceRestUtils.deleteMarkedServices(userId);
+        }
+    }
 
-		vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex vertex = iter.next();
-				String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-				String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
-				if (name.startsWith("Ci")) {
-					productsToDelete.add(id);
-				}
-			}
-		}
-
-		// Getting categories
-
-		vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ResourceNewCategory.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex category = iter.next();
-				String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
-				if (!resourceCategoriesNotToDelete.contains(name)) {
-					String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-					resourceCategoriesToDelete.add(catId);
-					Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
-					while (subs.hasNext()) {
-						Vertex sub = subs.next();
-						String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-						resourceSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
-					}
-				}
-			}
-		}
-
-		vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ServiceNewCategory.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex category = iter.next();
-				String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
-				if (!serviceCategoriesNotToDelete.contains(name)) {
-					String id = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-					serviceCategoriesToDelete.add(id);
-				}
-			}
-		}
-
-		vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ProductCategory.getName()).vertices();
-		if (vertices != null) {
-			Iterator<TitanVertex> iter = vertices.iterator();
-			while (iter.hasNext()) {
-				Vertex category = iter.next();
-				String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-				productCategoriesToDelete.add(catId);
-				Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
-				while (subs.hasNext()) {
-					Vertex sub = subs.next();
-					String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-					productSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
-					Iterator<Vertex> groupings = sub.vertices(Direction.OUT, GraphEdgeLabels.GROUPING.getProperty());
-					while (groupings.hasNext()) {
-						Vertex grouping = groupings.next();
-						String groupId = grouping.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
-						productGroupingsToDelete.add(new ImmutableTriple<String, String, String>(catId, subCatId, groupId));
-					}
-				}
-
-			}
-		}
-
-		titanGraph.tx().commit();
-
-		String adminId = UserRoleEnum.ADMIN.getUserId();
-	/*	String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId();*/
-
-		// Component delete
-		
-/*		for (String id : productsToDelete) {
-			RestResponse deleteProduct = ProductRestUtils.deleteProduct(id, productStrategistId);
-
-		}*/
-		for (String id : servicesToDelete) {
-			RestResponse deleteServiceById = ServiceRestUtils.deleteServiceById(id, adminId);
-
-		}
-		for (String id : vfResourcesToDelete) {
-			RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
-
-		}
-
-		for (String id : nonVfResourcesToDelete) {
-			RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
-
-		}
-
-		// Categories delete - product
-		/*String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE;
-		for (ImmutableTriple<String, String, String> triple : productGroupingsToDelete) {
-			CategoryRestUtils.deleteGrouping(triple.getRight(), triple.getMiddle(), triple.getLeft(), productStrategistId, componentType);
-		}
-		for (ImmutablePair<String, String> pair : productSubsToDelete) {
-			CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), productStrategistId, componentType);
-		}
-		for (String id : productCategoriesToDelete) {
-			CategoryRestUtils.deleteCategory(id, productStrategistId, componentType);
-		}*/
-
-		// Categories delete - resource
-		String componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE;
-		for (ImmutablePair<String, String> pair : resourceSubsToDelete) {
-			CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), adminId, componentType);
-		}
-		for (String id : resourceCategoriesToDelete) {
-			CategoryRestUtils.deleteCategory(id, adminId, componentType);
-		}
-		// Categories delete - resource
-		componentType = BaseRestUtils.SERVICE_COMPONENT_TYPE;
-		for (String id : serviceCategoriesToDelete) {
-			CategoryRestUtils.deleteCategory(id, adminId, componentType);
-		}
-
-	}
-
-	private static void deleteCreatedComponents(Map<String, List<Component>> convertCatalogResponseToJavaObject) throws IOException {
-		final String userId = UserRoleEnum.DESIGNER.getUserId();
-		
-		List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.PRODUCT_PARAM_NAME);
-		if (resourcesArrayList.size() > 0) {
-			List<String> collect = buildCollectionUniqueId(resourcesArrayList);
-			for (String uId : collect) {
-				ProductRestUtils.deleteProduct(uId, userId);
-			}
-		}
-		
-		
-		resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
-		if (resourcesArrayList.size() > 0) {
-			List<String> collect = buildCollectionUniqueId(resourcesArrayList);
-			for (String uId : collect) {
-				ServiceRestUtils.markServiceToDelete(uId, userId);
-			}
-			ServiceRestUtils.deleteMarkedServices(userId);
-		}
-
-		
-		resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
-
-		// List<String> collect = resourcesArrayList.stream().filter(s ->
-		// s.getName().startsWith("ci")).map(e ->
-		// e.getUniqueId()).collect(Collectors.toList());
-
-		// List<Map<String, String>> collect =
-		// resourcesArrayList.stream().filter(s ->
-		// s.getName().startsWith("ci")).map(e ->
-		// e.getAllVersions()).collect(Collectors.toList());
-		/*
-		 * List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) .flatMap(e -> e.getAllVersions().values().stream()).collect(Collectors.toList());
-		 */
-
-		if (!CollectionUtils.isEmpty(resourcesArrayList)) {
-			List<String> collect = buildCollectionUniqueId(resourcesArrayList);
-			for (String uId : collect) {
-				ResourceRestUtils.markResourceToDelete(uId, userId);
-			}
-			ResourceRestUtils.deleteMarkedResources(userId);
-		}
-
-	
-
-	}
-
-	private void deleteCollection(List<Component> componentArrayList, Consumer<String> deleteHandler) {
-
-		if (componentArrayList.size() > 0) {
-			List<String> collect = buildCollectionUniqueId(componentArrayList);
-			for (String uId : collect) {
-				deleteHandler.accept(uId);
-				// ProductRestUtils.deleteProduct(uId, userId);
-			}
-		}
-	}
-
-	protected static List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
-
-		// Stream<String> flatMap = resourcesArrayList.stream().filter(s ->
-		// s.getName().startsWith("ci")).map(e -> e.getAllVersions()).map( e ->
-		// e.values()).flatMap( e -> e.stream());
-
-		// List<String> collect = resourcesArrayList.stream()
-		// //
-		// .filter(s -> s.getName().startsWith("ci") )
-		// //
-		// .map(e -> e.getUniqueId())
+    protected static List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
 
-		// .map( e -> e.values())
-		// .filter(out -> out!=null )
-		// .flatMap( e -> e.stream())
-		// .collect(Collectors.toList());
 
-		// List<String> collect = resourcesArrayList.stream().filter(s ->
-		// s.getName().startsWith("ci"))
-		// .flatMap(e ->
-		// e.getAllVersions().values().stream()).collect(Collectors.toList());
-		ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
- 
-		List<String> genericCollection = new ArrayList<String>();
-		
-		resourcesArrayList.stream().filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).map(e -> e.getUniqueId()).collect(Collectors.toList()).forEach((i) -> {
-			buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i);
-		});
-		
-	
-		//
+        List<String> genericCollection = new ArrayList<>();
+        if(resourcesArrayList.get(0) != null) {
+            ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
+            resourcesArrayList.stream().filter(a -> a != null).
+                    filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).
+                    filter(f -> f.getUniqueId() != null).
+                    map(e -> e.getUniqueId()).
+                    collect(Collectors.toList()).
+                    forEach((i) -> {
+                        buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i);
+                    });
+        }
+        return genericCollection;
+    }
 
-		// List<String> collect =
-		// genericCollection.stream().collect(Collectors.toList());
+    public static void buildCollectionBaseOnComponentType(ComponentTypeEnum componentTypeEnum,
+                                                          List<String> genericCollection, String i) {
+        try {
+            switch (componentTypeEnum) {
+                case RESOURCE:
+                    RestResponse resource = ResourceRestUtils.getResource(i);
+                    Resource convertResourceResponseToJavaObject = ResponseParser.convertResourceResponseToJavaObject(resource.getResponse());
+                    Map<String, String> allVersions = convertResourceResponseToJavaObject.getAllVersions();
+                    Collection<String> values = allVersions.values();
+                    genericCollection.addAll(values);
 
-		return genericCollection;
-	}
+                    break;
+                case SERVICE:
+                    RestResponse service = ServiceRestUtils.getService(i);
+                    Service convertServiceResponseToJavaObject = ResponseParser.convertServiceResponseToJavaObject(service.getResponse());
+                    allVersions = convertServiceResponseToJavaObject.getAllVersions();
+                    values = allVersions.values();
+                    genericCollection.addAll(values);
 
-	public static void buildCollectionBaseOnComponentType(ComponentTypeEnum componentTypeEnum,
-			List<String> genericCollection, String i) {
-		try {
-			switch (componentTypeEnum) {
-			case RESOURCE:
-				RestResponse resource = ResourceRestUtils.getResource(i);
-				Resource convertResourceResponseToJavaObject = ResponseParser.convertResourceResponseToJavaObject(resource.getResponse());
-				Map<String, String> allVersions = convertResourceResponseToJavaObject.getAllVersions();
-				Collection<String> values = allVersions.values();
-				genericCollection.addAll(values);
-					
-				break;
-			case SERVICE:
-				RestResponse service = ServiceRestUtils.getService(i);
-				Service convertServiceResponseToJavaObject = ResponseParser.convertServiceResponseToJavaObject(service.getResponse());
-				allVersions = convertServiceResponseToJavaObject.getAllVersions();
-				values = allVersions.values();
-				genericCollection.addAll(values);
+                    break;
 
-				break;
-					
 
-			case PRODUCT:
-				RestResponse product = ProductRestUtils.getProduct(i);
-				Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());
-				allVersions = convertProductResponseToJavaObject.getAllVersions();
-				values = allVersions.values();
-				genericCollection.addAll(values);
+                case PRODUCT:
+                    RestResponse product = ProductRestUtils.getProduct(i);
+                    Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());
+                    allVersions = convertProductResponseToJavaObject.getAllVersions();
+                    values = allVersions.values();
+                    genericCollection.addAll(values);
 
-				break;
+                    break;
+            }
+        } catch (Exception e1) {
+            e1.printStackTrace();
+        }
+    }
 
-			// default:
-			// break;
-			}
-		} catch (Exception e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		}
-	}
+    protected static Map<String, List<Component>> getCatalogAsMap() throws Exception {
+        RestResponse catalog = CatalogRestUtils.getCatalog(UserRoleEnum.DESIGNER.getUserId());
+        Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser.convertCatalogResponseToJavaObject(catalog.getResponse());
+        return convertCatalogResponseToJavaObject;
+    }
 
-	protected static Map<String, List<Component>> getCatalogAsMap() throws Exception {
-		RestResponse catalog = CatalogRestUtils.getCatalog(UserRoleEnum.DESIGNER.getUserId());
-		Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser.convertCatalogResponseToJavaObject(catalog.getResponse());
-		return convertCatalogResponseToJavaObject;
-	}
-	protected Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
-		// create new resource from Csar
-		ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
+    protected Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
+        // create new resource from Csar
+        ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
 
-		resourceDetails.setCsarUUID(csarId);
-		resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
-		RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
-		BaseRestUtils.checkCreateResponse(createResource);
-		Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
-		return createdResource;
-	}
-	
+        resourceDetails.setCsarUUID(csarId);
+        resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+        RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+        BaseRestUtils.checkCreateResponse(createResource);
+        Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
+        return createdResource;
+    }
 
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
index 4fe9d62..87b4c77 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
@@ -20,58 +20,26 @@
 
 package org.openecomp.sdc.ci.tests.api;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Product;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-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.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-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.testng.Assert;
 
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.*;
+
 public class ComponentInstanceBaseTest extends ComponentBaseTest {
 	public static final String acceptHeaderData = "application/json";
 	// Req/cap of container component
@@ -123,9 +91,9 @@
 		resourceDetailsCP_02 = ElementFactory.getDefaultResourceByType("ciCP200", NormativeTypesEnum.PORT, ResourceCategoryEnum.GENERIC_DATABASE, sdncDesignerDetails.getUserId(), ResourceTypeEnum.CP.toString());
 		resourceDetailsVL_01 = ElementFactory.getDefaultResourceByType("ciVL100", NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(), ResourceTypeEnum.VL.toString());
 		resourceDetailsVL_02 = ElementFactory.getDefaultResourceByType("ciVL200", NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(), ResourceTypeEnum.VL.toString());
-		serviceDetails_01 = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId());
-		serviceDetails_02 = ElementFactory.getDefaultService("ciNewtestservice2", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId());
-		serviceDetails_03 = ElementFactory.getDefaultService("ciNewtestservice3", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId());
+		serviceDetails_01 = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+		serviceDetails_02 = ElementFactory.getDefaultService("ciNewtestservice2", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+		serviceDetails_03 = ElementFactory.getDefaultService("ciNewtestservice3", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
 		productDetails_01 = ElementFactory.getDefaultProduct("ciProduct01");
 		productDetails_02 = ElementFactory.getDefaultProduct("ciProduct02");
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
index 44c4275..194966d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
@@ -20,17 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.api;
 
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
-import org.testng.ITestContext;
 import com.aventstack.extentreports.ExtentReports;
 import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
 import com.aventstack.extentreports.reporter.ExtentXReporter;
 import com.aventstack.extentreports.reporter.configuration.Protocol;
 import com.aventstack.extentreports.reporter.configuration.Theme;
 import org.openecomp.sdc.ci.tests.config.Config;
-
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
 import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java
index 2c242d0..5cb5a5b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java
@@ -21,14 +21,12 @@
 package org.openecomp.sdc.ci.tests.api;
 
 import com.aventstack.extentreports.ExtentTest;
-import com.aventstack.extentreports.MediaEntityBuilder;
 import com.aventstack.extentreports.Status;
 import com.aventstack.extentreports.markuputils.ExtentColor;
 import com.aventstack.extentreports.markuputils.Markup;
 import com.aventstack.extentreports.markuputils.MarkupHelper;
 
 import java.io.File;
-import org.openecomp.sdc.ci.tests.api.ExtentTestManager;
 
 
 public class ExtentTestActions {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index b908ddd..d084cb8 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -23,8 +23,6 @@
 
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
-import java.io.FileNotFoundException;
-
 public interface Urls {
 
 
@@ -269,6 +267,7 @@
 	final String GET_SERVICE_BY_NAME_AND_VERSION = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/services/serviceName/%s/serviceVersion/%s";
 
 	final String GET_SERVICES_REQUIRMENTS_CAPABILITIES = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/requirmentsCapabilities/services/%s";
+	final String GET_INSTANCE_REQUIRMENTS_CAPABILITIES  = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/filteredDataByParams?include=requirements&include=capabilities";
 
 	final String CREATE_COMPONENT_INSTANCE = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance";
 	final String DELETE_COMPONENT_INSTANCE = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/%s";
@@ -392,4 +391,5 @@
 	final String UPDATE_VSP = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s";
 	final String GET_VSP_COMPONENT_BY_VERSION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s";
 	final String GET_VLM_COMPONENT_BY_VERSION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/%s";
+	final String ACTION_ARCHIVE_RESTORE_COMPONENT = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/%s/%s/actions";
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
index f251c2d..c44c029 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
@@ -20,6 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.config;
 
+import org.yaml.snakeyaml.Yaml;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -27,8 +29,6 @@
 import java.nio.file.Paths;
 import java.util.List;
 
-import org.yaml.snakeyaml.Yaml;
-
 public class Config {
 
 	private static String WINDOWS_CONFIG_FILE = "src/main/resources/ci/conf/attsdc.yaml";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/InvokedMethodListener.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/InvokedMethodListener.java
index fbc493f..bfed5dc 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/InvokedMethodListener.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/InvokedMethodListener.java
@@ -20,15 +20,15 @@
 
 package org.openecomp.sdc.ci.tests.config;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.testng.IInvokedMethod;
 import org.testng.IInvokedMethodListener;
 import org.testng.ITestResult;
 import org.testng.SkipException;
 import org.testng.internal.TestResult;
 
+import java.util.HashMap;
+import java.util.Map;
+
 public class InvokedMethodListener implements IInvokedMethodListener {
 
 	static Map<String, Integer> methodFailCount = new HashMap<String, Integer>();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java
index ae2eec8..9060839 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java
@@ -1,19 +1,13 @@
 package org.openecomp.sdc.ci.tests.config;
 
 
-import fj.data.Either;
 import org.apache.commons.io.IOUtils;
 import org.json.JSONObject;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
 import org.yaml.snakeyaml.Yaml;
 
 import java.io.*;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
 public class MainToTest {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java
index c6e684c..25a3779 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java
@@ -5,7 +5,6 @@
 import org.yaml.snakeyaml.Yaml;
 
 import java.io.File;
-import java.util.HashMap;
 import java.util.Map;
 
 public class UserCredentialsFromFile {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
index fc75ffb..29de86a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
@@ -1,13 +1,13 @@
 package org.openecomp.sdc.ci.tests.dataProviders;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
 import org.testng.annotations.DataProvider;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 public class OnboardingDataProviders {
 
 	protected static String filepath = FileHandling.getVnfRepositoryPath();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
index 58a11b0..b61daf8 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
@@ -4,7 +4,6 @@
 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
 import org.testng.annotations.DataProvider;
 
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
index 15e1e0a..207d869 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
@@ -20,10 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.List;
-
 import org.openecomp.sdc.be.model.HeatParameterDefinition;
 
+import java.util.List;
+
 public class ArtifactReqDetails {
 
 	public ArtifactReqDetails() {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java
index 13e51a0..d6699d3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java
@@ -30,6 +30,7 @@
 	String posY;
 	String name;
 	String uniqueId;
+	String originType;
 
 	public ComponentInstanceReqDetails() {
 		super();
@@ -43,9 +44,10 @@
 		this.posY = componentInstance.getPosY();
 		// this.name = "myResourceInstance";
 		this.name = componentInstance.getName();
+		this.originType = componentInstance.getOriginType().name();
 	}
 
-	public ComponentInstanceReqDetails(String resourceUid, String description, String posX, String posY, String name) {
+	public ComponentInstanceReqDetails(String resourceUid, String description, String posX, String posY, String name, String originType) {
 		super();
 		this.componentUid = resourceUid;
 		this.description = description;
@@ -53,6 +55,7 @@
 		this.posY = posY;
 		// this.name = "myResourceInstance";
 		this.name = name;
+		this.originType = originType;
 	}
 
 	public ComponentInstanceReqDetails(String resourceUid, String description, String posX, String posY) {
@@ -111,6 +114,14 @@
 		this.uniqueId = uniqueId;
 	}
 
+	public String getOriginType() {
+		return originType;
+	}
+
+	public void setOriginType(String originType) {
+		this.originType = originType;
+	}
+
 	@Override
 	public String toString() {
 		return "ResourceInstanceReqDetails [resourceUid=" + componentUid + ", description=" + description + ", posX="
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentReqDetails.java
index 8546732..36c9fc8 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentReqDetails.java
@@ -20,13 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.openecomp.sdc.be.model.LifecycleStateEnum;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public abstract class ComponentReqDetails {
 
 	protected String name;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
index e7899ee..d877150 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
@@ -20,35 +20,24 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
+import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.yaml.snakeyaml.Yaml;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.*;
+import java.util.*;
+
+import static org.testng.AssertJUnit.*;
 
 public class ImportReqDetails extends ResourceReqDetails {
 
+	private static final String CAPS = "capabilities";
 	private String payloadName;
 	private String payloadData;
 
@@ -62,6 +51,12 @@
 			String vendorName, String vendorRelease, String contactId, String icon) {
 		super(resourceName, description, tags, null, derivedFrom, vendorName, vendorRelease, contactId, icon);
 	}
+	
+	public ImportReqDetails(Resource resource, String payloadName, String payloadData){
+		super(resource);
+		this.payloadData = payloadData;
+		this.payloadName = payloadName;
+	}
 
 	public String getPayloadName() {
 		return payloadName;
@@ -84,8 +79,7 @@
 		return "ImportReqDetails [payloadName=" + payloadName + ", payloadData=" + payloadData + "]";
 	}
 
-	public void setReqirementsAndCapabilities(String path, String fileName, User user, String derivedFromSource)
-			throws Exception {
+	public void setReqirementsAndCapabilities(String path, String fileName, User user, String derivedFromSource) throws IOException, JSONException{
 		setRequirements(path, fileName, user, derivedFromSource);
 		setCapabilities(path, fileName, user, derivedFromSource);
 	}
@@ -110,14 +104,15 @@
 		return requirements;
 	}
 
-	public void setRequirements(String path, String fileName, User user, String derivedFromSource) throws Exception {
+	public void setRequirements(String path, String fileName, User user, String derivedFromSource) throws IOException, JSONException {
 		Map<String, Object> requirementsFromFile = getRequirementsMapFromFile(path + File.separator + fileName,
 				toscaResourceName, "requirements");
-		Map<String, Object> requirements = organizeRequirementsMap(requirementsFromFile);
-		getDerivedReqCap(user, requirements, "requirements", derivedFromSource);
-		this.requirements = requirements;
+		Map<String, Object> reqs = organizeRequirementsMap(requirementsFromFile);
+		getDerivedReqCap(user, reqs, "requirements", derivedFromSource);
+		this.requirements = reqs;
 	}
 
+	@SuppressWarnings("unchecked")
 	private void getDerivedReqCap(User user, Map<String, Object> reqCapMap, String field, String derivedFromResource)
 			throws IOException, JSONException {
 
@@ -134,17 +129,16 @@
 			List<Object> lst = (List<Object>) parsedFieldFromResponseAsMap.get(type);
 			convertListToMap = convertListToMap(lst);
 
-			if (field.equals("capabilities")) {
+			if (field.equals(CAPS)) {
 				convertListToMap.replace("capabilitySources", derivedList);
-				lst = new ArrayList<Object>(Arrays.asList(convertListToMap));
+				lst = new ArrayList<>(Arrays.asList(convertListToMap));
 			}
 
 			Object existingValue = reqCapMap.get(type);
 			if (existingValue != null) {
 				Map<String, Object> convertedExistingValue = convertListToMap((List<Object>) existingValue);
-				if (convertedExistingValue.get("name").toString().toLowerCase()
-						.equals(convertListToMap.get("name").toString().toLowerCase())) {
-					lst = new ArrayList<Object>(Arrays.asList(convertedExistingValue));
+				if (convertedExistingValue.get("name").toString().equalsIgnoreCase(convertListToMap.get("name").toString())) {
+					lst = new ArrayList<>(Arrays.asList(convertedExistingValue));
 				} else {
 					lst.add(convertedExistingValue);
 				}
@@ -174,19 +168,20 @@
 		return capabilities;
 	}
 
-	public void setCapabilities(String path, String fileName, User user, String derivedFromSource) throws Exception {
+	public void setCapabilities(String path, String fileName, User user, String derivedFromSource) throws IOException, JSONException {
 		Map<String, Object> capabilitiesFromFile = getCapabilitiesMapFromFile(path + File.separator + fileName,
-				toscaResourceName, "capabilities");
-		Map<String, Object> capabilities = organizeCapabilitiesMap(capabilitiesFromFile);
-		getDerivedReqCap(user, capabilities, "capabilities", derivedFromSource);
-		this.capabilities = capabilities;
+				toscaResourceName, CAPS);
+		Map<String, Object> caps = organizeCapabilitiesMap(capabilitiesFromFile);
+		getDerivedReqCap(user, caps, CAPS, derivedFromSource);
+		this.capabilities = caps;
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> organizeCapabilitiesMap(Map<String, Object> capabilitiesFromFile) {
 		Iterator<String> iterator = capabilitiesFromFile.keySet().iterator();
-		Map<String, Object> capMap = new HashMap<String, Object>();
+		Map<String, Object> capMap = new HashMap<>();
 		while (iterator.hasNext()) {
-			List<Object> valueList = new ArrayList<Object>();
+			List<Object> valueList = new ArrayList<>();
 			String next = iterator.next();
 			Map<String, Object> valuesMap = (Map<String, Object>) capabilitiesFromFile.get(next);
 			String key = valuesMap.remove("type").toString();
@@ -204,26 +199,28 @@
 				valueList.add(valuesMap);
 			} else {
 				Map<String, Object> convertValue = convertListToMap((List<Object>) tempValue);
-				valueList = new ArrayList<Object>(Arrays.asList(convertValue, valuesMap));
+				valueList = new ArrayList<>(Arrays.asList(convertValue, valuesMap));
 			}
 			capMap.put(key, valueList);
 		}
 		return capMap;
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> getCapabilitiesMapFromFile(String fileName, String toscaResourceName,
-			String fieldToTest) throws Exception {
+			String fieldToTest) throws FileNotFoundException {
 		Map<String, Object> resourceToscaMap = getToscaResourceFromFile(fileName, toscaResourceName);
 		Object capMap = resourceToscaMap.get(fieldToTest);
 		if (capMap == null) {
-			return new HashMap<String, Object>();
+			return new HashMap<>();
 		}
 		return (Map<String, Object>) capMap;
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> organizeRequirementsMap(Map<String, Object> requirementsFromFile) {
-		Map<String, Object> reqMap = new HashMap<String, Object>();
-		List<Object> valueList = new ArrayList<Object>();
+		Map<String, Object> reqMap = new HashMap<>();
+		List<Object> valueList = new ArrayList<>();
 		Iterator<String> iterator = requirementsFromFile.keySet().iterator();
 		while (iterator.hasNext()) {
 			String key = iterator.next();
@@ -244,19 +241,19 @@
 		return reqMap;
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> getRequirementsMapFromFile(String fileName, String toscaResourceName,
-			String fieldToTest) throws Exception {
+			String fieldToTest) throws FileNotFoundException {
 		Map<String, Object> resourceToscaMap = getToscaResourceFromFile(fileName, toscaResourceName);
 		List<Object> reqListFromFile = (List<Object>) resourceToscaMap.get(fieldToTest);
 		if (reqListFromFile == null) {
-			return new HashMap<String, Object>();
+			return new HashMap<>();
 		}
-		Map<String, Object> testedMapFromFile = convertListToMap(reqListFromFile);
-		return testedMapFromFile;
+		return convertListToMap(reqListFromFile);
 	}
 
-	private Map<String, Object> getToscaResourceFromFile(String fullFileName, String toscaResourceName)
-			throws Exception {
+	@SuppressWarnings("unchecked")
+	private Map<String, Object> getToscaResourceFromFile(String fullFileName, String toscaResourceName) throws FileNotFoundException{
 		Map<String, Object> nodesTypesMap = getNodesTypesMapFromFile(fullFileName);
 		Map<String, Object> resourceToscaMap = (Map<String, Object>) nodesTypesMap.get(toscaResourceName);
 
@@ -265,17 +262,18 @@
 		return resourceToscaMap;
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> getNodesTypesMapFromFile(String fullFileName) throws FileNotFoundException {
 		Yaml yaml = new Yaml();
 		File file = new File(fullFileName);
 		InputStream inputStream = new FileInputStream(file);
 		Map<?, ?> mapFromFile = (Map<?, ?>) yaml.load(inputStream);
-		Map<String, Object> nodesTypesMap = (Map<String, Object>) mapFromFile.get("node_types");
-		return nodesTypesMap;
+		return (Map<String, Object>) mapFromFile.get("node_types");
 	}
 
+	@SuppressWarnings("unchecked")
 	private Map<String, Object> convertListToMap(List<Object> testedListFromFile) {
-		Map<String, Object> testedMapFromFile = new HashMap<String, Object>();
+		Map<String, Object> testedMapFromFile = new HashMap<>();
 		for (int i = 0; i < testedListFromFile.size(); i++) {
 			Object req = testedListFromFile.get(i);
 			ObjectMapper m = new ObjectMapper();
@@ -285,6 +283,7 @@
 		return testedMapFromFile;
 	}
 
+	@SuppressWarnings("unchecked")
 	public void compareRequirementsOrCapabilities(Map<String, Object> exepectedReq, Map<String, Object> actualReq) {
 		Iterator<String> iterator = exepectedReq.keySet().iterator();
 		while (iterator.hasNext()) {
@@ -317,14 +316,15 @@
 		}
 	}
 
+	@SuppressWarnings("unchecked")
 	private List<Map<String, Object>> convertListToMapList(List<Object> testedListFromFile) {
-		List<Map<String, Object>> listOfMaps = new ArrayList<Map<String, Object>>();
+		List<Map<String, Object>> listOfMaps = new ArrayList<>();
 		for (int i = 0; i < testedListFromFile.size(); i++) {
 			Object req = testedListFromFile.get(i);
 			ObjectMapper m = new ObjectMapper();
 			Map<? extends String, ? extends String> mappedObject = m.convertValue(req, Map.class);
 			mappedObject.remove("uniqueId");
-			Map<String, Object> testedMapFromFile = new HashMap<String, Object>();
+			Map<String, Object> testedMapFromFile = new HashMap<>();
 			testedMapFromFile.putAll(mappedObject);
 			listOfMaps.add(testedMapFromFile);
 		}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ProductReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ProductReqDetails.java
index f2484e2..61d923e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ProductReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ProductReqDetails.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+
 import java.util.ArrayList;
 import java.util.List;
 
-import org.openecomp.sdc.be.model.category.CategoryDefinition;
-
 public class ProductReqDetails extends ComponentReqDetails {
 
 	private String fullName;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java
index 4d5806b..5a968fd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java
@@ -20,10 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.List;
-
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 
+import java.util.List;
+
 public class ResourceExternalReqDetails extends ComponentReqDetails {
 	String vendorName;
 	String vendorRelease;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
index e3517a8..cfb7845 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.List;
-
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.model.Resource;
 
+import java.util.List;
+
 public class ResourceReqDetails extends ComponentReqDetails {
 	List<String> derivedFrom;
 	String vendorName;
@@ -72,7 +72,6 @@
 		this.name = resource.getName();
 		this.description = resource.getDescription();
 		this.tags = resource.getTags();
-		// this.category = resource.getCategories();
 		this.derivedFrom = resource.getDerivedFrom();
 		this.vendorName = resource.getVendorName();
 		this.vendorRelease = resource.getVendorRelease();
@@ -99,7 +98,6 @@
 				ResourceTypeEnum.VFC.toString());
 	}
 
-	// new
 	public ResourceReqDetails(String resourceName, String description, List<String> tags, String category,
 			List<String> derivedFrom, String vendorName, String vendorRelease, String contactId, String icon,
 			String resourceType) {
@@ -108,7 +106,6 @@
 		this.name = resourceName;
 		this.description = description;
 		this.tags = tags;
-		// this.category = category;
 		this.derivedFrom = derivedFrom;
 		this.vendorName = vendorName;
 		this.vendorRelease = vendorRelease;
@@ -128,7 +125,6 @@
 		this.name = originalResource.getName();
 		this.description = originalResource.getDescription();
 		this.tags = originalResource.getTags();
-		// this.category = originalResource.getCategory();
 		this.derivedFrom = originalResource.getDerivedFrom();
 		this.vendorName = originalResource.getVendorName();
 		this.vendorRelease = originalResource.getVendorRelease();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java
index a915af4..78408bd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java
@@ -20,10 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.List;
-
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
 
+import java.util.List;
+
 public class ResourceRespJavaObject {
 	String uniqueId;
 	String name;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
index fbcbfd4..76c17f0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
@@ -20,10 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.datatypes;
 
-import java.util.ArrayList;
-
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
+
+import java.util.ArrayList;
 
 public class ServiceReqDetails extends ComponentReqDetails {
 	
@@ -31,6 +32,7 @@
 	protected String serviceRole = "MyServiceRole";
 	protected String namingPolicy = "MyServiceNamingPolicy";
 	protected Boolean ecompGeneratedNaming = true;
+	protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue(); 
 
 	public String getServiceType() {
 		return serviceType;
@@ -39,7 +41,11 @@
 	public void setServiceType(String serviceType) {
 		this.serviceType = serviceType;
 	}
-
+	
+	public String getInstantiationType() {
+		return instantiationType;
+	}
+	
 	public String getServiceRole() {
 		return serviceRole;
 	}
@@ -65,9 +71,8 @@
 	}
 
 	public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
-			String contactId, String icon) {
+			String contactId, String icon, String instantiationType) {
 		this.name = serviceName;
-		// this.category = category;
 		this.tags = tags;
 		this.description = description;
 		this.contactId = contactId;
@@ -107,13 +112,13 @@
 
 	@Override
 	public String toString() {
-		return "ServiceDetails [name=" + name + ", category=" + getCategory() + ", tags=" + tags + ", description="
-				+ description + ", contactId=" + contactId + ", icon=" + icon + "]";
+		return "ServiceDetails [name = " + name + ", category = " + getCategory() + ", tags = " + tags + ", description = "
+				+ description + ", contactId = " + contactId + ", icon = " + icon + ", instantiation type = " + getInstantiationType() + "]";
 	}
 
 	public ServiceReqDetails(ServiceReqDetails aService) {
 		this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
-				aService.getDescription(), aService.getContactId(), aService.getIcon());
+				aService.getDescription(), aService.getContactId(), aService.getIcon(), aService.getInstantiationType());
 		uniqueId = aService.getUniqueId();
 		version = aService.getVersion();
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ImportTestTypesEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ImportTestTypesEnum.java
index 21901e4..ed71faa 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ImportTestTypesEnum.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ImportTestTypesEnum.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.datatypes.enums;
 
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+
 import java.util.Arrays;
 import java.util.List;
 
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-
 public enum ImportTestTypesEnum {
 
 	MISSING_CONTACT("tosca.nodes.missing_contact", "missing_contact", ActionStatus.COMPONENT_MISSING_CONTACT, Arrays.asList("Resource"), true), 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
index a0b13b7..1ba6c5c 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.datatypes.enums;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-
 import java.util.Random;
 
 public enum ResourceCategoryEnum {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceInstantiationType.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceInstantiationType.java
new file mode 100644
index 0000000..80fa95b
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceInstantiationType.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdc.ci.tests.datatypes.enums;
+
+public enum ServiceInstantiationType {
+	A_LA_CARTE("A-la-carte"), MACRO("Macro");
+	
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private ServiceInstantiationType(String value) {
+		this.value = value;
+	}
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
index b8635b3..24adc49 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
@@ -22,7 +22,12 @@
 
 public enum ToscaKeysEnum {
 
-	TOSCA_DEFINITION_VERSION("tosca_definitions_version"), METADATA("metadata"), IMPORTS("imports"), NODE_TYPES("node_types"), TOPOLOGY_TEMPLATE("topology_template");
+	TOSCA_DEFINITION_VERSION("tosca_definitions_version"),
+	METADATA("metadata"),
+	IMPORTS("imports"),
+	NODE_TYPES("node_types"),
+	TOPOLOGY_TEMPLATE("topology_template"),
+	ANNOTATION_TYPES("annotation_types");
 
 	private String toscaKey;
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
index 2435b10..0e81a7b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
@@ -23,7 +23,6 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.client.methods.HttpPost;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
index 3af40c5..fc0e33d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
@@ -20,9 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.TODO;
 
-import java.io.File;
-import java.io.IOException;
-
+import fj.data.Either;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -39,7 +37,8 @@
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
-import fj.data.Either;
+import java.io.File;
+import java.io.IOException;
 
 public class ImportCapabilityTypeCITest {
 	public static final DbUtils DbUtils = new DbUtils();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
index 66e450b..c735169 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
@@ -20,11 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import fj.data.Either;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpResponseException;
@@ -37,7 +35,6 @@
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
@@ -46,11 +43,7 @@
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
@@ -63,11 +56,7 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
 import org.openecomp.sdc.common.util.GeneralUtility;
@@ -77,10 +66,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.Gson;
-
-import fj.data.Either;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
 
 public class ArtifactServletTest extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
index ff99a6b..5072f58 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
@@ -20,30 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
 import org.apache.commons.lang3.tuple.Pair;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -56,12 +38,7 @@
 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.general.FileUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ArtifactValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
@@ -72,6 +49,16 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import static org.testng.AssertJUnit.*;
+
 public class CrudArt extends ComponentBaseTest {
 
 	private static Logger logger = LoggerFactory.getLogger(CrudArt.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
index fb620c9..02bf110 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
@@ -20,12 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import fj.data.Either;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -39,7 +38,6 @@
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
@@ -47,26 +45,14 @@
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -91,12 +77,11 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-import fj.data.Either;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
 
 public class DownloadComponentArt extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
index bc57512..80e0a54 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
@@ -20,41 +20,31 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.codec.binary.Base64;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
-import org.openecomp.sdc.be.model.ComponentInstance;
-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.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.testng.annotations.Test;
-import org.yaml.snakeyaml.Yaml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 public class HeatEnvArtifact extends ComponentBaseTest {
 
@@ -78,7 +68,9 @@
 
 		Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(certifyState.getResponse(), Resource.class);
 
-		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(
+				"ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId(), 
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 
 		// 2 create service
 		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
@@ -128,7 +120,9 @@
 
 		Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(certifyState.getResponse(), Resource.class);
 
-		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(
+				"ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId(), 
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 
 		// 2 create service
 		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
index 02bef89..b15da07 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
@@ -21,11 +21,28 @@
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
 //import static org.junit.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
+
+import fj.data.Either;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+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.general.FileUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -35,47 +52,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.javatuples.Pair;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-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.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-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.general.FileUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.validation.ErrorValidationUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.datastax.driver.core.Row;
-
-import fj.data.Either;
+import static org.testng.AssertJUnit.*;
 
 public class PlaceHolderValidations extends ComponentBaseTest {
 	private static Logger logger = LoggerFactory.getLogger(PlaceHolderValidations.class.getName());
@@ -140,7 +117,7 @@
 		}
 	}
 
-	private void validateToscaArtifactsBeforeAndAfterSFT(ResourceReqDetails resourceDetails)
+	/*private void validateToscaArtifactsBeforeAndAfterSFT(ResourceReqDetails resourceDetails)
 			throws IOException, Exception {
 		RestResponse componentResponse = ResourceRestUtils.getResource(resourceDetails, sdncDesignerDetails1);
 		Component component = ResponseParser.convertResourceResponseToJavaObject(componentResponse.getResponse());
@@ -161,15 +138,15 @@
 			List<Row> fetchFromTable = CassandraUtils.fetchFromTableQuery("sdcartifact", "resources", fields);
 			assertTrue(1 == fetchFromTable.size());
 		}
-	}
+	}*/
 
-	@Test
+	/*@Test
 	public void validateToscaArtifactsBeforeAndAfterSFT() throws IOException, Exception {
 		// TODO ADD VF and Service
 		validateToscaArtifactsBeforeAndAfterSFT(resourceDetails1);
 		validateToscaArtifactsBeforeAndAfterSFT(resourceCP);
 		validateToscaArtifactsBeforeAndAfterSFT(resourceVL);
-	}
+	}*/
 
 	@Test
 	public void validateToscaPlaceHoldersByConfig() throws IOException, Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
index c049211..be9b8b8 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
@@ -53,6 +46,13 @@
 import org.testng.annotations.Test;
 import org.yaml.snakeyaml.Yaml;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class ValidateArtResponse extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
index 8a7a2f6..09c4d38 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
@@ -20,9 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import java.util.Arrays;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -46,6 +43,9 @@
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
+import java.util.Arrays;
+import java.util.List;
+
 public class ValidateHeatArtFieldsTypes extends ComponentBaseTest {
 
 	protected User sdncDesignerDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
index 537a709..0033e37 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
@@ -20,12 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.execute.attribute;
 
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.swallowException;
-
-import java.io.File;
-import java.util.function.Function;
-
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -41,8 +37,11 @@
 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
+import java.io.File;
+import java.util.function.Function;
+
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.swallowException;
 
 public class ComponentInstanceAttributeTest extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
index 61c9442..0385bbc 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.category;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
@@ -35,10 +32,7 @@
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 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;
@@ -53,7 +47,9 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 public class CatalogDataApiTest extends ComponentBaseTest {
 
@@ -201,9 +197,10 @@
 		String vendorRelease = "0.1";
 		String contactId = "al1976";
 		String icon = "myIcon";
+		String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
 
 		ServiceReqDetails svcdetails = new ServiceReqDetails(serviceName, category, serviceTags, description,
-				contactId, icon);
+				contactId, icon, instantiationType);
 		return svcdetails;
 	}
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
index ade662a..ed41149 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
@@ -20,25 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.category;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.RESOURCE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.SERVICE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.commons.lang3.text.WordUtils;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.FileBody;
@@ -64,6 +45,13 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.File;
+import java.util.*;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class CategoriesTests extends CategoriesBaseTest {
 
 	private static final String GET_CATEGORY_HIERARCHY = "GetCategoryHierarchy";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
index ec36798..3d2b3a0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
@@ -20,12 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.category;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
@@ -38,6 +32,12 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
 import org.testng.annotations.Test;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+
 public class ElementsApiTest extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
index 7858b32..b0e7bd3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
@@ -20,18 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.category;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.RESOURCE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.SERVICE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_NOT_FOUND;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -54,6 +42,9 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.assertEquals;
+
 public class GroupingTest extends CategoriesBaseTest {
 
 	protected static final String ADD_GROUPING = "AddGrouping";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
index dd96ebf..eada2b4 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
@@ -20,21 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.category;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.RESOURCE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.SERVICE_COMPONENT_TYPE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_NOT_FOUND;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -56,6 +41,12 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.assertEquals;
+
 public class SubCategoriesTest extends ComponentBaseTest {
 
 	protected static final String ADD_SUB_CATEGORY = "AddSubCategory";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
index 586856b..ab6551f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
@@ -20,12 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.devCI;
 
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.openecomp.sdc.be.model.PropertyDefinition;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -34,6 +28,12 @@
 import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
 public class AndreyTest {
 
 	private static ToscaDefinition parseToscaYamlToJavaObject;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java
index 4cb46a3..7a69d37 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java
@@ -20,6 +20,14 @@
 
 package org.openecomp.sdc.ci.tests.execute.devCI;
 
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -28,25 +36,11 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
-import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
-
 public class ArtifactFromCsar {
 	
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
index 99890c1..9e77526 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
@@ -226,7 +226,7 @@
 
 	}
 
-	@Test
+	/*@Test
 	public void updateVFsearchByCsarStartCertifaicationState() throws Exception {
 
 		ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
@@ -256,7 +256,7 @@
 
 		resourceFirstImport.getGroups().equals(resourceSecondImport.getGroups());
 
-	}
+	}*/
 
 	@Test
 	public void updateVFsearchBySystemNameCheckInState() throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
index 49e5950..802de24 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.devCI;
 
-import static org.testng.AssertJUnit.assertTrue;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -38,6 +36,8 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ImportCsarValidateArtifacts extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java
index 7acf120..49b13b5 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.devCI;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
+import fj.data.Either;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -32,13 +29,7 @@
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
@@ -46,7 +37,9 @@
 import org.openecomp.sdc.externalApis.CRUDExternalAPI;
 import org.testng.annotations.Test;
 
-import fj.data.Either;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 public class test1 extends ComponentBaseTest{
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/AuthanticationTests.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/AuthanticationTests.java
index b4a9bb8..7f97ca3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/AuthanticationTests.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/AuthanticationTests.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.distribution;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
@@ -54,6 +47,13 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+
 public class AuthanticationTests extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
index e2a9207..94715b2 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
@@ -20,16 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.distribution;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipInputStream;
-
 import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -53,12 +43,7 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.common.api.Constants;
 import org.openecomp.sdc.common.util.GeneralUtility;
@@ -67,6 +52,16 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipInputStream;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+
 public class DistributionDownloadArtifactTest extends ComponentBaseTest {
 
 	protected static ResourceReqDetails resourceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
index 80b70d6..e49c912 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
@@ -20,9 +20,25 @@
 
 package org.openecomp.sdc.ci.tests.execute.externalapi;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
+import com.google.gson.Gson;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
+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.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.nio.file.Files;
@@ -32,50 +48,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.codec.binary.Base64;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-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.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.api.Urls;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-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.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.gson.Gson;
+import static org.testng.AssertJUnit.*;
 
 public class DownloadArtifactsTest extends ComponentBaseTest {
 	@Rule
@@ -127,9 +100,11 @@
 				ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
 				ResourceTypeEnum.CP.toString());
 		serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
+				sdncDesignerDetails.getUserId(),
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 		serviceDetails_02 = ElementFactory.getDefaultService("newtestservice2", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
+				sdncDesignerDetails.getUserId(),
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 	}
 
 	@Test
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
index c337149..404ed04 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
@@ -21,15 +21,6 @@
 //US505653
 package org.openecomp.sdc.ci.tests.execute.general;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -54,11 +45,7 @@
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 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.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.util.ValidationUtils;
@@ -67,6 +54,13 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.*;
+
 public class BasicHttpAuthenticationTest extends ComponentBaseTest {
 
 	protected static final String AUTH_FAILED_INVALID_AUTHENTICATION_HEADER = "AUTH_FAILED_INVALID_AUTHENTICATION_HEADER";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
index eea4e8a..0934ebb 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.general;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.HashMap;
-
+import com.google.gson.Gson;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -43,7 +40,9 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.util.HashMap;
+
+import static org.testng.AssertJUnit.assertEquals;
 
 public class ManageEcompConsumerCredentials extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/UuidTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/UuidTest.java
index acb7e15..e460614 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/UuidTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/UuidTest.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.general;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.UUID;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -38,6 +31,13 @@
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.List;
+import java.util.UUID;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class UuidTest extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/groups/GroupsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/groups/GroupsTest.java
new file mode 100644
index 0000000..4a2f98e
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/groups/GroupsTest.java
@@ -0,0 +1,164 @@
+package org.openecomp.sdc.ci.tests.execute.groups;
+
+import fj.data.Either;
+import org.apache.commons.collections.MapUtils;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest;
+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.ComponentInstanceRestUtils;
+import org.testng.annotations.Test;
+import org.testng.collections.Lists;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.junit.Assert.*;
+import static org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils.*;
+import static org.testng.Assert.assertNull;
+
+public class GroupsTest extends ComponentBaseTest {
+	@Rule
+	public static TestName name = new TestName();
+	
+	public static final String groupName = "x_group";
+	public static final String capabilityName = "vlan_assignment";
+	public static final String propertyName = "vfc_instance_group_reference";
+	public static final String csarsFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars" ;
+	
+	public GroupsTest() {
+		super(name,  GroupsTest.class.getName());
+	}
+	
+	@Test
+	public void importResourceWithGroupsTest() throws Exception {
+		importResource("with_groups.csar");
+	}
+	
+	@Test
+	public void importResourceWitIncorrectCapabilityNameTest() throws Exception {
+		RestResponse createResource = getCreateResourceRestResponse(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, "incorrect_cap.csar", csarsFilePath);
+		BaseRestUtils.checkErrorResponse(createResource, ActionStatus.MISSING_CAPABILITIES,(Lists.newArrayList("vlan_assignment1")).toString(), "group", "x_group");
+	}
+	
+	@Test
+	public void importResourceWithoutCapabilitiesTest() throws Exception {
+		Resource resource =  importResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, "without_caps.csar", csarsFilePath);
+		validateComponentGroupCapabilityPropertyValue(resource, null);
+	}
+	
+	@Test
+	public void updateResourceWithGroupsTest() throws Exception {
+		Resource resource = importResource("with_groups.csar");
+		updateResource(resource, "with_groups_update.csar");
+	}
+
+	@Test
+	public void supportGroupsWithCapabilitiesServiceLevelTest() throws Exception {
+		Resource resource = importCertifiedResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, "VLANTaggingFromAmdox1303_2018.csar", csarsFilePath);
+        CapReqDef caps = ComponentInstanceRestUtils.getInstancesCapabilitiesRequirements(resource, UserRoleEnum.DESIGNER.getUserId());
+		validateVlanAssignmentGroupCapabilitiesInvisible(caps.getCapabilities());
+
+        Service service1 = createCertifiedServiceWithInstance(ServiceCategoriesEnum.MOBILITY, resource);
+        caps = ComponentInstanceRestUtils.getInstancesCapabilitiesRequirements(service1, UserRoleEnum.DESIGNER.getUserId());
+		validateVlanAssignmentGroupCapabilitiesVisible(caps.getCapabilities());
+
+        Service service2 = createCertifiedServiceWithInstance(ServiceCategoriesEnum.NETWORK_L4, resource);
+        caps = ComponentInstanceRestUtils.getInstancesCapabilitiesRequirements(service2, UserRoleEnum.DESIGNER.getUserId());
+		validateVlanAssignmentGroupCapabilitiesVisible(caps.getCapabilities());
+
+        Service serviceContainer = createCertifiedServiceWithProxyInstances(ServiceCategoriesEnum.NETWORK_L3, service1, service2);
+        caps = ComponentInstanceRestUtils.getInstancesCapabilitiesRequirements(serviceContainer, UserRoleEnum.DESIGNER.getUserId());
+		validateVlanAssignmentGroupCapabilitiesVisible(caps.getCapabilities());
+
+        assertTrue(serviceContainer.getComponentInstances()!=null);
+    }
+
+	private void validateVlanAssignmentGroupCapabilitiesVisible(Map<String, List<CapabilityDefinition>> capabilities) {
+		if(MapUtils.isNotEmpty(capabilities)){
+			validateVlanAssignmentGroupCapabilitiesVisibility(capabilities, true);
+		}
+	}
+
+	private void validateVlanAssignmentGroupCapabilitiesInvisible(Map<String, List<CapabilityDefinition>> capabilities) {
+		if(MapUtils.isNotEmpty(capabilities)){
+			validateVlanAssignmentGroupCapabilitiesVisibility(capabilities, false);
+		}
+	}
+    private void validateVlanAssignmentGroupCapabilitiesVisibility(Map<String, List<CapabilityDefinition>> capabilities, boolean shouldBeVisible) {
+		assertTrue(capabilities.containsKey("org.openecomp.capabilities.VLANAssignment") == shouldBeVisible);
+    }
+
+    private Service createCertifiedServiceWithProxyInstances(ServiceCategoriesEnum category, Service service1, Service service2) throws Exception {
+        Either<Service, RestResponse> createServiceRes = createServiceByCategory(category, UserRoleEnum.DESIGNER, true);
+        assertTrue(createServiceRes.isLeft());
+        Either<ComponentInstance, RestResponse> result = addComponentInstanceToComponentContainer(service1, createServiceRes.left().value());
+        assertTrue(result.isLeft());
+        result = addComponentInstanceToComponentContainer(service2, createServiceRes.left().value());
+        assertTrue(result.isLeft());
+        return certifyService(createServiceRes);
+    }
+
+    private Service createCertifiedServiceWithInstance(ServiceCategoriesEnum category, Resource resource) throws Exception {
+        Either<Service, RestResponse> createServiceRes = createServiceByCategory(category, UserRoleEnum.DESIGNER, true);
+        assertTrue(createServiceRes.isLeft());
+        Either<ComponentInstance, RestResponse> result = addComponentInstanceToComponentContainer(resource, createServiceRes.left().value());
+        assertTrue(result.isLeft());
+        return certifyService(createServiceRes);
+    }
+
+    private Service certifyService(Either<Service, RestResponse> serviceProxy1) throws Exception {
+        Service service = getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceProxy1.left().value().getName(), "0.1" );
+        assertNotNull(service);
+        ServiceReqDetails serviceReqDetails = new ServiceReqDetails(service);
+        RestResponse restResponseService = LCSbaseTest.certifyService(serviceReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+        assertTrue(restResponseService.getErrorCode()==200);
+        return getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceProxy1.left().value().getName(), "1.0" );
+    }
+
+    private static Resource updateResource(Resource resource, String csarFileName) throws Exception {
+		Resource updatedResource = updateResourceFromCsar(resource, UserRoleEnum.DESIGNER, csarFileName, csarsFilePath);
+		validateComponentGroupCapabilityPropertyValue(updatedResource, "new_value");
+		return updatedResource;
+	}
+
+	private static Resource importResource(String csarFileName) throws Exception {
+		Resource resource = importResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, csarFileName, csarsFilePath);
+		validateComponentGroupCapabilityPropertyValue(resource, "success");
+		return resource;
+	}
+
+	private static void validateComponentGroupCapabilityPropertyValue(Component component, String propertyValue) {
+		assertNotNull(component);
+		assertNotNull(component.getGroups());
+		assertFalse(component.getGroups().isEmpty());
+		assertTrue(component.getGroups().size() == 5);
+		Optional<GroupDefinition> vfcInstanceGroup = component.getGroups().stream().filter(g->g.getName().equals(groupName)).findFirst();
+		assertTrue(vfcInstanceGroup.isPresent());
+		assertFalse(vfcInstanceGroup.get().getCapabilities().isEmpty());
+		assertTrue(vfcInstanceGroup.get().getCapabilities().size() == 1);
+		assertNotNull(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment"));
+		assertTrue(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").size() == 1);
+		assertNotNull(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0));
+		assertTrue(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getName().equals(capabilityName));
+		assertNotNull(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getProperties());
+		assertTrue(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getProperties().size() == 1);
+		assertTrue(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getProperties().get(0).getName().equals(propertyName));
+		if(propertyValue == null)
+			assertNull(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getProperties().get(0).getValue());
+		else
+			assertTrue(vfcInstanceGroup.get().getCapabilities().get("org.openecomp.capabilities.VLANAssignment").get(0).getProperties().get(0).getValue().equals(propertyValue));
+	}
+	
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
index 6b351c1..5650275 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
@@ -20,28 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
 import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
-import org.openecomp.sdc.be.model.Component;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
@@ -56,6 +40,15 @@
 import org.testng.annotations.Test;
 import org.yaml.snakeyaml.Yaml;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import static org.junit.Assert.*;
+
 public class CsarUtilsTest extends ComponentBaseTest {
 	
 	public static final String ASSET_TOSCA_TEMPLATE = "assettoscatemplate";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
index a6088de..3f017f4 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
@@ -20,70 +20,40 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
+import com.google.gson.Gson;
+import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
 import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstInputsMap;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceInput;
-import org.openecomp.sdc.be.model.ComponentInstancePropInput;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.InputDefinition;
-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.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
 import org.openecomp.sdc.common.api.Constants;
 import org.testng.annotations.Test;
 import org.yaml.snakeyaml.Yaml;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonParser;
-import com.google.gson.reflect.TypeToken;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+import static org.junit.Assert.*;
 
 public class ExportToscaTest extends ComponentBaseTest {
 	@Rule
@@ -283,7 +253,9 @@
 		Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csar_1");
 		RestResponse checkinState = LifecycleRestUtils.changeComponentState(createdResource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
 		BaseRestUtils.checkSuccess(checkinState);
-		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(
+				"ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId(), 
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 		
 		//2 create service
 		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
@@ -377,7 +349,6 @@
 
 	}
 
-	
 	// ----------------------------------------
 	private void validateInput(InputDefinition inputDef, Map<String, Object> inputInFile) {
 		assertEquals("validate input type", inputDef.getType(), (String) inputInFile.get("type"));
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
index 8ea6670..eed1058 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
@@ -20,23 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
+import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.WordUtils;
 import org.junit.Rule;
@@ -44,46 +28,34 @@
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.*;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 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.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.GroupRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.util.ValidationUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.*;
 
 public class ImportCsarResourceTest extends ComponentBaseTest {
 	private static Logger log = LoggerFactory.getLogger(ImportCsarResourceTest.class.getName());
@@ -558,10 +530,10 @@
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKIN);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
-		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+/*		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.STARTCERTIFICATION);
-		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);*/
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.CERTIFY);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKOUT);
@@ -1554,10 +1526,10 @@
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKIN);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
-		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+/*		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.STARTCERTIFICATION);
-		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);*/
 		lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.CERTIFY);
 		LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
 		Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(lifecycleChangeResponse.getResponse(), Resource.class);
@@ -1566,7 +1538,9 @@
 		User modifier = new User();
 		modifier.setUserId(designerUserId);
 
-		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY, designerUserId);
+		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(
+				"newtestservice1", ServiceCategoriesEnum.MOBILITY, designerUserId,
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 		
 		RestResponse serviceRes = ServiceRestUtils.createService(serviceDetails, modifier);
 		ResourceRestUtils.checkCreateResponse(serviceRes);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
index 873d339..f10aa5d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
@@ -20,22 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import com.google.gson.Gson;
+import fj.data.Either;
 import org.apache.http.HttpStatus;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -53,11 +39,7 @@
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ImportTestTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.RespJsonKeysEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.execute.TODO.ImportCapabilityTypeCITest;
@@ -74,9 +56,14 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.Map.Entry;
 
-import fj.data.Either;
+import static org.testng.AssertJUnit.*;
 
 public class ImportGenericResourceCITest extends ComponentBaseTest {
 	private static Logger log = LoggerFactory.getLogger(ImportGenericResourceCITest.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
index 61c8462..f529f00 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
@@ -20,18 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.http.HttpStatus;
 import org.junit.Rule;
@@ -46,12 +35,7 @@
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ImportTestTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -70,1455 +54,1458 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.*;
+
+import static org.testng.AssertJUnit.*;
 
 public class ImportNewResourceCITest extends ComponentBaseTest {
 
-	// public static UserUtils userUtils = new UserUtils();
-	// public ResourceUtils resourceUtils = new ResourceUtils();
-	// public AuditValidationUtils AuditValidationUtils = new
-	// AuditValidationUtils();
-	// protected ArtifactUtils artifactUtils = new ArtifactUtils();
+    // public static UserUtils userUtils = new UserUtils();
+    // public ResourceUtils resourceUtils = new ResourceUtils();
+    // public AuditValidationUtils AuditValidationUtils = new
+    // AuditValidationUtils();
+    // protected ArtifactUtils artifactUtils = new ArtifactUtils();
 
-	protected String resourceVersion = null;
-	protected String auditAction = null;
-	public User sdncModifierDetails = new User();
-	protected String artifactName1 = "data_artifact1.sh";
-	protected String artifactName2 = "data_artifact2.sh";
-	protected String interfaze = "standard";
-	protected String interfaceArtifactName = "data_interface1.sh";
+    protected String resourceVersion = null;
+    protected String auditAction = null;
+    public User sdncModifierDetails = new User();
+    protected String artifactName1 = "data_artifact1.sh";
+    protected String artifactName2 = "data_artifact2.sh";
+    protected String interfaze = "standard";
+    protected String interfaceArtifactName = "data_interface1.sh";
 
-	private String SPECIAL_CHARACTERS = "~!#@~$%^*()[];:'\"|\\/";
+    private String SPECIAL_CHARACTERS = "~!#@~$%^*()[];:'\"|\\/";
 
-	public ResourceReqDetails resourceDetails = new ResourceReqDetails();
+    public ResourceReqDetails resourceDetails = new ResourceReqDetails();
 
-	public Gson gson = new Gson();
+    public Gson gson = new Gson();
 
-	@Rule
-	public static TestName name = new TestName();
+    @Rule
+    public static TestName name = new TestName();
 
-	public ImportNewResourceCITest() {
-		super(name, ImportNewResourceCITest.class.getName());
-	}
+    public ImportNewResourceCITest() {
+        super(name, ImportNewResourceCITest.class.getName());
+    }
 
-	@BeforeMethod
-	public void before() throws Exception {
+    @BeforeMethod
+    public void before() throws Exception {
 
-		// init user
-		sdncModifierDetails.setUserId(UserRoleEnum.ADMIN.getUserId());
-		// init resource details
-		resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
-				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
-	}
+        // init user
+        sdncModifierDetails.setUserId(UserRoleEnum.ADMIN.getUserId());
+        // init resource details
+        resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
+                ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
+    }
 
-	@Test
-	public void importAllTestResources_toValidateNewAPI() throws Exception {
+    @Test
+    public void importAllTestResources_toValidateNewAPI() throws Exception {
 
-		for (ImportTestTypesEnum currResource : ImportTestTypesEnum.values()) {
-			// clean audit
-			DbUtils.cleanAllAudits();
+        for (ImportTestTypesEnum currResource : ImportTestTypesEnum.values()) {
+            // clean audit
+            DbUtils.cleanAllAudits();
 
-			// import testResources trough newResource API
-			RestResponse importResponse = ImportRestUtils.importNewResourceByName(currResource.getFolderName(),
-					UserRoleEnum.ADMIN);
-			System.err.println("import Resource " + "<" + currResource.getFolderName() + ">" + "response: "
-					+ importResponse.getErrorCode());
+            // import testResources trough newResource API
+            RestResponse importResponse = ImportRestUtils.importNewResourceByName(currResource.getFolderName(),
+                    UserRoleEnum.ADMIN);
+            System.err.println("import Resource " + "<" + currResource.getFolderName() + ">" + "response: "
+                    + importResponse.getErrorCode());
 
-			// validate response
-			ImportRestUtils.validateImportTestTypesResp(currResource, importResponse);
-			if (currResource.getvalidateAudit() == true) {
-				// validate audit
-				// String baseVersion="0.1";
-				String baseVersion = "";
-				ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(currResource.getActionStatus().name());
-				ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
-				String auditAction = "ResourceImport";
-				expectedResourceAuditJavaObject.setAction(auditAction);
-				expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
-				expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
-				expectedResourceAuditJavaObject.setResourceName(currResource.getNormativeName());
-				expectedResourceAuditJavaObject.setResourceType("Resource");
-				expectedResourceAuditJavaObject.setPrevVersion("");
-				expectedResourceAuditJavaObject.setCurrVersion(baseVersion);
-				expectedResourceAuditJavaObject.setPrevState("");
-				// expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-				expectedResourceAuditJavaObject.setCurrState("");
-				expectedResourceAuditJavaObject.setComment(null);
-				expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-				List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams()
-						: new ArrayList<String>());
-				String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-				expectedResourceAuditJavaObject.setDesc(auditDesc);
-				AuditValidationUtils.validateAuditImport(expectedResourceAuditJavaObject, auditAction);
-			}
-		}
-	}
+            // validate response
+            ImportRestUtils.validateImportTestTypesResp(currResource, importResponse);
+            if (currResource.getvalidateAudit() == true) {
+                // validate audit
+                // String baseVersion="0.1";
+                String baseVersion = "";
+                ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(currResource.getActionStatus().name());
+                ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+                String auditAction = "ResourceImport";
+                expectedResourceAuditJavaObject.setAction(auditAction);
+                expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
+                expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
+                expectedResourceAuditJavaObject.setResourceName(currResource.getNormativeName());
+                expectedResourceAuditJavaObject.setResourceType("Resource");
+                expectedResourceAuditJavaObject.setPrevVersion("");
+                expectedResourceAuditJavaObject.setCurrVersion(baseVersion);
+                expectedResourceAuditJavaObject.setPrevState("");
+                // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
+                expectedResourceAuditJavaObject.setCurrState("");
+                expectedResourceAuditJavaObject.setComment(null);
+                expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+                List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams()
+                        : new ArrayList<String>());
+                String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+                expectedResourceAuditJavaObject.setDesc(auditDesc);
+                AuditValidationUtils.validateAuditImport(expectedResourceAuditJavaObject, auditAction);
+            }
+        }
+    }
 
-	protected RestResponse importNewResource(UserRoleEnum userRoleEnum) throws Exception {
+    protected RestResponse importNewResource(UserRoleEnum userRoleEnum) throws Exception {
 
-		// init user
-		sdncModifierDetails.setUserId(userRoleEnum.getUserId());
-		// init resource details
-		resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
-				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
-		// clean ES DB
-		DbUtils.cleanAllAudits();
-		// import new resource (expected checkOut state)
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test", userRoleEnum);
-		return importResponse;
-	}
+        // init user
+        sdncModifierDetails.setUserId(userRoleEnum.getUserId());
+        // init resource details
+        resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
+                ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
+        // clean ES DB
+        DbUtils.cleanAllAudits();
+        // import new resource (expected checkOut state)
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test", userRoleEnum);
+        return importResponse;
+    }
 
-	@Test(enabled = false)
-	public void importUIResource() throws IOException {
-		String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n"
-				+ "  org.openecomp.resource.importResource4test:\r\n" + "    derived_from: tosca.nodes.Root\r\n"
-				+ "    description: someDesc";
+    @Test(enabled = false)
+    public void importUIResource() throws IOException {
+        String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n"
+                + "  org.openecomp.resource.importResource4test:\r\n" + "    derived_from: tosca.nodes.Root\r\n"
+                + "    description: someDesc";
 
-		String encodedPayload = new String(Base64.encodeBase64(payload.getBytes()));
+        String encodedPayload = new String(Base64.encodeBase64(payload.getBytes()));
 
-		String json = "{\r\n" + "  \"resourceName\": \"importResource4test\",\r\n"
-				+ "  \"payloadName\": \"importResource4test.yml\",\r\n"
-				+ "  \"categories\": [{\"name\": \"Application L4+\",\"normalizedName\": \"application l4+\",\"uniqueId\": \"resourceNewCategory.application l4+\",\"subcategories\": [{\"name\": \"Web Server\"}]}],\r\n"
-				+ "  \"description\": \"ResourceDescription\",\r\n" + "  \"vendorName\": \"VendorName\",\r\n"
-				+ "  \"vendorRelease\": \"VendorRelease\",\r\n" + "  \"contactId\": \"AT1234\",\r\n"
-				+ "  \"icon\": \"router\",\r\n" + "  \"tags\": [\r\n" + "    \"importResource4test\"\r\n" + "  ],\r\n"
-				+ "  \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
+        String json = "{\r\n" + "  \"resourceName\": \"importResource4test\",\r\n"
+                + "  \"payloadName\": \"importResource4test.yml\",\r\n"
+                + "  \"categories\": [{\"name\": \"Application L4+\",\"normalizedName\": \"application l4+\",\"uniqueId\": \"resourceNewCategory.application l4+\",\"subcategories\": [{\"name\": \"Web Server\"}]}],\r\n"
+                + "  \"description\": \"ResourceDescription\",\r\n" + "  \"vendorName\": \"VendorName\",\r\n"
+                + "  \"vendorRelease\": \"VendorRelease\",\r\n" + "  \"contactId\": \"AT1234\",\r\n"
+                + "  \"icon\": \"router\",\r\n" + "  \"tags\": [\r\n" + "    \"importResource4test\"\r\n" + "  ],\r\n"
+                + "  \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
 
-		String md5 = GeneralUtility.calculateMD5Base64EncodedByString(json);
+        String md5 = GeneralUtility.calculateMD5Base64EncodedByString(json);
 
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.MD5_HEADER, md5);
-		headers.put(Constants.USER_ID_HEADER, UserRoleEnum.ADMIN.getUserId());
-		headers.put(Constants.CONTENT_TYPE_HEADER, "application/json");
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put(Constants.MD5_HEADER, md5);
+        headers.put(Constants.USER_ID_HEADER, UserRoleEnum.ADMIN.getUserId());
+        headers.put(Constants.CONTENT_TYPE_HEADER, "application/json");
 
-		String url = String.format(Urls.CREATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
+        String url = String.format(Urls.CREATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
 
-		HttpRequest httpUtil = new HttpRequest();
-		RestResponse httpSendPost = httpUtil.httpSendPost(url, json, headers);
-		Integer errorCode = httpSendPost.getErrorCode();
-		assertTrue(errorCode == HttpStatus.SC_CREATED);
+        HttpRequest httpUtil = new HttpRequest();
+        RestResponse httpSendPost = httpUtil.httpSendPost(url, json, headers);
+        Integer errorCode = httpSendPost.getErrorCode();
+        assertTrue(errorCode == HttpStatus.SC_CREATED);
 
-	}
+    }
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_suc() throws Exception {
+    // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_suc() throws Exception {
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		// validate response
+        // validate response
 
-		resourceVersion = "0.1";
+        resourceVersion = "0.1";
 
-		// ResourceRespJavaObject resourceRespJavaObject =
-		// Convertor.constructFieldsForRespValidation(resourceDetails,
-		// resourceVersion);
-		// resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		// ResourceValidationUtils.validateResp(importResponse,
-		// resourceRespJavaObject);
-		//
-		// //validate get response
-		//
-		// RestResponse resourceGetResponse =
-		// ResourceRestUtils.getResource(sdncModifierDetails, resourceVersion);
-		// ResourceValidationUtils.validateResp(resourceGetResponse,
-		// resourceRespJavaObject);
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromImport);
+        // ResourceRespJavaObject resourceRespJavaObject =
+        // Convertor.constructFieldsForRespValidation(resourceDetails,
+        // resourceVersion);
+        // resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        // ResourceValidationUtils.validateResp(importResponse,
+        // resourceRespJavaObject);
+        //
+        // //validate get response
+        //
+        // RestResponse resourceGetResponse =
+        // ResourceRestUtils.getResource(sdncModifierDetails, resourceVersion);
+        // ResourceValidationUtils.validateResp(resourceGetResponse,
+        // resourceRespJavaObject);
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromImport);
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
-		resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
+        resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		// validate get response
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceRespJavaObject.getUniqueId());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // validate get response
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceRespJavaObject.getUniqueId());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// validate
-		ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
+        // validate
+        ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
 
-		// validate audit
-		resourceDetails.setVersion(resourceDetails.getVersion());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        // validate audit
+        resourceDetails.setVersion(resourceDetails.getVersion());
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
 
-		auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setPrevState("");
-		expectedResourceAuditJavaObject.setPrevVersion("");
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setStatus("201");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+        auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setPrevState("");
+        expectedResourceAuditJavaObject.setPrevVersion("");
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setStatus("201");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
 
-	}
+    }
 
-	@Test
-	public void importNewResource_byTester_failed() throws Exception {
+    @Test
+    public void importNewResource_byTester_failed() throws Exception {
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.TESTER);
+        RestResponse importResponse = importNewResource(UserRoleEnum.TESTER);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 409, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 409, importResponse.getErrorCode().intValue());
 
-	}
+    }
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existInCheckout_updateVendorName_updateCategory() throws Exception {
+    // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existInCheckout_updateVendorName_updateCategory() throws Exception {
 
-		// import new resource
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        // import new resource
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4testUpdateVendorNameAndCategory",
-				UserRoleEnum.ADMIN);
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4testUpdateVendorNameAndCategory",
+                UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
 
-		// validate response
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromImport);
+        // validate response
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromImport);
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
-		resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
+        resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		// validate get response
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceRespJavaObject.getUniqueId());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // validate get response
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceRespJavaObject.getUniqueId());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// validate
-		ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
+        // validate
+        ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
 
-		// validate audit
-		resourceDetails.setVersion(resourceDetails.getVersion());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails);
+        // validate audit
+        resourceDetails.setVersion(resourceDetails.getVersion());
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails);
 
-		auditAction = "ResourceImport";
-		resourceVersion = "0.1";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setStatus("200");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        auditAction = "ResourceImport";
+        resourceVersion = "0.1";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setStatus("200");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }
 
-	@Test
-	public void importNewResource_perfromByAdmin_ownedBy_diffrentUser() throws Exception {
+    @Test
+    public void importNewResource_perfromByAdmin_ownedBy_diffrentUser() throws Exception {
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.DESIGNER);
+        RestResponse importResponse = importNewResource(UserRoleEnum.DESIGNER);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		// clean audit
-		DbUtils.cleanAllAudits();
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		importResponse = importNewResource(UserRoleEnum.ADMIN);
+        importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
 
-		ErrorInfo errorInfo = ErrorValidationUtils
-				.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
-		assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
+        ErrorInfo errorInfo = ErrorValidationUtils
+                .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
+        assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
 
-		String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
-		String firstName = split[0];
-		String lastName = split[1];
-		List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
-				resourceFromImport.getLastUpdaterUserId());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
-				importResponse.getResponse());
+        String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
+        String firstName = split[0];
+        String lastName = split[1];
+        List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
+                resourceFromImport.getLastUpdaterUserId());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
+                importResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void importNewResource_perfromByDesigner_ownedBy_diffrentUser() throws Exception {
+    @Test
+    public void importNewResource_perfromByDesigner_ownedBy_diffrentUser() throws Exception {
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		// clean audit
-		DbUtils.cleanAllAudits();
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		importResponse = importNewResource(UserRoleEnum.DESIGNER);
+        importResponse = importNewResource(UserRoleEnum.DESIGNER);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
 
-		ErrorInfo errorInfo = ErrorValidationUtils
-				.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
-		assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
+        ErrorInfo errorInfo = ErrorValidationUtils
+                .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
+        assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
 
-		String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
-		String firstName = split[0];
-		String lastName = split[1];
-		List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
-				resourceFromImport.getLastUpdaterUserId());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
-				importResponse.getResponse());
+        String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
+        String firstName = split[0];
+        String lastName = split[1];
+        List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
+                resourceFromImport.getLastUpdaterUserId());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
+                importResponse.getResponse());
 
-	}
+    }
 
-	@Test(enabled = false)
-	public void importNewResource_nameSpace_vf() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVF",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		Resource resourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VF));
+    @Test(enabled = false)
+    public void importNewResource_nameSpace_vf() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVF",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        Resource resourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VF));
 
-	}
+    }
 
-	@Test
-	public void importNewResource_nameSpace_vfc() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVFC",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		Resource resourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
-	}
+    @Test
+    public void importNewResource_nameSpace_vfc() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVFC",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        Resource resourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
+    }
 
-	@Test
-	public void importNewResource_nameSpace_vl() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVL",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		Resource resourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VL));
+    @Test
+    public void importNewResource_nameSpace_vl() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVL",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        Resource resourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VL));
 
-	}
+    }
 
-	@Test
-	public void importNewResource_nameSpace_cp() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testCP",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+    @Test
+    public void importNewResource_nameSpace_cp() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testCP",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		Resource resourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.CP));
-	}
+        Resource resourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.CP));
+    }
 
-	@Test
-	public void importNewResource_nameSpace_unknown() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		Resource resourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
+    @Test
+    public void importNewResource_nameSpace_unknown() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        Resource resourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
 
-	}
+    }
 
-	@Test
-	public void importNewResource_MissingNameSpace() throws Exception {
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testMissingNameSpace",
-				UserRoleEnum.DESIGNER);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 400, importResponse.getErrorCode().intValue());
+    @Test
+    public void importNewResource_MissingNameSpace() throws Exception {
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testMissingNameSpace",
+                UserRoleEnum.DESIGNER);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 400, importResponse.getErrorCode().intValue());
 
-	}
+    }
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existInCheckOut() throws Exception {
+    // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existInCheckOut() throws Exception {
 
-		// import new resource
+        // import new resource
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in CHECKOUT state
+        // import new resource while resource already exist in CHECKOUT state
 
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
 
-		// validate response
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromImport);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
-		resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        // validate response
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromImport);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
+        resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		// validate get response
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceRespJavaObject.getUniqueId());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // validate get response
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceRespJavaObject.getUniqueId());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// validate
-		ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
+        // validate
+        ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
 
-		// validate audit
-		resourceDetails.setVersion(resourceDetails.getVersion());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails);
+        // validate audit
+        resourceDetails.setVersion(resourceDetails.getVersion());
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails);
 
-		auditAction = "ResourceImport";
-		resourceVersion = "0.1";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setStatus("200");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        auditAction = "ResourceImport";
+        resourceVersion = "0.1";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setStatus("200");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
 
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existIn_CheckIn_state() throws Exception {
+    // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existIn_CheckIn_state() throws Exception {
 
-		// import new resource
+        // import new resource
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		// checkIn resource
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        // checkIn resource
 
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
 
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in CHECKIN state
+        // import new resource while resource already exist in CHECKIN state
 
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
 
-		// validate response
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromImport);
+        // validate response
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromImport);
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
-		resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
+        resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		// validate get response
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceRespJavaObject.getUniqueId());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // validate get response
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceRespJavaObject.getUniqueId());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// validate
-		ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
+        // validate
+        ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
 
-		// validate audit
-		resourceDetails.setVersion(resourceDetails.getVersion());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails);
+        // validate audit
+        resourceDetails.setVersion(resourceDetails.getVersion());
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails);
 
-		resourceVersion = "0.2";
-		auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setStatus("200");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        resourceVersion = "0.2";
+        auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setStatus("200");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }
 
-	@Test
-	public void importNewResource_existIn_Ready4cert_state_performByTester() throws Exception {
-		// import new resource
+   /* @Test
+    public void importNewResource_existIn_Ready4cert_state_performByTester() throws Exception {
+        // import new resource
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		// add mandatory artifacts
-		// // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        // add mandatory artifacts
+        // // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
 
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(checkInResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(checkInResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(checkInResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(checkInResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in CHECKIN state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.TESTER);
+        // import new resource while resource already exist in CHECKIN state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.TESTER);
 
-		// validate response
-		resourceVersion = resourceDetails.getVersion();
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		assertNotNull("check response object is not null after create resouce", importResponse);
-		assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
-		assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
-		List<String> variables = Arrays.asList();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
-				importResponse.getResponse());
+        // validate response
+        resourceVersion = resourceDetails.getVersion();
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        assertNotNull("check response object is not null after create resouce", importResponse);
+        assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
+        assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
+        List<String> variables = Arrays.asList();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+                importResponse.getResponse());
 
-		// validate audit
+        // validate audit
 
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
 
-		String auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setResourceName("");
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.TESTER.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.TESTER.getUserName());
-		expectedResourceAuditJavaObject.setPrevState("");
-		expectedResourceAuditJavaObject.setCurrState("");
-		expectedResourceAuditJavaObject.setPrevVersion("");
-		expectedResourceAuditJavaObject.setCurrVersion("");
-		expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-		String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-		expectedResourceAuditJavaObject.setDesc(auditDesc);
+        String auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setResourceName("");
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.TESTER.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.TESTER.getUserName());
+        expectedResourceAuditJavaObject.setPrevState("");
+        expectedResourceAuditJavaObject.setCurrState("");
+        expectedResourceAuditJavaObject.setPrevVersion("");
+        expectedResourceAuditJavaObject.setCurrVersion("");
+        expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+        String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+        expectedResourceAuditJavaObject.setDesc(auditDesc);
 
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }*/
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existIn_Ready4cert_state_performByDesigner() throws Exception {
-		// import new resource
+   /* // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existIn_Ready4cert_state_performByDesigner() throws Exception {
+        // import new resource
 
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
 
-		// validate response
-		ErrorInfo errorInfo = ErrorValidationUtils
-				.parseErrorConfigYaml(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name());
-		assertNotNull("check response object is not null after create resouce", importResponse);
-		assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
-		assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
-		String[] split = resourceFromGet.getLastUpdaterFullName().split(" ");
-		String firstName = split[0];
-		String lastName = split[1];
-		List<String> variables = Arrays.asList(resourceFromGet.getName(), "resource", firstName, lastName,
-				resourceFromGet.getLastUpdaterUserId());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name(), variables,
-				importResponse.getResponse());
+        // validate response
+        ErrorInfo errorInfo = ErrorValidationUtils
+                .parseErrorConfigYaml(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name());
+        assertNotNull("check response object is not null after create resouce", importResponse);
+        assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
+        assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
+        String[] split = resourceFromGet.getLastUpdaterFullName().split(" ");
+        String firstName = split[0];
+        String lastName = split[1];
+        List<String> variables = Arrays.asList(resourceFromGet.getName(), "resource", firstName, lastName,
+                resourceFromGet.getLastUpdaterUserId());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name(), variables,
+                importResponse.getResponse());
 
-		// validate audit
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
-		String auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.DESIGNER.getUserName());
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.READY_FOR_CERTIFICATION).toString());
-		// expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState("");
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setCurrVersion("");
-		expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-		expectedResourceAuditJavaObject.setDesc(auditDesc);
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+        // validate audit
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        String auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.DESIGNER.getUserName());
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.READY_FOR_CERTIFICATION).toString());
+        // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState("");
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setCurrVersion("");
+        expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+        expectedResourceAuditJavaObject.setDesc(auditDesc);
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
 
-	}
+    }*/
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existIn_Ready4cert_state_performByAdmin() throws Exception {
+    /*// TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existIn_Ready4cert_state_performByAdmin() throws Exception {
 
-		// import new resource
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // import new resource
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
-		resourceVersion = resourceDetails.getVersion();
-		// resourceVersion="0.2";
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 200, importResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceVersion = resourceDetails.getVersion();
+        // resourceVersion="0.2";
 
-		// validate response
-		Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-		assertNotNull(resourceFromImport);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
-		resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        // validate response
+        Resource resourceFromImport = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+        assertNotNull(resourceFromImport);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        ResourceRespJavaObject resourceRespJavaObject = Convertor.constructFieldsForRespValidation(resourceDetails);
+        resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		// validate get response
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // validate get response
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// validate
-		ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
+        // validate
+        ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
 
-		// validate audit
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
-		auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setStatus("200");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        // validate audit
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setStatus("200");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }*/
 
-	@Test
-	public void importNewResource_existIn_CerInProgress_state_performByTester() throws Exception {
+   /* @Test
+    public void importNewResource_existIn_CerInProgress_state_performByTester() throws Exception {
 
-		// import new resource
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // import new resource
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// startCert
-		RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertNotNull("check response object is not null after resource request start certification", startCert);
-		assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // startCert
+        RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertNotNull("check response object is not null after resource request start certification", startCert);
+        assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.TESTER);
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.TESTER);
 
-		// validate response
-		resourceVersion = resourceDetails.getVersion();
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		assertNotNull("check response object is not null after create resouce", importResponse);
-		assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
-		assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
-		List<String> variables = Arrays.asList();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
-				importResponse.getResponse());
+        // validate response
+        resourceVersion = resourceDetails.getVersion();
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        assertNotNull("check response object is not null after create resouce", importResponse);
+        assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
+        assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
+        List<String> variables = Arrays.asList();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+                importResponse.getResponse());
 
-		// validate audit
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
-		String auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setResourceName("");
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.TESTER.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.TESTER.getUserName());
-		expectedResourceAuditJavaObject.setPrevState("");
-		expectedResourceAuditJavaObject.setCurrState("");
-		expectedResourceAuditJavaObject.setPrevVersion("");
-		expectedResourceAuditJavaObject.setCurrVersion("");
-		expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-		String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-		expectedResourceAuditJavaObject.setDesc(auditDesc);
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-	}
+        // validate audit
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        String auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setResourceName("");
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.TESTER.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.TESTER.getUserName());
+        expectedResourceAuditJavaObject.setPrevState("");
+        expectedResourceAuditJavaObject.setCurrState("");
+        expectedResourceAuditJavaObject.setPrevVersion("");
+        expectedResourceAuditJavaObject.setCurrVersion("");
+        expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+        String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+        expectedResourceAuditJavaObject.setDesc(auditDesc);
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+    }*/
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existIn_CerInProgress_state_performByDesigner() throws Exception {
+    /*// TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existIn_CerInProgress_state_performByDesigner() throws Exception {
 
-		User sdncAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		// import new resource
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        User sdncAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        // import new resource
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// startCert
-		RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertNotNull("check response object is not null after resource request start certification", startCert);
-		assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
-		resourceVersion = resourceDetails.getVersion();
+        // startCert
+        RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertNotNull("check response object is not null after resource request start certification", startCert);
+        assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceVersion = resourceDetails.getVersion();
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
-		ErrorInfo errorInfo = ErrorValidationUtils
-				.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
-		assertNotNull("check response object is not null after create resouce", importResponse);
-		assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
-		assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
-		List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
-				sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
-				variables, importResponse.getResponse());
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
+        ErrorInfo errorInfo = ErrorValidationUtils
+                .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+        assertNotNull("check response object is not null after create resouce", importResponse);
+        assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
+        assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
+        List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
+                sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
+                variables, importResponse.getResponse());
 
-		// validate audit
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
-		String auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.DESIGNER.getUserName());
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.CERTIFICATION_IN_PROGRESS).toString());
-		// expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState("");
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setCurrVersion("");
-		expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-		expectedResourceAuditJavaObject.setDesc(auditDesc);
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+        // validate audit
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        String auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.DESIGNER.getUserName());
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.CERTIFICATION_IN_PROGRESS).toString());
+        // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState("");
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setCurrVersion("");
+        expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+        expectedResourceAuditJavaObject.setDesc(auditDesc);
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
 
-	}
+    }*/
 
-	// TODO DE171337
-	@Test(enabled = false)
-	public void importNewResource_existIn_CerInProgress_state_performByAdmin() throws Exception {
+   /* // TODO DE171337
+    @Test(enabled = false)
+    public void importNewResource_existIn_CerInProgress_state_performByAdmin() throws Exception {
 
-		User sdncAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        User sdncAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
 
-		// import new resource
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
+        // import new resource
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
 
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// checkIn resource
-		resourceVersion = resourceDetails.getVersion();
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        // checkIn resource
+        resourceVersion = resourceDetails.getVersion();
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		// startCert
-		RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertNotNull("check response object is not null after resource request start certification", startCert);
-		assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
-		resourceVersion = resourceDetails.getVersion();
+        // startCert
+        RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertNotNull("check response object is not null after resource request start certification", startCert);
+        assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceVersion = resourceDetails.getVersion();
 
-		// clean audit
-		DbUtils.cleanAllAudits();
+        // clean audit
+        DbUtils.cleanAllAudits();
 
-		// import new resource while resource already exist in other state
-		importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
+        // import new resource while resource already exist in other state
+        importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
 
-		// validate response
-		ErrorInfo errorInfo = ErrorValidationUtils
-				.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
-		assertNotNull("check response object is not null after create resouce", importResponse);
-		assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
-		assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
-		List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
-				sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
-				variables, importResponse.getResponse());
+        // validate response
+        ErrorInfo errorInfo = ErrorValidationUtils
+                .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+        assertNotNull("check response object is not null after create resouce", importResponse);
+        assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
+        assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
+        List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
+                sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
+                variables, importResponse.getResponse());
 
-		// validate audit
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
-				.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
-		String auditAction = "ResourceImport";
-		expectedResourceAuditJavaObject.setAction(auditAction);
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.CERTIFICATION_IN_PROGRESS).toString());
-		// expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState("");
-		expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setCurrVersion("");
-		expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
-		expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-		String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
-		expectedResourceAuditJavaObject.setDesc(auditDesc);
-		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
+        // validate audit
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+                .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+        String auditAction = "ResourceImport";
+        expectedResourceAuditJavaObject.setAction(auditAction);
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.CERTIFICATION_IN_PROGRESS).toString());
+        // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState("");
+        expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setCurrVersion("");
+        expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
+        expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+        String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+        expectedResourceAuditJavaObject.setDesc(auditDesc);
+        AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
 
-	}
+    }*/
 
-	// TODO DE171337
-	// @Test(enabled = false)
-	// public void
-	// importNewResource_existIn_Certified_state_chnage_reqAndCap_byDesigner()
-	// throws Exception{
-	//
-	// // Andrey - set default artifact details
-	// ArtifactDefinition artifactDefinition =
-	// artifactUtils.constructDefaultArtifactInfo();
-	//
-	// // import new resource
-	// RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
-	// assertNotNull("check response object is not null after import resource",
-	// importResponse);
-	// assertNotNull("check error code exists in response after import
-	// resource", importResponse.getErrorCode());
-	// assertEquals("Check response code after import resource", 201,
-	// importResponse.getErrorCode().intValue());
-	// String resourceId =
-	// ResponseParser.getUniqueIdFromResponse(importResponse);
-	// resourceDetails =
-	// ResponseParser.parseToObject(importResponse.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceVersion = resourceDetails.getVersion();
-	// RestResponse resourceGetResponse =
-	// ResourceRestUtils.getResource(sdncModifierDetails,
-	// resourceDetails.getUniqueId());
-	// assertEquals("Check response code after get resource", 200,
-	// resourceGetResponse.getErrorCode().intValue());
-	// Resource resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-	// assertNotNull(resourceFromGet);
-	//
-	// // add mandatory artifacts
-	// // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-	// resourceGetResponse);
-	// resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-	// resourceDetails.getUniqueId());
-	// assertEquals("Check response code after get resource", 200,
-	// resourceGetResponse.getErrorCode().intValue());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-	// assertNotNull(resourceFromGet);
-	// resourceDetails =
-	// ResponseParser.parseToObject(importResponse.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceDetails.setVersion(resourceFromGet.getVersion());
-	//
-	// // add artifact
-	// artifactDefinition.setArtifactName(artifactName1);
-	// ArtifactRestUtils.addInformationalArtifactToResource(resourceDetails,
-	// sdncModifierDetails, resourceVersion , artifactDefinition);
-	//
-	// // add artifact
-	// artifactDefinition.setArtifactName(artifactName2);
-	// resourceUtils.add_artifact(resourceDetails, sdncModifierDetails,
-	// resourceVersion , artifactDefinition);
-	//
-	// // add interface
-	// artifactDefinition.setArtifactName(interfaceArtifactName);
-	// ResourceRestUtils.add_interface(resourceDetails, sdncModifierDetails,
-	// resourceVersion , artifactDefinition);
-	//
-	// //construct fields for validation
-	// resourceVersion="1.0";
-	//
-	// ResourceRespJavaObject resourceRespJavaObject =
-	// Convertor.constructFieldsForRespValidation(resourceDetails,
-	// resourceVersion);
-	// ArrayList<String> artifacts = new ArrayList<String>();
-	//
-	// artifacts.add(resourceId+":"+artifactName1);
-	// artifacts.add(resourceId+":"+artifactName2);
-	// resourceRespJavaObject.setArtifacts(artifacts);
-	// ArrayList<String> interfaces = new ArrayList<String>();
-	//
-	// interfaces.add(interfaze);
-	// resourceRespJavaObject.setInterfaces(interfaces);
-	//
-	// // checkIn resource
-	// resourceVersion = resourceDetails.getVersion();
-	// String checkinComment = "good checkin";
-	// String checkinComentJson = "{\"userRemarks\": \""+checkinComment+"\"}";
-	// RestResponse checkInResponse =
-	// LifecycleRestUtils.changeResourceState(resourceDetails,
-	// sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN,
-	// checkinComentJson);
-	// assertNotNull("check response object is not null after import resource",
-	// checkInResponse);
-	// assertEquals("Check response code after checkout resource", 200,
-	// checkInResponse.getErrorCode().intValue());
-	//
-	// // req4cert resource
-	// RestResponse request4cert =
-	// LifecycleRestUtils.changeResourceState(resourceDetails,
-	// sdncModifierDetails, resourceVersion,
-	// LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-	// assertNotNull("check response object is not null after resource request
-	// for certification", request4cert);
-	// assertEquals("Check response code after checkout resource", 200,
-	// request4cert.getErrorCode().intValue());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-	// assertNotNull(resourceFromGet);
-	// resourceDetails =
-	// ResponseParser.parseToObject(request4cert.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceDetails.setVersion(resourceFromGet.getVersion());
-	//
-	// // startCert
-	// RestResponse startCert =
-	// LifecycleRestUtils.changeResourceState(resourceDetails,
-	// sdncModifierDetails, resourceVersion,
-	// LifeCycleStatesEnum.STARTCERTIFICATION);
-	// assertNotNull("check response object is not null after resource request
-	// start certification", startCert);
-	// assertEquals("Check response code after checkout resource", 200,
-	// startCert.getErrorCode().intValue());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
-	// assertNotNull(resourceFromGet);
-	// resourceDetails = ResponseParser.parseToObject(startCert.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceDetails.setVersion(resourceFromGet.getVersion());
-	//
-	// // certify
-	// RestResponse certify =
-	// LifecycleRestUtils.changeResourceState(resourceDetails,
-	// sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFY);
-	// assertNotNull("check response object is not null after resource request
-	// certify", certify);
-	// assertEquals("Check response code after certify resource", 200,
-	// certify.getErrorCode().intValue());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(certify.getResponse());
-	// assertNotNull(resourceFromGet);
-	// resourceDetails = ResponseParser.parseToObject(certify.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceDetails.setVersion(resourceFromGet.getVersion());
-	//
-	// // clean audit
-	// DbUtils.cleanAllAudits();
-	//
-	// // change resource details
-	//
-	// // import new resource while resource already exist in other state
-	// importResponse =
-	// ImportRestUtils.importNewResourceByName("importResource4testUpdateWithoutReqCap",
-	// UserRoleEnum.ADMIN);
-	// assertNotNull("check response object is not null after import resource",
-	// importResponse);
-	// assertNotNull("check error code exists in response after import
-	// resource", importResponse.getErrorCode());
-	// assertEquals("Check response code after import resource", 200,
-	// importResponse.getErrorCode().intValue());
-	// resourceDetails =
-	// ResponseParser.parseToObject(importResponse.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceVersion = resourceDetails.getVersion();
-	// resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-	// resourceDetails.getUniqueId());
-	// assertEquals("Check response code after get resource", 200,
-	// resourceGetResponse.getErrorCode().intValue());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-	// assertNotNull(resourceFromGet);
-	//
-	// // validate response
-	// Resource resourceFromImport =
-	// ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
-	// assertNotNull(resourceFromImport);
-	//
-	// resourceDetails =
-	// ResponseParser.parseToObject(importResponse.getResponse(),
-	// ResourceReqDetails.class);
-	// resourceRespJavaObject =
-	// Convertor.constructFieldsForRespValidation(resourceDetails);
-	// resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-	//
-	// // validate get response
-	// resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-	// resourceRespJavaObject.getUniqueId());
-	// resourceFromGet =
-	// ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-	// assertNotNull(resourceFromGet);
-	//
-	// // validate
-	// ResourceValidationUtils.validateModelObjects(resourceFromImport,
-	// resourceFromGet);
-	//
-	// // validate audit
-	// ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
-	// Convertor.constructFieldsForAuditValidation(resourceDetails,
-	// resourceVersion);
-	// auditAction="ResourceImport";
-	// expectedResourceAuditJavaObject.setAction(auditAction);
-	// expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-	// expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-	// expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
-	// expectedResourceAuditJavaObject.setStatus("200");
-	// expectedResourceAuditJavaObject.setDesc("OK");
-	// expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
-	// AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
-	// auditAction, null, false);
-	// }
+    // TODO DE171337
+    // @Test(enabled = false)
+    // public void
+    // importNewResource_existIn_Certified_state_chnage_reqAndCap_byDesigner()
+    // throws Exception{
+    //
+    // // Andrey - set default artifact details
+    // ArtifactDefinition artifactDefinition =
+    // artifactUtils.constructDefaultArtifactInfo();
+    //
+    // // import new resource
+    // RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+    // assertNotNull("check response object is not null after import resource",
+    // importResponse);
+    // assertNotNull("check error code exists in response after import
+    // resource", importResponse.getErrorCode());
+    // assertEquals("Check response code after import resource", 201,
+    // importResponse.getErrorCode().intValue());
+    // String resourceId =
+    // ResponseParser.getUniqueIdFromResponse(importResponse);
+    // resourceDetails =
+    // ResponseParser.parseToObject(importResponse.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceVersion = resourceDetails.getVersion();
+    // RestResponse resourceGetResponse =
+    // ResourceRestUtils.getResource(sdncModifierDetails,
+    // resourceDetails.getUniqueId());
+    // assertEquals("Check response code after get resource", 200,
+    // resourceGetResponse.getErrorCode().intValue());
+    // Resource resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+    // assertNotNull(resourceFromGet);
+    //
+    // // add mandatory artifacts
+    // // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+    // resourceGetResponse);
+    // resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+    // resourceDetails.getUniqueId());
+    // assertEquals("Check response code after get resource", 200,
+    // resourceGetResponse.getErrorCode().intValue());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+    // assertNotNull(resourceFromGet);
+    // resourceDetails =
+    // ResponseParser.parseToObject(importResponse.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceDetails.setVersion(resourceFromGet.getVersion());
+    //
+    // // add artifact
+    // artifactDefinition.setArtifactName(artifactName1);
+    // ArtifactRestUtils.addInformationalArtifactToResource(resourceDetails,
+    // sdncModifierDetails, resourceVersion , artifactDefinition);
+    //
+    // // add artifact
+    // artifactDefinition.setArtifactName(artifactName2);
+    // resourceUtils.add_artifact(resourceDetails, sdncModifierDetails,
+    // resourceVersion , artifactDefinition);
+    //
+    // // add interface
+    // artifactDefinition.setArtifactName(interfaceArtifactName);
+    // ResourceRestUtils.add_interface(resourceDetails, sdncModifierDetails,
+    // resourceVersion , artifactDefinition);
+    //
+    // //construct fields for validation
+    // resourceVersion="1.0";
+    //
+    // ResourceRespJavaObject resourceRespJavaObject =
+    // Convertor.constructFieldsForRespValidation(resourceDetails,
+    // resourceVersion);
+    // ArrayList<String> artifacts = new ArrayList<String>();
+    //
+    // artifacts.add(resourceId+":"+artifactName1);
+    // artifacts.add(resourceId+":"+artifactName2);
+    // resourceRespJavaObject.setArtifacts(artifacts);
+    // ArrayList<String> interfaces = new ArrayList<String>();
+    //
+    // interfaces.add(interfaze);
+    // resourceRespJavaObject.setInterfaces(interfaces);
+    //
+    // // checkIn resource
+    // resourceVersion = resourceDetails.getVersion();
+    // String checkinComment = "good checkin";
+    // String checkinComentJson = "{\"userRemarks\": \""+checkinComment+"\"}";
+    // RestResponse checkInResponse =
+    // LifecycleRestUtils.changeResourceState(resourceDetails,
+    // sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN,
+    // checkinComentJson);
+    // assertNotNull("check response object is not null after import resource",
+    // checkInResponse);
+    // assertEquals("Check response code after checkout resource", 200,
+    // checkInResponse.getErrorCode().intValue());
+    //
+    // // req4cert resource
+    // RestResponse request4cert =
+    // LifecycleRestUtils.changeResourceState(resourceDetails,
+    // sdncModifierDetails, resourceVersion,
+    // LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+    // assertNotNull("check response object is not null after resource request
+    // for certification", request4cert);
+    // assertEquals("Check response code after checkout resource", 200,
+    // request4cert.getErrorCode().intValue());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+    // assertNotNull(resourceFromGet);
+    // resourceDetails =
+    // ResponseParser.parseToObject(request4cert.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceDetails.setVersion(resourceFromGet.getVersion());
+    //
+    // // startCert
+    // RestResponse startCert =
+    // LifecycleRestUtils.changeResourceState(resourceDetails,
+    // sdncModifierDetails, resourceVersion,
+    // LifeCycleStatesEnum.STARTCERTIFICATION);
+    // assertNotNull("check response object is not null after resource request
+    // start certification", startCert);
+    // assertEquals("Check response code after checkout resource", 200,
+    // startCert.getErrorCode().intValue());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
+    // assertNotNull(resourceFromGet);
+    // resourceDetails = ResponseParser.parseToObject(startCert.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceDetails.setVersion(resourceFromGet.getVersion());
+    //
+    // // certify
+    // RestResponse certify =
+    // LifecycleRestUtils.changeResourceState(resourceDetails,
+    // sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFY);
+    // assertNotNull("check response object is not null after resource request
+    // certify", certify);
+    // assertEquals("Check response code after certify resource", 200,
+    // certify.getErrorCode().intValue());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(certify.getResponse());
+    // assertNotNull(resourceFromGet);
+    // resourceDetails = ResponseParser.parseToObject(certify.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceDetails.setVersion(resourceFromGet.getVersion());
+    //
+    // // clean audit
+    // DbUtils.cleanAllAudits();
+    //
+    // // change resource details
+    //
+    // // import new resource while resource already exist in other state
+    // importResponse =
+    // ImportRestUtils.importNewResourceByName("importResource4testUpdateWithoutReqCap",
+    // UserRoleEnum.ADMIN);
+    // assertNotNull("check response object is not null after import resource",
+    // importResponse);
+    // assertNotNull("check error code exists in response after import
+    // resource", importResponse.getErrorCode());
+    // assertEquals("Check response code after import resource", 200,
+    // importResponse.getErrorCode().intValue());
+    // resourceDetails =
+    // ResponseParser.parseToObject(importResponse.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceVersion = resourceDetails.getVersion();
+    // resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+    // resourceDetails.getUniqueId());
+    // assertEquals("Check response code after get resource", 200,
+    // resourceGetResponse.getErrorCode().intValue());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+    // assertNotNull(resourceFromGet);
+    //
+    // // validate response
+    // Resource resourceFromImport =
+    // ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+    // assertNotNull(resourceFromImport);
+    //
+    // resourceDetails =
+    // ResponseParser.parseToObject(importResponse.getResponse(),
+    // ResourceReqDetails.class);
+    // resourceRespJavaObject =
+    // Convertor.constructFieldsForRespValidation(resourceDetails);
+    // resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+    //
+    // // validate get response
+    // resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+    // resourceRespJavaObject.getUniqueId());
+    // resourceFromGet =
+    // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+    // assertNotNull(resourceFromGet);
+    //
+    // // validate
+    // ResourceValidationUtils.validateModelObjects(resourceFromImport,
+    // resourceFromGet);
+    //
+    // // validate audit
+    // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
+    // Convertor.constructFieldsForAuditValidation(resourceDetails,
+    // resourceVersion);
+    // auditAction="ResourceImport";
+    // expectedResourceAuditJavaObject.setAction(auditAction);
+    // expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+    // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+    // expectedResourceAuditJavaObject.setPrevVersion(resourceVersion);
+    // expectedResourceAuditJavaObject.setStatus("200");
+    // expectedResourceAuditJavaObject.setDesc("OK");
+    // expectedResourceAuditJavaObject.setToscaNodeType(resourceFromGet.getToscaResourceName());
+    // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+    // auditAction, null, false);
+    // }
 
-	@Test
-	public void importNewResource_uuidTest() throws Exception {
-		RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
+    /*@Test
+    public void importNewResource_uuidTest() throws Exception {
+        RestResponse importResponse = importNewResource(UserRoleEnum.ADMIN);
 
-		assertNotNull("check response object is not null after import resource", importResponse);
-		assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
-		assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
-		String oldUuid = ResponseParser.getValueFromJsonResponse(importResponse.getResponse(), "uuid");
+        assertNotNull("check response object is not null after import resource", importResponse);
+        assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
+        assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
+        String oldUuid = ResponseParser.getValueFromJsonResponse(importResponse.getResponse(), "uuid");
 
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceVersion = resourceDetails.getVersion();
-		RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		Resource resourceFromGet = ResponseParser
-				.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		// add mandatory artifacts
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// resourceGetResponse);
-		resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
-		assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceVersion = resourceDetails.getVersion();
+        RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        Resource resourceFromGet = ResponseParser
+                .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        // add mandatory artifacts
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // resourceGetResponse);
+        resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+        assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				"0.1", LifeCycleStatesEnum.CHECKIN);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                "0.1", LifeCycleStatesEnum.CHECKIN);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		String newUuid = ResponseParser.getValueFromJsonResponse(checkInResponse.getResponse(), "uuid");
-		assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid));
+        String newUuid = ResponseParser.getValueFromJsonResponse(checkInResponse.getResponse(), "uuid");
+        assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid));
 
-		// req4cert resource
-		RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertNotNull("check response object is not null after resource request for certification", request4cert);
-		assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // req4cert resource
+        RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertNotNull("check response object is not null after resource request for certification", request4cert);
+        assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(request4cert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		String newUuid2 = ResponseParser.getValueFromJsonResponse(request4cert.getResponse(), "uuid");
-		assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid2));
+        String newUuid2 = ResponseParser.getValueFromJsonResponse(request4cert.getResponse(), "uuid");
+        assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid2));
 
-		// startCert
-		RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertNotNull("check response object is not null after resource request start certification", startCert);
-		assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
-		resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
-		assertNotNull(resourceFromGet);
-		resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
-		resourceDetails.setVersion(resourceFromGet.getVersion());
+        // startCert
+        RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertNotNull("check response object is not null after resource request start certification", startCert);
+        assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
+        resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
+        assertNotNull(resourceFromGet);
+        resourceDetails = ResponseParser.parseToObject(startCert.getResponse(), ResourceReqDetails.class);
+        resourceDetails.setVersion(resourceFromGet.getVersion());
 
-		String newUuid3 = ResponseParser.getValueFromJsonResponse(startCert.getResponse(), "uuid");
-		assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid3));
+        String newUuid3 = ResponseParser.getValueFromJsonResponse(startCert.getResponse(), "uuid");
+        assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid3));
 
-		RestResponse certify = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "0.1",
-				LifeCycleStatesEnum.CERTIFY);
-		assertNotNull("check response object is not null after import resource", certify);
-		assertEquals("Check response code after checkout resource", 200, certify.getErrorCode().intValue());
+        RestResponse certify = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "0.1",
+                LifeCycleStatesEnum.CERTIFY);
+        assertNotNull("check response object is not null after import resource", certify);
+        assertEquals("Check response code after checkout resource", 200, certify.getErrorCode().intValue());
 
-		String newUuid4 = ResponseParser.getValueFromJsonResponse(certify.getResponse(), "uuid");
-		assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid4));
+        String newUuid4 = ResponseParser.getValueFromJsonResponse(certify.getResponse(), "uuid");
+        assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid4));
 
-		RestResponse checkoutResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				"1.0", LifeCycleStatesEnum.CHECKOUT);
-		assertNotNull("check response object is not null after import resource", checkInResponse);
-		assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
+        RestResponse checkoutResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                "1.0", LifeCycleStatesEnum.CHECKOUT);
+        assertNotNull("check response object is not null after import resource", checkInResponse);
+        assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
 
-		String newUuid5 = ResponseParser.getValueFromJsonResponse(checkoutResponse.getResponse(), "uuid");
-		assertFalse(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid5));
-	}
+        String newUuid5 = ResponseParser.getValueFromJsonResponse(checkoutResponse.getResponse(), "uuid");
+        assertFalse(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid5));
+    }*/
 
-	@Test
-	public void importNewResource_propertiesMapInternalUrlCredential() throws Exception {
-		String folderName = "validateProporties_typeMap_valueUrlCredential";
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
+    @Test
+    public void importNewResource_propertiesMapInternalUrlCredential() throws Exception {
+        String folderName = "validateProporties_typeMap_valueUrlCredential";
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
 
-		Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
+        Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
 
-		List<PropertyDefinition> properties = resource.getProperties();
-		assertEquals("check properties size", 3, properties.size());
+        List<PropertyDefinition> properties = resource.getProperties();
+        assertEquals("check properties size", 3, properties.size());
 
-		PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
-				.findFirst().get();
-		String defaultValue = propertyDefinition.getDefaultValue();
+        PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
+                .findFirst().get();
+        String defaultValue = propertyDefinition.getDefaultValue();
 
-		Map mapValue = gson.fromJson(defaultValue, Map.class);
-		assertEquals("check Map value size", 2, mapValue.size());
-		checkMapValues(mapValue, "key", 1, null);
-		checkMapValues(mapValue, "key", 2, null);
+        Map mapValue = gson.fromJson(defaultValue, Map.class);
+        assertEquals("check Map value size", 2, mapValue.size());
+        checkMapValues(mapValue, "key", 1, null);
+        checkMapValues(mapValue, "key", 2, null);
 
-		System.err.println("import Resource " + "<" + folderName + ">" + "response: " + importResponse.getErrorCode());
+        System.err.println("import Resource " + "<" + folderName + ">" + "response: " + importResponse.getErrorCode());
 
-	}
+    }
 
-	@Test
-	public void importNewResource_propertiesListInternalUrlCredential() throws Exception {
-		String folderName = "validateProporties_typeList_valueUrlCredential";
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
+    @Test
+    public void importNewResource_propertiesListInternalUrlCredential() throws Exception {
+        String folderName = "validateProporties_typeList_valueUrlCredential";
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
 
-		Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
+        Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
 
-		List<PropertyDefinition> properties = resource.getProperties();
-		assertEquals("check properties size", 3, properties.size());
+        List<PropertyDefinition> properties = resource.getProperties();
+        assertEquals("check properties size", 3, properties.size());
 
-		PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
-				.findFirst().get();
-		String defaultValue = propertyDefinition.getDefaultValue();
+        PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
+                .findFirst().get();
+        String defaultValue = propertyDefinition.getDefaultValue();
 
-		List listValue = gson.fromJson(defaultValue, List.class);
-		assertEquals("check List value size", 2, listValue.size());
-		checkListValues(listValue.get(0), 1, SPECIAL_CHARACTERS);
-		checkListValues(listValue.get(1), 2, SPECIAL_CHARACTERS);
+        List listValue = gson.fromJson(defaultValue, List.class);
+        assertEquals("check List value size", 2, listValue.size());
+        checkListValues(listValue.get(0), 1, SPECIAL_CHARACTERS);
+        checkListValues(listValue.get(1), 2, SPECIAL_CHARACTERS);
 
-		// Verify attributes
-		List<PropertyDefinition> attributes = resource.getAttributes();
+        // Verify attributes
+        List<PropertyDefinition> attributes = resource.getAttributes();
 
-		assertEquals("check properties size", 2, attributes.size());
+        assertEquals("check properties size", 2, attributes.size());
 
-		// Verify attribute from type map
-		PropertyDefinition attributeMapDefinition = attributes.stream()
-				.filter(p -> p.getName().equals("validation_test_map")).findFirst().get();
-		String defaultMapValue = attributeMapDefinition.getDefaultValue();
-		Map attributeMapValue = gson.fromJson(defaultMapValue, Map.class);
-		assertEquals("check Map value size", 2, attributeMapValue.size());
-		checkMapValues(attributeMapValue, "key", 1, SPECIAL_CHARACTERS);
-		checkMapValues(attributeMapValue, "key", 2, SPECIAL_CHARACTERS);
+        // Verify attribute from type map
+        PropertyDefinition attributeMapDefinition = attributes.stream()
+                .filter(p -> p.getName().equals("validation_test_map")).findFirst().get();
+        String defaultMapValue = attributeMapDefinition.getDefaultValue();
+        Map attributeMapValue = gson.fromJson(defaultMapValue, Map.class);
+        assertEquals("check Map value size", 2, attributeMapValue.size());
+        checkMapValues(attributeMapValue, "key", 1, SPECIAL_CHARACTERS);
+        checkMapValues(attributeMapValue, "key", 2, SPECIAL_CHARACTERS);
 
-		// Verify attribute from type list
-		PropertyDefinition attributeListDefinition = attributes.stream()
-				.filter(p -> p.getName().equals("validation_test_list")).findFirst().get();
-		String defaultListValue = attributeListDefinition.getDefaultValue();
+        // Verify attribute from type list
+        PropertyDefinition attributeListDefinition = attributes.stream()
+                .filter(p -> p.getName().equals("validation_test_list")).findFirst().get();
+        String defaultListValue = attributeListDefinition.getDefaultValue();
 
-		List attributeListValue = gson.fromJson(defaultListValue, List.class);
-		assertEquals("check List value size", 2, attributeListValue.size());
-		checkListValues(attributeListValue.get(0), 1, SPECIAL_CHARACTERS);
-		checkListValues(attributeListValue.get(1), 2, SPECIAL_CHARACTERS);
+        List attributeListValue = gson.fromJson(defaultListValue, List.class);
+        assertEquals("check List value size", 2, attributeListValue.size());
+        checkListValues(attributeListValue.get(0), 1, SPECIAL_CHARACTERS);
+        checkListValues(attributeListValue.get(1), 2, SPECIAL_CHARACTERS);
 
-		System.err.println("import Resource " + "<" + folderName + ">" + "response: " + importResponse.getErrorCode());
+        System.err.println("import Resource " + "<" + folderName + ">" + "response: " + importResponse.getErrorCode());
 
-	}
+    }
 
-	private void checkListValues(Object object, int index, String suffix) {
+    private void checkListValues(Object object, int index, String suffix) {
 
-		Map map = (Map) object;
-		assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
-				map.get("protocol"));
-		assertEquals("check Map token value", "token" + index, map.get("token"));
-	}
+        Map map = (Map) object;
+        assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
+                map.get("protocol"));
+        assertEquals("check Map token value", "token" + index, map.get("token"));
+    }
 
-	// @Test
-	public void importNewResource_validateProporties_typeTestDataType() throws Exception {
-		String folderName = "validateProporties_typeTestDataType";
-		RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
+    // @Test
+    public void importNewResource_validateProporties_typeTestDataType() throws Exception {
+        String folderName = "validateProporties_typeTestDataType";
+        RestResponse importResponse = ImportRestUtils.importNewResourceByName(folderName, UserRoleEnum.DESIGNER);
 
-		Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
+        Resource resource = ResponseParser.parseToObjectUsingMapper(importResponse.getResponse(), Resource.class);
 
-	}
+    }
 
-	private void checkMapValues(Map mapValue, String key, int index, String suffix) {
+    private void checkMapValues(Map mapValue, String key, int index, String suffix) {
 
-		Map map1 = (Map) mapValue.get(key + index);
-		assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
-				map1.get("protocol"));
-		assertEquals("check Map token value", "token" + index, map1.get("token"));
+        Map map1 = (Map) mapValue.get(key + index);
+        assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
+                map1.get("protocol"));
+        assertEquals("check Map token value", "token" + index, map1.get("token"));
 
-	}
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaCapabilitiesWithProperties.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaCapabilitiesWithProperties.java
index 3d7c81a..4338a1b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaCapabilitiesWithProperties.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaCapabilitiesWithProperties.java
@@ -20,29 +20,14 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
+import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -54,7 +39,17 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 /**
  * US US730518 Story [BE] - TOSCA capabilities with properties - import "As a
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
index 9899a8c..7338645 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
@@ -20,24 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.http.client.ClientProtocolException;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -46,18 +28,7 @@
 import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.RelationshipImpl;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -65,11 +36,7 @@
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -78,13 +45,7 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
 import org.openecomp.sdc.ci.tests.utils.general.ImportUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.*;
 import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.api.ToscaNodeTypeInfo;
@@ -95,6 +56,13 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.*;
+
 /**
  * 
  * @author Andrey + Pavel + Shay
@@ -1269,12 +1237,12 @@
 		assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
 		importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
 
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue())*/;
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
@@ -1313,10 +1281,15 @@
 		RestResponse createResourceResponse = ResourceRestUtils.createResource(vf, sdncUserDetails);
 		ResourceRestUtils.checkCreateResponse(createResourceResponse);
 
-		LifecycleRestUtils.changeResourceState(importDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+		/*LifecycleRestUtils.changeResourceState(importDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		LifecycleRestUtils.changeResourceState(importReqDetails2, sdncUserDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+				LifeCycleStatesEnum.CERTIFICATIONREQUEST);*/
+		LifecycleRestUtils.changeResourceState(importDetails, sdncUserDetails,
+				LifeCycleStatesEnum.CERTIFY);
+		LifecycleRestUtils.changeResourceState(importReqDetails2, sdncUserDetails,
+				LifeCycleStatesEnum.CERTIFY);
 
 		RestResponse response = ResourceRestUtils.createResourceInstance(importDetails, sdncUserDetails,
 				vf.getUniqueId());
@@ -1378,14 +1351,15 @@
 		assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
 		importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
 
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+		//TODO Andrey should click on certify button
+		/*RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String fileName2 = "CaseInsensitiveCapTest_2.yml";
@@ -1439,15 +1413,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String derivedFromResourceName = importReqDetails.getName();
@@ -1524,15 +1498,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+		/*RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String derivedFromName = importReqDetails.getName();
@@ -1568,14 +1542,14 @@
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
 
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+		/*RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String derivedFromName = importReqDetails.getName();
@@ -1611,15 +1585,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue())*/;
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String fatherUniqueId = importReqDetails.getUniqueId();
@@ -1670,15 +1644,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String derivedFromName = importReqDetails.getName();
@@ -1721,15 +1695,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String derivedFromName = importReqDetails.getName();
@@ -1773,15 +1747,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String fatherUniqueId = importReqDetails.getUniqueId();
@@ -1850,15 +1824,15 @@
 		RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
 				null);
 		assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
-
-		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+//TODO Andrey should click on certify button
+/*		RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
 		RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
+		assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());*/
 		RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
 
 		String childFileName = "DifferentReqCapFromCompute1.yml";
@@ -1950,8 +1924,8 @@
 				LifeCycleStatesEnum.CHECKIN);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
-
-		// certification request
+//TODO Andrey should click on certify button
+		/*// certification request
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
@@ -1961,10 +1935,10 @@
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
 				LifeCycleStatesEnum.STARTCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
-		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
+		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));*/
 
 		// certify
-		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFY);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
@@ -1982,19 +1956,19 @@
 		assertEquals(STATUS_CODE_SUCCESS, updateResponse.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, updateResponse));
 
-		// certification request
+	/*	// certification request
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
-
+*/
 		// checkout resource
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CHECKOUT);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
-
-		// certification request
+//TODO Andrey should click on certify button
+/*		// certification request
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
@@ -2004,16 +1978,16 @@
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
 				LifeCycleStatesEnum.STARTCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
-		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
+		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));*/
 
-		// cancel certification
+		/*// cancel certification
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
 				LifeCycleStatesEnum.CANCELCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
-		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
+		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));*/
 
-		// start certification
-		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+		/*// start certification
+		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
 				LifeCycleStatesEnum.STARTCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
 		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
@@ -2022,7 +1996,7 @@
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
 				LifeCycleStatesEnum.FAILCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
-		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
+		assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));*/
 
 		// upload artifact
 		changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
index 9e8b94e..473e4f2 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
@@ -20,14 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.regex.Pattern;
-
+import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -48,7 +41,13 @@
 import org.openecomp.sdc.common.api.Constants;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import static org.testng.AssertJUnit.assertTrue;
 
 public class ImportUpdateResourseCsarTest extends ComponentBaseTest {
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
index 560e538..91cf3b0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
@@ -20,7 +20,25 @@
 
 package org.openecomp.sdc.ci.tests.execute.inputs;
 
-import static org.testng.AssertJUnit.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import fj.data.Either;
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+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.*;
+import org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -29,38 +47,7 @@
 import java.util.Map;
 import java.util.stream.Collectors;
 
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstInputsMap;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstancePropInput;
-import org.openecomp.sdc.be.model.InputDefinition;
-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.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-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.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils;
-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.validation.BaseValidationUtils;
-import org.testng.annotations.Test;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
 
 /**
  * CI-Tests for inputs 
@@ -91,7 +78,7 @@
 	 */
 	@Test
 	public void testCreateResourceInstanceWithInputsFromCsar() throws Exception {
-		Resource vf = AtomicOperationUtils.importResourceFromCSAR(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, inputCsar1);
+		Resource vf = AtomicOperationUtils.importResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, inputCsar1);
 		assertTrue("Success creating VF from CSAR", !vf.getInputs().isEmpty());
 	}
 	
@@ -181,7 +168,7 @@
 		Service service = createDefaultServiceEither.left().value();
 		
 		// Create VF from CSAR file
-		Resource vfWithInputs = AtomicOperationUtils.importResourceFromCSAR(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, inputCsar2);
+		Resource vfWithInputs = AtomicOperationUtils.importResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, inputCsar2);
 
 		// Certify VF
 		Pair<Component, RestResponse> changeComponentState = AtomicOperationUtils.changeComponentState(vfWithInputs, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
index e15652d..358e425 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
@@ -20,12 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.lifecycle;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-
 import org.apache.log4j.lf5.util.ResourceUtils;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -37,153 +31,146 @@
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.ArtifactUtils;
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.testng.annotations.BeforeMethod;
 
+import java.io.IOException;
+
+import static org.testng.AssertJUnit.*;
+
 /**
- * 
  * @author al714h
- * 
- *         resourceDetails - create, Add Heat, certify resourceDetails1 - create
- *         resource, LCS - CheckOut serviceDetails - create, add RI from
- *         resourceDetails serviceDetails2 - create, add RI from resourceDetails
- *         serviceDetailsEmpty - create, LCS - CheckOut serviceDetailsEmpty2 -
- *         create, LCS - CheckOut
- *
+ * <p>
+ * resourceDetails - create, Add Heat, certify resourceDetails1 - create
+ * resource, LCS - CheckOut serviceDetails - create, add RI from
+ * resourceDetails serviceDetails2 - create, add RI from resourceDetails
+ * serviceDetailsEmpty - create, LCS - CheckOut serviceDetailsEmpty2 -
+ * create, LCS - CheckOut
  */
 public abstract class LCSbaseTest extends ComponentBaseTest {
 
-	protected ResourceReqDetails resourceDetails;
-	protected ResourceReqDetails resourceDetails1;
-	protected ServiceReqDetails serviceDetails;
-	protected ServiceReqDetails serviceDetails2;
-	protected ServiceReqDetails serviceDetailsEmpty;
-	protected ServiceReqDetails serviceDetailsEmpty2;
-	protected ComponentInstanceReqDetails componentInstanceReqDetails;
-	protected ComponentInstanceReqDetails resourceInstanceReqDetails2;
-	protected User sdncDesignerDetails1;
-	protected User sdncDesignerDetails2;
-	protected static User sdncTesterDeatails1;
-	protected User sdncAdminDetails1;
-	protected ArtifactReqDetails heatArtifactDetails;
-	protected ArtifactReqDetails heatVolArtifactDetails;
-	protected ArtifactReqDetails heatNetArtifactDetails;
+    protected ResourceReqDetails resourceDetails;
+    protected ResourceReqDetails resourceDetails1;
+    protected ServiceReqDetails serviceDetails;
+    protected ServiceReqDetails serviceDetails2;
+    protected ServiceReqDetails serviceDetailsEmpty;
+    protected ServiceReqDetails serviceDetailsEmpty2;
+    protected ComponentInstanceReqDetails componentInstanceReqDetails;
+    protected ComponentInstanceReqDetails resourceInstanceReqDetails2;
+    protected User sdncDesignerDetails1;
+    protected User sdncDesignerDetails2;
+    protected static User sdncTesterDeatails1;
+    protected User sdncAdminDetails1;
+    protected ArtifactReqDetails heatArtifactDetails;
+    protected ArtifactReqDetails heatVolArtifactDetails;
+    protected ArtifactReqDetails heatNetArtifactDetails;
 
-	protected ArtifactReqDetails defaultArtifactDetails;
-	protected ResourceUtils resourceUtils;
-	protected ArtifactUtils artifactUtils;
+    protected ArtifactReqDetails defaultArtifactDetails;
+    protected ResourceUtils resourceUtils;
+    protected ArtifactUtils artifactUtils;
 
-	// protected static ServiceUtils serviceUtils = new ServiceUtils();
-	public LCSbaseTest(TestName testName, String className) {
-		super(testName, className);
-	}
+    // protected static ServiceUtils serviceUtils = new ServiceUtils();
+    public LCSbaseTest(TestName testName, String className) {
+        super(testName, className);
+    }
 
-	@BeforeMethod
-	public void before() throws Exception {
+    @BeforeMethod
+    public void before() throws Exception {
 
-		initializeMembers();
+        initializeMembers();
 
-		createComponents();
+        createComponents();
 
-	}
+    }
 
-	public void initializeMembers() throws IOException, Exception {
-		resourceDetails = ElementFactory.getDefaultResource();
-		// resourceDetails =
-		// ElementFactory.getDefaultResource("myNewResource1234567890",
-		// NormativeTypesEnum.ROOT, ResourceServiceCategoriesEnum.ROUTERS,
-		// UserRoleEnum.DESIGNER.getUserId());
-		resourceDetails1 = ElementFactory.getDefaultResource("secondResource", NormativeTypesEnum.ROOT);
-		serviceDetails = ElementFactory.getDefaultService();
-		serviceDetails2 = ElementFactory.getDefaultService("newTestService2", ServiceCategoriesEnum.MOBILITY, "al1976");
-		serviceDetailsEmpty = ElementFactory.getDefaultService("newEmptyService", ServiceCategoriesEnum.MOBILITY,
-				"al1976");
-		serviceDetailsEmpty2 = ElementFactory.getDefaultService("newEmptyService2", ServiceCategoriesEnum.MOBILITY,
-				"al1976");
-		sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		sdncDesignerDetails2 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2);
-		sdncTesterDeatails1 = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-		sdncAdminDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
-		heatNetArtifactDetails = ElementFactory
-				.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT_NET.getType());
-		heatVolArtifactDetails = ElementFactory
-				.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT_VOL.getType());
-		componentInstanceReqDetails = ElementFactory.getDefaultComponentInstance();
-		resourceInstanceReqDetails2 = ElementFactory.getDefaultComponentInstance();
+    public void initializeMembers() throws IOException, Exception {
+        resourceDetails = ElementFactory.getDefaultResource();
+        // resourceDetails =
+        // ElementFactory.getDefaultResource("myNewResource1234567890",
+        // NormativeTypesEnum.ROOT, ResourceServiceCategoriesEnum.ROUTERS,
+        // UserRoleEnum.DESIGNER.getUserId());
+        resourceDetails1 = ElementFactory.getDefaultResource("secondResource", NormativeTypesEnum.ROOT);
+        serviceDetails = ElementFactory.getDefaultService();
+		serviceDetails2 = ElementFactory.getDefaultService("newTestService2", ServiceCategoriesEnum.MOBILITY, "al1976", ServiceInstantiationType.A_LA_CARTE.getValue());
+        serviceDetailsEmpty = ElementFactory.getDefaultService("newEmptyService", ServiceCategoriesEnum.MOBILITY,
+				"al1976", ServiceInstantiationType.A_LA_CARTE.getValue());
+        serviceDetailsEmpty2 = ElementFactory.getDefaultService("newEmptyService2", ServiceCategoriesEnum.MOBILITY,
+				"al1976", ServiceInstantiationType.A_LA_CARTE.getValue());
+        sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        sdncDesignerDetails2 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2);
+        sdncTesterDeatails1 = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
+        sdncAdminDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+        heatNetArtifactDetails = ElementFactory
+                .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT_NET.getType());
+        heatVolArtifactDetails = ElementFactory
+                .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT_VOL.getType());
+        componentInstanceReqDetails = ElementFactory.getDefaultComponentInstance();
+        resourceInstanceReqDetails2 = ElementFactory.getDefaultComponentInstance();
 
-	}
+    }
 
-	protected void createComponents() throws Exception {
+    protected void createComponents() throws Exception {
 
-		RestResponse response = ResourceRestUtils.createResource(resourceDetails1, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("resource uniqueId is null:", resourceDetails1.getUniqueId());
+        RestResponse response = ResourceRestUtils.createResource(resourceDetails1, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("resource uniqueId is null:", resourceDetails1.getUniqueId());
 
-		response = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("resource uniqueId is null:", resourceDetails.getUniqueId());
+        response = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("resource uniqueId is null:", resourceDetails.getUniqueId());
 
-		response = ServiceRestUtils.createService(serviceDetails, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("service uniqueId is null:", serviceDetails.getUniqueId());
+        response = ServiceRestUtils.createService(serviceDetails, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("service uniqueId is null:", serviceDetails.getUniqueId());
 
-		ArtifactReqDetails heatArtifactDetails = ElementFactory
-				.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
-		response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails1,
-				resourceDetails.getUniqueId());
-		assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),
-				response.getErrorCode() == 200);
+        ArtifactReqDetails heatArtifactDetails = ElementFactory
+                .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+        response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails1,
+                resourceDetails.getUniqueId());
+        assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),
+                response.getErrorCode() == 200);
 
-		// certified resource
-		response = LCSbaseTest.certifyResource(resourceDetails, sdncDesignerDetails1);
-		assertTrue("certify resource request returned status:" + response.getErrorCode(),
-				response.getErrorCode() == 200);
+        // certified resource
+        response = LCSbaseTest.certifyResource(resourceDetails, sdncDesignerDetails1);
+        assertTrue("certify resource request returned status:" + response.getErrorCode(),
+                response.getErrorCode() == 200);
 
-		// add resource instance with HEAT deployment artifact to the service
-		componentInstanceReqDetails.setComponentUid(resourceDetails.getUniqueId());
-		response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncDesignerDetails1,
-				serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
-		assertTrue("response code is not 201, returned: " + response.getErrorCode(), response.getErrorCode() == 201);
+        // add resource instance with HEAT deployment artifact to the service
+        componentInstanceReqDetails.setComponentUid(resourceDetails.getUniqueId());
+        response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncDesignerDetails1,
+                serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
+        assertTrue("response code is not 201, returned: " + response.getErrorCode(), response.getErrorCode() == 201);
 
-		response = ServiceRestUtils.createService(serviceDetails2, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("service uniqueId is null:", serviceDetails2.getUniqueId());
+        response = ServiceRestUtils.createService(serviceDetails2, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("service uniqueId is null:", serviceDetails2.getUniqueId());
 
-		componentInstanceReqDetails.setComponentUid(resourceDetails.getUniqueId());
-		response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncDesignerDetails1,
-				serviceDetails2.getUniqueId(), ComponentTypeEnum.SERVICE);
-		assertTrue("response code is not 201, returned: " + response.getErrorCode(), response.getErrorCode() == 201);
+        componentInstanceReqDetails.setComponentUid(resourceDetails.getUniqueId());
+        response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncDesignerDetails1,
+                serviceDetails2.getUniqueId(), ComponentTypeEnum.SERVICE);
+        assertTrue("response code is not 201, returned: " + response.getErrorCode(), response.getErrorCode() == 201);
 
-		response = ServiceRestUtils.createService(serviceDetailsEmpty, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("service uniqueId is null:", serviceDetailsEmpty.getUniqueId());
+        response = ServiceRestUtils.createService(serviceDetailsEmpty, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("service uniqueId is null:", serviceDetailsEmpty.getUniqueId());
 
-		response = ServiceRestUtils.createService(serviceDetailsEmpty2, sdncDesignerDetails1);
-		assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
-		assertNotNull("service uniqueId is null:", serviceDetailsEmpty2.getUniqueId());
+        response = ServiceRestUtils.createService(serviceDetailsEmpty2, sdncDesignerDetails1);
+        assertTrue("create request returned status:" + response.getErrorCode(), response.getErrorCode() == 201);
+        assertNotNull("service uniqueId is null:", serviceDetailsEmpty2.getUniqueId());
 
-		DbUtils.cleanAllAudits();
+        DbUtils.cleanAllAudits();
 
-	}
+    }
 
-	public static RestResponse certifyResource(ResourceReqDetails resourceDetails, User user) throws Exception {
-		RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user.getUserId(),
-				LifeCycleStatesEnum.CHECKIN);
+    public static RestResponse certifyResource(ResourceReqDetails resourceDetails, User user) throws Exception {
+/*		RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user.getUserId(),
+                LifeCycleStatesEnum.CHECKIN);
 		// if (restResponseResource.getErrorCode() == 200){
 		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user.getUserId(),
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
@@ -199,76 +186,78 @@
 			restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
 					sdncTesterDeatails1.getUserId(), LifeCycleStatesEnum.CERTIFY);
 		}
-		return restResponseResource;
-	}
+		return restResponseResource;*/
+        return LifecycleRestUtils.changeResourceState(resourceDetails,
+                sdncTesterDeatails1.getUserId(), LifeCycleStatesEnum.CERTIFY);
+    }
 
-	public static RestResponse certifyService(ServiceReqDetails serviceDetails, User user) throws Exception {
-		RestResponse restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, user,
-				LifeCycleStatesEnum.CHECKIN);
-		// if (restResponseService.getErrorCode() == 200){
-		restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, user,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		// }else
-		// return restResponseService;
+    public static RestResponse certifyService(ServiceReqDetails serviceDetails, User user) throws Exception {
+        RestResponse restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, user,
+                LifeCycleStatesEnum.CHECKIN);
+        // if (restResponseService.getErrorCode() == 200){
+        restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, user,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        // }else
+        // return restResponseService;
 
-		sdncTesterDeatails1 = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-		if (restResponseService.getErrorCode() == 200) {
-			restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDeatails1,
-					LifeCycleStatesEnum.STARTCERTIFICATION);
-		} else
-			return restResponseService;
-		if (restResponseService.getErrorCode() == 200) {
-			restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDeatails1,
-					LifeCycleStatesEnum.CERTIFY);
-		}
-		return restResponseService;
-	}
+        sdncTesterDeatails1 = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
+        if (restResponseService.getErrorCode() == 200) {
+            restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDeatails1,
+                    LifeCycleStatesEnum.STARTCERTIFICATION);
+        } else
+            return restResponseService;
+        if (restResponseService.getErrorCode() == 200) {
+            restResponseService = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDeatails1,
+                    LifeCycleStatesEnum.CERTIFY);
+        }
+        return restResponseService;
+    }
 
-	protected static RestResponse raiseResourceToTargetVersion(ResourceReqDetails resourceDetails, String targetVersion,
-			User user) throws Exception {
-		return raiseResourceToTargetVersion(resourceDetails, targetVersion, null, user);
-	}
+    protected static RestResponse raiseResourceToTargetVersion(ResourceReqDetails resourceDetails, String targetVersion,
+                                                               User user) throws Exception {
+        return raiseResourceToTargetVersion(resourceDetails, targetVersion, null, user);
+    }
 
-	protected static RestResponse raiseResourceToTargetVersion(ResourceReqDetails resourceDetails, String targetVersion,
-			RestResponse prevResponse, User user) throws Exception {
+    protected static RestResponse raiseResourceToTargetVersion(ResourceReqDetails resourceDetails, String targetVersion,
+                                                               RestResponse prevResponse, User user) throws Exception {
 
-		String[] splitParts = targetVersion.split("\\.");
+        String[] splitParts = targetVersion.split("\\.");
 
-		int version = Integer.parseInt(splitParts[1]);
-		String checkinComment = "good checkin";
-		String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
+        int version = Integer.parseInt(splitParts[1]);
+        String checkinComment = "good checkin";
+        String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
 
-		if (prevResponse != null) {
-			Resource resourceRespJavaObject = ResponseParser
-					.convertResourceResponseToJavaObject(prevResponse.getResponse());
-			if (resourceRespJavaObject.getLifecycleState().equals(LifecycleStateEnum.CERTIFIED)) {
-				RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
-						user.getUserId(), LifeCycleStatesEnum.CHECKOUT);
-			}
-		}
+        if (prevResponse != null) {
+            Resource resourceRespJavaObject = ResponseParser
+                    .convertResourceResponseToJavaObject(prevResponse.getResponse());
+            if (resourceRespJavaObject.getLifecycleState().equals(LifecycleStateEnum.CERTIFIED)) {
+                RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
+                        user.getUserId(), LifeCycleStatesEnum.CHECKOUT);
+            }
+        }
 
-		RestResponse restResponseResource = null;
-		for (int i = 0; i < (version - 1); i++) {
+        RestResponse restResponseResource = null;
+        for (int i = 0; i < (version - 1); i++) {
 
-			restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, null,
-					LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-			if (restResponseResource.getErrorCode() == 200) {
-				restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user.getUserId(),
-						LifeCycleStatesEnum.CHECKOUT);
-				if (restResponseResource.getErrorCode() == 200) {
+            restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, null,
+                    LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+            if (restResponseResource.getErrorCode() == 200) {
+                restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user.getUserId(),
+                        LifeCycleStatesEnum.CHECKOUT);
+                if (restResponseResource.getErrorCode() == 200) {
 
-				} else
-					break;
+                } else
+                    break;
 
-			} else
-				break;
+            } else
+                break;
 
-		}
+        }
 
-		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, null,
-				LifeCycleStatesEnum.CHECKIN, checkinComentJson);
-		assertEquals("Check response code ", 200, restResponseResource.getErrorCode().intValue());
-		return restResponseResource;
-	}
+        restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, null,
+                LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+        assertEquals("Check response code ", 200, restResponseResource.getErrorCode().intValue());
+        return restResponseResource;
+    }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ChangeServiceInstanceVersionTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ChangeServiceInstanceVersionTest.java
index 6a4fa3b..99caea6 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ChangeServiceInstanceVersionTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ChangeServiceInstanceVersionTest.java
@@ -20,26 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_NOT_FOUND;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS_DELETE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_UNSUPPORTED_ERROR;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.Product;
-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.api.ComponentInstanceBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -48,1431 +33,1432 @@
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ChangeServiceInstanceVersionTest extends ComponentInstanceBaseTest {
 
-	protected ArtifactReqDetails heatArtifactDetails;
-	public String firstVfInstanceUniqueId;
-	public String firstVfInstanceName;
-	public String secondVfInstanceUniqueId;
-	public String secoundVfInstanceName;
-	public String serviceInstanceToReplaceUniqueId;
-	public String expectedServiceName;
-	public String expectedPosX;
-	public String expectedPosY;
-	public String actualServiceInstanceName;
-	public String actualPosX;
-	public String actualPosY;
+    protected ArtifactReqDetails heatArtifactDetails;
+    public String firstVfInstanceUniqueId;
+    public String firstVfInstanceName;
+    public String secondVfInstanceUniqueId;
+    public String secoundVfInstanceName;
+    public String serviceInstanceToReplaceUniqueId;
+    public String expectedServiceName;
+    public String expectedPosX;
+    public String expectedPosY;
+    public String actualServiceInstanceName;
+    public String actualPosX;
+    public String actualPosY;
 
-	@Rule
-	public static TestName name = new TestName();
+    @Rule
+    public static TestName name = new TestName();
 
-	public ChangeServiceInstanceVersionTest() {
-		super(name, ChangeServiceInstanceVersionTest.class.getName());
-	}
+    public ChangeServiceInstanceVersionTest() {
+        super(name, ChangeServiceInstanceVersionTest.class.getName());
+    }
 
-	@BeforeMethod
-	public void before() throws Exception {
-		firstVfInstanceName = null;
-		secoundVfInstanceName = null;
-		firstVfInstanceUniqueId = null;
-		secondVfInstanceUniqueId = null;
-		serviceInstanceToReplaceUniqueId = null;
-		expectedServiceName = null;
-		expectedPosX = null;
-		expectedPosY = null;
-		actualServiceInstanceName = null;
-		actualPosX = null;
-		actualPosY = null;
-		init();
-		createComponents();
-	}
+    @BeforeMethod
+    public void before() throws Exception {
+        firstVfInstanceName = null;
+        secoundVfInstanceName = null;
+        firstVfInstanceUniqueId = null;
+        secondVfInstanceUniqueId = null;
+        serviceInstanceToReplaceUniqueId = null;
+        expectedServiceName = null;
+        expectedPosX = null;
+        expectedPosY = null;
+        actualServiceInstanceName = null;
+        actualPosX = null;
+        actualPosY = null;
+        init();
+        createComponents();
+    }
 
-	private void createComponents() throws Exception {
-		heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
-		createAtomicResource(resourceDetailsVFC_01);
-		changeResourceStateToCertified(resourceDetailsVFC_01);
-		createAtomicResource(resourceDetailsCP_01);
-		changeResourceStateToCertified(resourceDetailsCP_01);
-		createAtomicResource(resourceDetailsVL_01);
-		changeResourceStateToCertified(resourceDetailsVL_01);
-		createAtomicResource(resourceDetailsVFC_02);
-		changeResourceStateToCertified(resourceDetailsVFC_02);
-		createAtomicResource(resourceDetailsCP_02);
-		changeResourceStateToCertified(resourceDetailsCP_02);
-		createAtomicResource(resourceDetailsVL_02);
-		changeResourceStateToCertified(resourceDetailsVL_02);
-		createVF(resourceDetailsVF_02);
-		createVF(resourceDetailsVF_01);
-		// create check-In services
-		createService(serviceDetails_01);
-		createService(serviceDetails_02);
-		createService(serviceDetails_03);
-		createProduct(productDetails_01);
-		createProduct(productDetails_02);
+    private void createComponents() throws Exception {
+        heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+        createAtomicResource(resourceDetailsVFC_01);
+        changeResourceStateToCertified(resourceDetailsVFC_01);
+        createAtomicResource(resourceDetailsCP_01);
+        changeResourceStateToCertified(resourceDetailsCP_01);
+        createAtomicResource(resourceDetailsVL_01);
+        changeResourceStateToCertified(resourceDetailsVL_01);
+        createAtomicResource(resourceDetailsVFC_02);
+        changeResourceStateToCertified(resourceDetailsVFC_02);
+        createAtomicResource(resourceDetailsCP_02);
+        changeResourceStateToCertified(resourceDetailsCP_02);
+        createAtomicResource(resourceDetailsVL_02);
+        changeResourceStateToCertified(resourceDetailsVL_02);
+        createVF(resourceDetailsVF_02);
+        createVF(resourceDetailsVF_01);
+        // create check-In services
+        createService(serviceDetails_01);
+        createService(serviceDetails_02);
+        createService(serviceDetails_03);
+        createProduct(productDetails_01);
+        createProduct(productDetails_02);
 
-		// add resourceDetailsCP_01 ,resourceDetailsVFC_01 and
-		// resourceDetailsCP_01 to resourceDetailsVF_01 and certify
-		// resourceDetailsVF_01
-		certifyVf(resourceDetailsVF_01, resourceDetailsVFC_02, resourceDetailsCP_01);
-		// add resourceDetailsCP_02 ,resourceDetailsVFC_02 and
-		// resourceDetailsVL_02 to resourceDetailsVF_02 and certify
-		// resourceDetailsVF_02
-		certifyVf(resourceDetailsVF_02, resourceDetailsVFC_02, resourceDetailsCP_02);
-		RestResponse createVFInstanceResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01,
-				sdncDesignerDetails); // serviceDetails_01 has certified
-										// resourceDetailsVF_01
-		firstVfInstanceName = ResponseParser.getNameFromResponse(createVFInstanceResponse);
-		createVFInstanceResponse = createVFInstanceDuringSetup(serviceDetails_02, resourceDetailsVF_02,
-				sdncDesignerDetails); // serviceDetails_01 has certified
-										// resourceDetailsVF_02
-		secoundVfInstanceName = ResponseParser.getUniqueIdFromResponse(createVFInstanceResponse);
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-	}
+        // add resourceDetailsCP_01 ,resourceDetailsVFC_01 and
+        // resourceDetailsCP_01 to resourceDetailsVF_01 and certify
+        // resourceDetailsVF_01
+        certifyVf(resourceDetailsVF_01, resourceDetailsVFC_02, resourceDetailsCP_01);
+        // add resourceDetailsCP_02 ,resourceDetailsVFC_02 and
+        // resourceDetailsVL_02 to resourceDetailsVF_02 and certify
+        // resourceDetailsVF_02
+        certifyVf(resourceDetailsVF_02, resourceDetailsVFC_02, resourceDetailsCP_02);
+        RestResponse createVFInstanceResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01,
+                sdncDesignerDetails); // serviceDetails_01 has certified
+        // resourceDetailsVF_01
+        firstVfInstanceName = ResponseParser.getNameFromResponse(createVFInstanceResponse);
+        createVFInstanceResponse = createVFInstanceDuringSetup(serviceDetails_02, resourceDetailsVF_02,
+                sdncDesignerDetails); // serviceDetails_01 has certified
+        // resourceDetailsVF_02
+        secoundVfInstanceName = ResponseParser.getUniqueIdFromResponse(createVFInstanceResponse);
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByPm() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+    @Test
+    public void changeServiceInstanceVersionByPm() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByAdmin() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// service [0.2] state to CERTIFICATIONREQUEST
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncAdminDetails, ComponentTypeEnum.PRODUCT,
-				true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+    @Test
+    public void changeServiceInstanceVersionByAdmin() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // service [0.2] state to CERTIFICATIONREQUEST
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncAdminDetails, ComponentTypeEnum.PRODUCT,
+                true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	@Test
-	public void changeServiceInstanceToOlderVersion() throws Exception {
-		// Get VF Instance UniquId [Service version 0.1]
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		ComponentInstance actualComponentInstance = service.getComponentInstances().get(0);
-		firstVfInstanceUniqueId = actualComponentInstance.getUniqueId();
-		String serviceOlderVersionUniquId = ResponseParser.getUniqueIdFromResponse(getServiceResponse);
+    @Test
+    public void changeServiceInstanceToOlderVersion() throws Exception {
+        // Get VF Instance UniquId [Service version 0.1]
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        ComponentInstance actualComponentInstance = service.getComponentInstances().get(0);
+        firstVfInstanceUniqueId = actualComponentInstance.getUniqueId();
+        String serviceOlderVersionUniquId = ResponseParser.getUniqueIdFromResponse(getServiceResponse);
 
-		// Checkout service [0.2]
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01,
-				sdncDesignerDetails, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// Adding service instance (serviceDetails_01 V0.2) to product without
-		// saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to Older version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceOlderVersionUniquId, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
-				true);
-		// RestResponse changeServiceInstanceVersionResponse =
-		// changeServiceInstanceVersion(productDetails_01.getUniqueId(),
-		// serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
-		// sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+        // Checkout service [0.2]
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01,
+                sdncDesignerDetails, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // Adding service instance (serviceDetails_01 V0.2) to product without
+        // saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to Older version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceOlderVersionUniquId, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
+                true);
+        // RestResponse changeServiceInstanceVersionResponse =
+        // changeServiceInstanceVersion(productDetails_01.getUniqueId(),
+        // serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
+        // sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	// DE190201
-	@Test
-	public void changeServiceInstanceVersionToCertifiedVersion() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		/*
+    // DE190201
+    @Test
+    public void changeServiceInstanceVersionToCertifiedVersion() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        /*
 		 * String serviceNewUniqueUid =
 		 * ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
 		 * serviceDetails_01.setUniqueId(serviceNewUniqueUid);
 		 */
-		// get the new VF instance uniqueId after checkout service
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.CERTIFY);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		// RestResponse changeServiceInstanceVersionResponse =
-		// changeServiceInstanceVersion(productDetails_01.getUniqueId(),
-		// serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
-		// sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+        // get the new VF instance uniqueId after checkout service
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.CERTIFY);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        // RestResponse changeServiceInstanceVersionResponse =
+        // changeServiceInstanceVersion(productDetails_01.getUniqueId(),
+        // serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
+        // sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	// DE191927
-	@Test(enabled = false)
-	public void changeServiceInstanceVersionThenReCheckInProduct() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		/////////////////////
-		productOldUniqueId = productDetails_01.getUniqueId();
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		/////////////////////////////////////////////
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+    // DE191927
+    @Test(enabled = false)
+    public void changeServiceInstanceVersionThenReCheckInProduct() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        /////////////////////
+        productOldUniqueId = productDetails_01.getUniqueId();
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        /////////////////////////////////////////////
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	@Test
-	public void changeServiceInstanceToHisVersion() throws Exception {
-		// Get VF Instance UniquId [Service version 0.1]
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		String serviceOlderVersionUniquId = ResponseParser.getUniqueIdFromResponse(getServiceResponse);
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceOlderVersionUniquId, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
-				true);
-		// RestResponse changeServiceInstanceVersionResponse =
-		// changeServiceInstanceVersion(productDetails_01.getUniqueId(),
-		// serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
-		// sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+    @Test
+    public void changeServiceInstanceToHisVersion() throws Exception {
+        // Get VF Instance UniquId [Service version 0.1]
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        String serviceOlderVersionUniquId = ResponseParser.getUniqueIdFromResponse(getServiceResponse);
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceOlderVersionUniquId, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
+                true);
+        // RestResponse changeServiceInstanceVersionResponse =
+        // changeServiceInstanceVersion(productDetails_01.getUniqueId(),
+        // serviceInstanceToReplaceUniqueId , serviceNewUniqueUid,
+        // sdncPmDetails1, ComponentTypeEnum.PRODUCT , true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByAdminNotByProductOwner() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+    @Test
+    public void changeServiceInstanceVersionByAdminNotByProductOwner() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
 
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncAdminDetails, ComponentTypeEnum.PRODUCT,
-				true);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncAdminDetails, ComponentTypeEnum.PRODUCT,
+                true);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
 
-	}
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByPmNotByProductOwner() throws Exception {
-		// Adding service instance (serviceDetails_01) to product AND --->
-		// saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// change uniqueId after product check-out in expected Req&Cap
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		updateNewComponentInstanceId(createServiceInstanceResp, productNewUniqueId);
-		// CHANGE Service Instance VERSION BY NON PRODUCT OWNER (sdncPmDetails1
-		// instead sdncPmDetails1)
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
-				productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails2,
-				ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionByPmNotByProductOwner() throws Exception {
+        // Adding service instance (serviceDetails_01) to product AND --->
+        // saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // change uniqueId after product check-out in expected Req&Cap
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        updateNewComponentInstanceId(createServiceInstanceResp, productNewUniqueId);
+        // CHANGE Service Instance VERSION BY NON PRODUCT OWNER (sdncPmDetails1
+        // instead sdncPmDetails1)
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
+                productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails2,
+                ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByTester() throws Exception {
-		// Adding service instance (serviceDetails_01) to product AND --->
-		// saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// change uniqueId after product check-out in expected Req&Cap
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// CHANGE Service Instance VERSION BY NON PRODUCT OWNER (sdncPmDetails1
-		// instead sdncPmDetails1)
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
-				productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid,
-				sdncTesterDetails, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionByTester() throws Exception {
+        // Adding service instance (serviceDetails_01) to product AND --->
+        // saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // change uniqueId after product check-out in expected Req&Cap
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // CHANGE Service Instance VERSION BY NON PRODUCT OWNER (sdncPmDetails1
+        // instead sdncPmDetails1)
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
+                productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid,
+                sdncTesterDetails, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceVersionProductIsNotCheckOut() throws Exception {
-		// Adding service instance (serviceDetails_01) to product AND --->
-		// saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// CHANGE Service Instance VERSION for Non checkedOut product
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productOldUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionProductIsNotCheckOut() throws Exception {
+        // Adding service instance (serviceDetails_01) to product AND --->
+        // saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // CHANGE Service Instance VERSION for Non checkedOut product
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productOldUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	// DE191727
-	@Test(enabled = false)
-	public void changeServiceInstanceVersionServiceIsInCheckOutState() throws Exception {
-		// Adding service instance (serviceDetails_01) to product AND --->
-		// saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// change uniqueId after product check-out in expected Req&Cap
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// CHANGE Service Instance VERSION to service in checkOut state
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
-				productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1,
-				ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add(serviceNewUniqueUid);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
+    // DE191727
+    @Test(enabled = false)
+    public void changeServiceInstanceVersionServiceIsInCheckOutState() throws Exception {
+        // Adding service instance (serviceDetails_01) to product AND --->
+        // saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceToReplaceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // change uniqueId after product check-out in expected Req&Cap
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // CHANGE Service Instance VERSION to service in checkOut state
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(
+                productDetails_01.getUniqueId(), serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1,
+                ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add(serviceNewUniqueUid);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
 
-	}
+    }
 
-	@Test
-	public void changeServiceInstanceVersionServiceInstanceDoesNotExist() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// change service instance to newer version
-		String serviceUniqueUidNotExist = "1234567890";
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceUniqueUidNotExist, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add(serviceUniqueUidNotExist);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionServiceInstanceDoesNotExist() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // change service instance to newer version
+        String serviceUniqueUidNotExist = "1234567890";
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceUniqueUidNotExist, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add(serviceUniqueUidNotExist);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	// DE189392
-	@Test(enabled = false)
-	public void changeServiceInstanceNonExistingProduct() throws Exception {
-		// Adding service instance (serviceDetails_01) to product saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// change service instance to newer version - Non existing Product
-		String productNewUniqueIdNotExist = "1234567890";
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueIdNotExist,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add(productNewUniqueIdNotExist);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    // DE189392
+    @Test(enabled = false)
+    public void changeServiceInstanceNonExistingProduct() throws Exception {
+        // Adding service instance (serviceDetails_01) to product saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // change service instance to newer version - Non existing Product
+        String productNewUniqueIdNotExist = "1234567890";
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueIdNotExist,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add(productNewUniqueIdNotExist);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceVersionToNonExisitingServiceVersion() throws Exception {
-		// Adding service instance (serviceDetails_01) to product saving Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		updateNewComponentInstanceId(createServiceInstanceResp, productNewUniqueId);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// change service instance to Non-existing version
-		String serviceUniqueUidNotExist = "1234567890";
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceUniqueUidNotExist, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
-				true);
-		assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add(serviceUniqueUidNotExist);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionToNonExisitingServiceVersion() throws Exception {
+        // Adding service instance (serviceDetails_01) to product saving Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        updateNewComponentInstanceId(createServiceInstanceResp, productNewUniqueId);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // change service instance to Non-existing version
+        String serviceUniqueUidNotExist = "1234567890";
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceUniqueUidNotExist, sdncPmDetails1, ComponentTypeEnum.PRODUCT,
+                true);
+        assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add(serviceUniqueUidNotExist);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceComponentTypeIsNotProduct() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version for NON-Component Type =
-		// Product (e.g. service)
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.SERVICE, true);
-		assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceComponentTypeIsNotProduct() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version for NON-Component Type =
+        // Product (e.g. service)
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.SERVICE, true);
+        assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceComponentTypeNotSupported() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version for NON-Component Type =
-		// Product (e.g. service)
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1,
-				ComponentTypeEnum.SERVICE_INSTANCE, true);
-		assertEquals("Check response code ", STATUS_CODE_UNSUPPORTED_ERROR,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("null");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales,
-				changeServiceInstanceVersionResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceComponentTypeNotSupported() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version for NON-Component Type =
+        // Product (e.g. service)
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1,
+                ComponentTypeEnum.SERVICE_INSTANCE, true);
+        assertEquals("Check response code ", STATUS_CODE_UNSUPPORTED_ERROR,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("null");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales,
+                changeServiceInstanceVersionResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void SeveralServiceInstanceFromSameServiceVersionChangeVersionOnlyForOneServiceInstance() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		serviceDetails_01.setUniqueId(serviceNewUniqueUid);
-		// get the new VF instance uniqueId after checkout service
-		RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
-		Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
-		List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
-		for (ComponentInstance component : serviceComponentInstances) {
-			if (component.getName().equals(firstVfInstanceName)) {
-				firstVfInstanceUniqueId = component.getUniqueId();
-			}
-		}
-		assertTrue(firstVfInstanceUniqueId != null);
-		// delete resource instance (resourceDetailsVF_01) from Service
-		RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
-				serviceDetails_01, sdncDesignerDetails);
-		assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Add different VF instance (resourceDetailsVF_02) to Service
-		RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(restResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get service instance new uniqueId , name and position after checkout
-		// product
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
-		ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
-		actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
-		actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posX");
-		actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
-				"posY");
-		ComponentInstance componentInstance = ResponseParser
-				.parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Verify that Service instance name and position didn't change after
-		// changing service instance version
-		assertTrue(actualServiceInstanceName.equals(expectedServiceName));
-		assertTrue(actualPosX.equals(expectedPosX));
-		assertTrue(actualPosY.equals(expectedPosY));
-	}
+    @Test
+    public void SeveralServiceInstanceFromSameServiceVersionChangeVersionOnlyForOneServiceInstance() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstanceDuringSetup(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        serviceDetails_01.setUniqueId(serviceNewUniqueUid);
+        // get the new VF instance uniqueId after checkout service
+        RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails_01.getUniqueId(), sdncPmDetails1);
+        Service service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+        List<ComponentInstance> serviceComponentInstances = service.getComponentInstances();
+        for (ComponentInstance component : serviceComponentInstances) {
+            if (component.getName().equals(firstVfInstanceName)) {
+                firstVfInstanceUniqueId = component.getUniqueId();
+            }
+        }
+        assertTrue(firstVfInstanceUniqueId != null);
+        // delete resource instance (resourceDetailsVF_01) from Service
+        RestResponse deleteVfFromServiceResponse = deleteVFInstanceDuringSetup(firstVfInstanceUniqueId,
+                serviceDetails_01, sdncDesignerDetails);
+        assertTrue(deleteVfFromServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Add different VF instance (resourceDetailsVF_02) to Service
+        RestResponse restResponse = createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_02,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(restResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get service instance new uniqueId , name and position after checkout
+        // product
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, sdncPmDetails1, ComponentTypeEnum.PRODUCT, true);
+        ProductRestUtils.checkSuccess(changeServiceInstanceVersionResponse);
+        actualServiceInstanceName = ResponseParser.getNameFromResponse(changeServiceInstanceVersionResponse);
+        actualPosX = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posX");
+        actualPosY = ResponseParser.getValueFromJsonResponse(changeServiceInstanceVersionResponse.getResponse(),
+                "posY");
+        ComponentInstance componentInstance = ResponseParser
+                .parseToObjectUsingMapper(changeServiceInstanceVersionResponse.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Verify that Service instance name and position didn't change after
+        // changing service instance version
+        assertTrue(actualServiceInstanceName.equals(expectedServiceName));
+        assertTrue(actualPosX.equals(expectedPosX));
+        assertTrue(actualPosY.equals(expectedPosY));
+    }
 
-	@Test
-	public void changeServiceInstanceVersionByNonAsdcUser() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		nonAsdcUser.setUserId("bt760h");
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, nonAsdcUser, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionByNonAsdcUser() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        nonAsdcUser.setUserId("bt760h");
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, nonAsdcUser, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void changeServiceInstanceVersionEmptyUserId() throws Exception {
-		// Adding service instance (serviceDetails_01) to product without saving
-		// Req&Cap
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
-				sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Adding service instance (serviceDetails_02) to product AND ---> Save
-		// Req&Cap
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// check-in product
-		RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Checkout service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		// Check-In service [0.2]
-		changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(changeStatusResponse);
-		// check-out product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKOUT);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		nonAsdcUser.setUserId("");
-		// change service instance to newer version
-		RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
-				serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, nonAsdcUser, ComponentTypeEnum.PRODUCT, true);
-		assertEquals("Check response code ", STATUS_CODE_MISSING_INFORMATION,
-				changeServiceInstanceVersionResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(),
-				changeServiceInstanceVersionResponse.getResponse());
-		// Check-in product
-		changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
-				LifeCycleStatesEnum.CHECKIN);
-		ProductRestUtils.checkSuccess(changeStatusResponse);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void changeServiceInstanceVersionEmptyUserId() throws Exception {
+        // Adding service instance (serviceDetails_01) to product without saving
+        // Req&Cap
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
+                sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Adding service instance (serviceDetails_02) to product AND ---> Save
+        // Req&Cap
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // check-in product
+        RestResponse changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productOldUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Checkout service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        String serviceNewUniqueUid = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        // Check-In service [0.2]
+        changeStatusResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(changeStatusResponse);
+        // check-out product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKOUT);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(changeStatusResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        nonAsdcUser.setUserId("");
+        // change service instance to newer version
+        RestResponse changeServiceInstanceVersionResponse = changeServiceInstanceVersion(productNewUniqueId,
+                serviceInstanceToReplaceUniqueId, serviceNewUniqueUid, nonAsdcUser, ComponentTypeEnum.PRODUCT, true);
+        assertEquals("Check response code ", STATUS_CODE_MISSING_INFORMATION,
+                changeServiceInstanceVersionResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(),
+                changeServiceInstanceVersionResponse.getResponse());
+        // Check-in product
+        changeStatusResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
+                LifeCycleStatesEnum.CHECKIN);
+        ProductRestUtils.checkSuccess(changeStatusResponse);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	////////////////////////////////////
-	private void updateNewComponentInstanceId(RestResponse createServiceInstanceResp, String productNewUniqueId)
-			throws Exception {
-		String firstServiceInstanceNormalizedName = ResponseParser
-				.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
-		Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
-		List<ComponentInstance> componentInstances = product.getComponentInstances();
-		for (ComponentInstance component : componentInstances) {
-			if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
-				serviceInstanceToReplaceUniqueId = component.getUniqueId();
-				expectedServiceName = component.getName();
-				expectedPosX = component.getPosX();
-				expectedPosY = component.getPosY();
-			}
-		}
-		assertTrue(serviceInstanceToReplaceUniqueId != null);
-	}
+    ////////////////////////////////////
+    private void updateNewComponentInstanceId(RestResponse createServiceInstanceResp, String productNewUniqueId)
+            throws Exception {
+        String firstServiceInstanceNormalizedName = ResponseParser
+                .getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        RestResponse getProductResponse = ProductRestUtils.getProduct(productNewUniqueId, sdncPmDetails1.getUserId());
+        Product product = ResponseParser.parseToObjectUsingMapper(getProductResponse.getResponse(), Product.class);
+        List<ComponentInstance> componentInstances = product.getComponentInstances();
+        for (ComponentInstance component : componentInstances) {
+            if (component.getNormalizedName().equals(firstServiceInstanceNormalizedName)) {
+                serviceInstanceToReplaceUniqueId = component.getUniqueId();
+                expectedServiceName = component.getName();
+                expectedPosX = component.getPosX();
+                expectedPosY = component.getPosY();
+            }
+        }
+        assertTrue(serviceInstanceToReplaceUniqueId != null);
+    }
 
-	private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
+    private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+		/*restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		if (restResponse.getErrorCode() == 200) {
 			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
 					LifeCycleStatesEnum.STARTCERTIFICATION);
 		} else
 			return restResponse;
-		if (restResponse.getErrorCode() == 200) {
-			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
-					LifeCycleStatesEnum.CERTIFY);
-			if (restResponse.getErrorCode() == 200) {
-				String newVersion = ResponseParser.getVersionFromResponse(restResponse);
-				resourceDetails.setVersion(newVersion);
-				resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
-				resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
-				resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
-				String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
-						"uniqueId");
-				resourceDetails.setUniqueId(uniqueIdFromRresponse);
-			}
-		}
-		return restResponse;
-	}
+		if (restResponse.getErrorCode() == 200) {*/
+        restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFY);
+        if (restResponse.getErrorCode() == 200) {
+            String newVersion = ResponseParser.getVersionFromResponse(restResponse);
+            resourceDetails.setVersion(newVersion);
+            resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
+            resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
+            resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
+            String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
+                    "uniqueId");
+            resourceDetails.setUniqueId(uniqueIdFromRresponse);
+        }
+        return restResponse;
+    }
 
-	private void certifyVf(ResourceReqDetails resource, ResourceReqDetails computeResource,
-			ResourceReqDetails cpResource) throws Exception {
-		RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, cpResource,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String fromCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+    private void certifyVf(ResourceReqDetails resource, ResourceReqDetails computeResource,
+                           ResourceReqDetails cpResource) throws Exception {
+        RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, cpResource,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String fromCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, computeResource,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String toCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, computeResource,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String toCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
-				sdncDesignerDetails, resource.getUniqueId());
-		ResourceRestUtils.checkSuccess(response);
+        RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
+                sdncDesignerDetails, resource.getUniqueId());
+        ResourceRestUtils.checkSuccess(response);
 
-		String capOwnerId = toCompInstId;
-		User user = sdncDesignerDetails;
-		ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
+        String capOwnerId = toCompInstId;
+        User user = sdncDesignerDetails;
+        ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
 
-		fulfillCpRequirement(resource, fromCompInstId, toCompInstId, capOwnerId, user, containerCompType);
+        fulfillCpRequirement(resource, fromCompInstId, toCompInstId, capOwnerId, user, containerCompType);
 
-		RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
-		ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
-	}
+        RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
+        ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
index 623b29b..1e1a197 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
@@ -20,12 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
@@ -40,8 +36,11 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.testng.annotations.BeforeMethod;
 
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
 
 public abstract class ProductBaseTest extends ComponentBaseTest {
 	User productStrategistUser1;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckinTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckinTest.java
index 1820315..94027bd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckinTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckinTest.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -42,6 +40,8 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.testng.AssertJUnit.assertEquals;
+
 public class ProductCheckinTest extends ProductLifecycleTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
index ec1f7ad..36458d0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
@@ -20,10 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.FileNotFoundException;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -43,6 +39,10 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import java.io.FileNotFoundException;
+
+import static org.testng.AssertJUnit.assertEquals;
+
 public class ProductCheckoutTest extends ProductLifecycleTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
index 5968258..f9ce315 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
@@ -20,20 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_NOT_FOUND;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS_DELETE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_UNSUPPORTED_ERROR;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -52,1124 +38,1124 @@
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest {
 
-	protected ArtifactReqDetails heatArtifactDetails;
-	@Rule
-	public static TestName name = new TestName();
+    protected ArtifactReqDetails heatArtifactDetails;
+    @Rule
+    public static TestName name = new TestName();
 
-	public ProductComponentInstanceCRUDTest() {
-		super(name, ProductComponentInstanceCRUDTest.class.getName());
-	}
+    public ProductComponentInstanceCRUDTest() {
+        super(name, ProductComponentInstanceCRUDTest.class.getName());
+    }
 
-	@BeforeMethod
-	public void before() throws Exception {
-		init();
-		createComponents();
-	}
+    @BeforeMethod
+    public void before() throws Exception {
+        init();
+        createComponents();
+    }
 
-	private void createComponents() throws Exception {
+    private void createComponents() throws Exception {
 
-		heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
-		createAtomicResource(resourceDetailsVFC_01);
-		changeResourceStateToCertified(resourceDetailsVFC_01);
-		createAtomicResource(resourceDetailsCP_01);
-		changeResourceStateToCertified(resourceDetailsCP_01);
-		createAtomicResource(resourceDetailsVL_01);
-		changeResourceStateToCertified(resourceDetailsVL_01);
-		createAtomicResource(resourceDetailsVFC_02);
-		changeResourceStateToCertified(resourceDetailsVFC_02);
-		createAtomicResource(resourceDetailsCP_02);
-		changeResourceStateToCertified(resourceDetailsCP_02);
-		createAtomicResource(resourceDetailsVL_02);
-		changeResourceStateToCertified(resourceDetailsVL_02);
-		createVF(resourceDetailsVF_02);
-		createVF(resourceDetailsVF_01);
-		// create check-In services
-		createService(serviceDetails_01);
-		createService(serviceDetails_02);
-		createService(serviceDetails_03);
-		createProduct(productDetails_01);
-		createProduct(productDetails_02);
+        heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+        createAtomicResource(resourceDetailsVFC_01);
+        changeResourceStateToCertified(resourceDetailsVFC_01);
+        createAtomicResource(resourceDetailsCP_01);
+        changeResourceStateToCertified(resourceDetailsCP_01);
+        createAtomicResource(resourceDetailsVL_01);
+        changeResourceStateToCertified(resourceDetailsVL_01);
+        createAtomicResource(resourceDetailsVFC_02);
+        changeResourceStateToCertified(resourceDetailsVFC_02);
+        createAtomicResource(resourceDetailsCP_02);
+        changeResourceStateToCertified(resourceDetailsCP_02);
+        createAtomicResource(resourceDetailsVL_02);
+        changeResourceStateToCertified(resourceDetailsVL_02);
+        createVF(resourceDetailsVF_02);
+        createVF(resourceDetailsVF_01);
+        // create check-In services
+        createService(serviceDetails_01);
+        createService(serviceDetails_02);
+        createService(serviceDetails_03);
+        createProduct(productDetails_01);
+        createProduct(productDetails_02);
 
-		// addresourceDetailsCP_02 ,resourceDetailsVFC_02 and
-		// resourceDetailsVL_02 to resourceDetailsVF_02 check-in VF
-		RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVFC_02, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsCP_02, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVL_02, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetailsVF_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
-		resourceDetailsVF_02.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
-		// addresourceDetailsCP_01 ,resourceDetailsVFC_01 and
-		// resourceDetailsVL_01 to resourceDetailsVF_01 and certify
-		// resourceDetailsVF_01
-		certifyVf(resourceDetailsVF_01);
-		createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails); // serviceDetails_01
-																									// has
-																									// certified
-																									// VF
-		createVFInstanceDuringSetup(serviceDetails_02, resourceDetailsVF_02, sdncDesignerDetails); // serviceDetails_02
-																									// has
-																									// check-in
-																									// VF
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-	}
+        // addresourceDetailsCP_02 ,resourceDetailsVFC_02 and
+        // resourceDetailsVL_02 to resourceDetailsVF_02 check-in VF
+        RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVFC_02, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsCP_02, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVL_02, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetailsVF_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
+        resourceDetailsVF_02.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
+        // addresourceDetailsCP_01 ,resourceDetailsVFC_01 and
+        // resourceDetailsVL_01 to resourceDetailsVF_01 and certify
+        // resourceDetailsVF_01
+        certifyVf(resourceDetailsVF_01);
+        createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails); // serviceDetails_01
+        // has
+        // certified
+        // VF
+        createVFInstanceDuringSetup(serviceDetails_02, resourceDetailsVF_02, sdncDesignerDetails); // serviceDetails_02
+        // has
+        // check-in
+        // VF
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+    }
 
-	// pass
-	@Test
-	public void createServiceInstanceTest() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    // pass
+    @Test
+    public void createServiceInstanceTest() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	// DE189427
-	@Test(enabled = false)
-	public void createServiceInstanceFromCheckedOutState() throws Exception {
-		// can't create instance of checked-out component
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    // DE189427
+    @Test(enabled = false)
+    public void createServiceInstanceFromCheckedOutState() throws Exception {
+        // can't create instance of checked-out component
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceInToAnotherServiceInstance() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String uniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, uniqueIdFromResponse, ComponentTypeEnum.PRODUCT);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_NOT_FOUND);
-	}
+    @Test
+    public void createServiceInstanceInToAnotherServiceInstance() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String uniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, uniqueIdFromResponse, ComponentTypeEnum.PRODUCT);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_NOT_FOUND);
+    }
 
-	@Test
-	public void createSeveralServiceInstanceFromSameServices() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void createSeveralServiceInstanceFromSameServices() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void createSeveralServiceInstanceFromDifferentServices() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void createSeveralServiceInstanceFromDifferentServices() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void createCertifiedServiceInstance() throws Exception {
-		changeServiceStateToCertified(serviceDetails_01);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createCertifiedServiceInstance() throws Exception {
+        changeServiceStateToCertified(serviceDetails_01);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceByPm() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceByPm() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceWithoutVf() throws Exception {
-		LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncAdminDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_02, serviceDetails_03, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_02, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceWithoutVf() throws Exception {
+        LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncAdminDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_02, serviceDetails_03, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_02, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceByNonProductOwner() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails2);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceByNonProductOwner() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails2);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceByNonAsdcUser() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
-		;
-		nonExistingSdncUser.setUserId("bt1234");
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonExistingSdncUser);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceByNonAsdcUser() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
+        ;
+        nonExistingSdncUser.setUserId("bt1234");
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonExistingSdncUser);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceToNotCheckOutProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceToNotCheckOutProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	// pass
-	@Test
-	public void createServiceInstanceNameIsEmpty() throws Exception {
-		String expectedServiceInstanceName = serviceDetails_01.getName() + " 1";
-		String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "1";
-		serviceDetails_01.setName("");
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
-		assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    // pass
+    @Test
+    public void createServiceInstanceNameIsEmpty() throws Exception {
+        String expectedServiceInstanceName = serviceDetails_01.getName() + " 1";
+        String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "1";
+        serviceDetails_01.setName("");
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
+        assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	// pass
-	@Test
-	public void createServiceInstanceNameIsNull() throws Exception {
-		serviceDetails_01.setName(null);
-		String expectedServiceInstanceName = (serviceDetails_01.getName() != null ? serviceDetails_01.getName() : "resourceInstanceName") + " 1";
-		String expectedServiceInstancenormalizedName = (serviceDetails_01.getName() != null ? serviceDetails_01.getName() : "resourceInstanceName") + "1";
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
-		assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    // pass
+    @Test
+    public void createServiceInstanceNameIsNull() throws Exception {
+        serviceDetails_01.setName(null);
+        String expectedServiceInstanceName = (serviceDetails_01.getName() != null ? serviceDetails_01.getName() : "resourceInstanceName") + " 1";
+        String expectedServiceInstancenormalizedName = (serviceDetails_01.getName() != null ? serviceDetails_01.getName() : "resourceInstanceName") + "1";
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
+        assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	@Test(enabled = false)
-	public void createServiceInstanceToNonExistingProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blabla", ComponentTypeEnum.PRODUCT);
-		AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, createServiceInstanceResp.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("blabla");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test(enabled = false)
+    public void createServiceInstanceToNonExistingProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blabla", ComponentTypeEnum.PRODUCT);
+        AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, createServiceInstanceResp.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("blabla");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceToNonSupportedComponentType() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("null");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceToNonSupportedComponentType() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("null");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	// pass
-	@Test
-	public void createServiceInstancePositionIsEmpty() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		serviceInstanceReqDetails.setPosX("");
-		serviceInstanceReqDetails.setPosY("");
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    // pass
+    @Test
+    public void createServiceInstancePositionIsEmpty() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        serviceInstanceReqDetails.setPosX("");
+        serviceInstanceReqDetails.setPosY("");
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstancePositionIsNull() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		serviceInstanceReqDetails.setPosX(null);
-		serviceInstanceReqDetails.setPosY(null);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
-		addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstancePositionIsNull() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        serviceInstanceReqDetails.setPosX(null);
+        serviceInstanceReqDetails.setPosY(null);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
+        addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceByDesigner() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncDesignerDetails);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceByDesigner() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncDesignerDetails);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void createServiceInstanceUserIdIsEmpty() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-		nonSdncDetails.setUserId("");
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonSdncDetails);
-		assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createServiceInstanceUserIdIsEmpty() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
+        nonSdncDetails.setUserId("");
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonSdncDetails);
+        assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	//// Update Service instance
+    //// Update Service instance
 
-	@Test
-	public void updateServiceInstanceNameByPm() throws Exception {
-		// Check-in Product by PM and Check-out by PM
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		// Create service instance by PM
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "abcD";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", newName, instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(newName, actualComponentInstance.getName());
-		assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    @Test
+    public void updateServiceInstanceNameByPm() throws Exception {
+        // Check-in Product by PM and Check-out by PM
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        // Create service instance by PM
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "abcD";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", newName, instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(newName, actualComponentInstance.getName());
+        assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	@Test
-	public void updateServiceInstanceNewNameAndLocation() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "updaatedName100";
-		serviceInstanceReqDetails.setPosX("100");
-		serviceInstanceReqDetails.setPosY("100");
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
-		assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
-		assertEquals(newName, actualComponentInstance.getName());
-		assertEquals(newName.toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    @Test
+    public void updateServiceInstanceNewNameAndLocation() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "updaatedName100";
+        serviceInstanceReqDetails.setPosX("100");
+        serviceInstanceReqDetails.setPosY("100");
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
+        assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
+        assertEquals(newName, actualComponentInstance.getName());
+        assertEquals(newName.toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	@Test(enabled = false)
-	public void updateServiceInstanceNameRemoveSpacesFromBiginningAndEnd() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "  Abcd   ";
-		String expectedNewName = "  Abcd   ";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (expectedNewName).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", expectedNewName, instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(expectedNewName, actualComponentInstance.getName());
-		assertEquals((expectedNewName).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    @Test(enabled = false)
+    public void updateServiceInstanceNameRemoveSpacesFromBiginningAndEnd() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "  Abcd   ";
+        String expectedNewName = "  Abcd   ";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (expectedNewName).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", expectedNewName, instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(expectedNewName, actualComponentInstance.getName());
+        assertEquals((expectedNewName).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	// pass
-	@Test
-	public void updateServiceInstanceNameAllowedCharacters() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "cier-TYUIOP_asd_0987654321.Abcd";
-		String ExpectedNormalizName = "ciertyuiop_asd_0987654321abcd";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", ExpectedNormalizName, instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", newName, instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(newName, actualComponentInstance.getName());
-		assertEquals(ExpectedNormalizName, actualComponentInstance.getNormalizedName());
+    // pass
+    @Test
+    public void updateServiceInstanceNameAllowedCharacters() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "cier-TYUIOP_asd_0987654321.Abcd";
+        String ExpectedNormalizName = "ciertyuiop_asd_0987654321abcd";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", ExpectedNormalizName, instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", newName, instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(newName, actualComponentInstance.getName());
+        assertEquals(ExpectedNormalizName, actualComponentInstance.getNormalizedName());
 
-	}
+    }
 
-	@Test
-	public void updateInstanceNameInvalidCharacters() throws Exception {
-		char invalidChars[] = { '~', '!', '$', '%', '^', '*', '(', ')', '"', '{', '}', '[', ']', '?', '>', '<', '/', '|', '\\', ',' };
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "Abcd1";
-		String updateName;
-		for (int i = 0; i < invalidChars.length; i++) {
-			updateName = newName + invalidChars[i];
-			serviceInstanceReqDetails.setName(updateName);
-			RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-			assertEquals("Check response code ", STATUS_CODE_INVALID_CONTENT, updateServiceInstanceResponse.getErrorCode().intValue());
-			ArrayList<String> varibales = new ArrayList<String>();
-			varibales.add("Service Instance");
-			ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), varibales, updateServiceInstanceResponse.getResponse());
-		}
-	}
+    @Test
+    public void updateInstanceNameInvalidCharacters() throws Exception {
+        char invalidChars[] = {'~', '!', '$', '%', '^', '*', '(', ')', '"', '{', '}', '[', ']', '?', '>', '<', '/', '|', '\\', ','};
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "Abcd1";
+        String updateName;
+        for (int i = 0; i < invalidChars.length; i++) {
+            updateName = newName + invalidChars[i];
+            serviceInstanceReqDetails.setName(updateName);
+            RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+            assertEquals("Check response code ", STATUS_CODE_INVALID_CONTENT, updateServiceInstanceResponse.getErrorCode().intValue());
+            ArrayList<String> varibales = new ArrayList<String>();
+            varibales.add("Service Instance");
+            ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), varibales, updateServiceInstanceResponse.getResponse());
+        }
+    }
 
-	// pass
-	@Test
-	public void updateInstanceNameMaxLength() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "Qwertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl12345";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", newName, instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(newName, actualComponentInstance.getName());
-		assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    // pass
+    @Test
+    public void updateInstanceNameMaxLength() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "Qwertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl12345";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", newName, instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(newName, actualComponentInstance.getName());
+        assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	@Test
-	public void updateInstanceNameExceedMaxLength() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String expectedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
-		String expectedNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
-		String newName = "Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		assertEquals("Check response code ", STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT, updateServiceInstanceResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("Service Instance");
-		varibales.add("1024");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), varibales, updateServiceInstanceResponse.getResponse());
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(expectedName, actualComponentInstance.getName());
-		assertEquals(expectedNormalizedName, actualComponentInstance.getNormalizedName());
-	}
+    @Test
+    public void updateInstanceNameExceedMaxLength() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String expectedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
+        String expectedNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
+        String newName = "Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ciertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456Ahjklzxcvbnmasdfghjkl123456";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        assertEquals("Check response code ", STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT, updateServiceInstanceResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("Service Instance");
+        varibales.add("1024");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), varibales, updateServiceInstanceResponse.getResponse());
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(expectedName, actualComponentInstance.getName());
+        assertEquals(expectedNormalizedName, actualComponentInstance.getNormalizedName());
+    }
 
-	@Test
-	public void updateServiceInstanceNameEmpty() throws Exception {
-		// see US534663 In case a PS/PM removes the current service instance
-		// name then BE has to generate again the "default" service instance
-		// name
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 2"), instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(instanceName, actualComponentInstance.getName());
-		assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
-	}
+    @Test
+    public void updateServiceInstanceNameEmpty() throws Exception {
+        // see US534663 In case a PS/PM removes the current service instance
+        // name then BE has to generate again the "default" service instance
+        // name
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 2"), instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(instanceName, actualComponentInstance.getName());
+        assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
+    }
 
-	// pass
-	@Test
-	public void updateServiceInstanceNameNull() throws Exception {
-		// see US534663 In case a PS/PM removes the current service instance
-		// name then BE has to generate again the "default" service instance
-		// name
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = null;
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "1").toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 1"), instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(instanceName, actualComponentInstance.getName());
-		assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
-	}
+    // pass
+    @Test
+    public void updateServiceInstanceNameNull() throws Exception {
+        // see US534663 In case a PS/PM removes the current service instance
+        // name then BE has to generate again the "default" service instance
+        // name
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = null;
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "1").toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 1"), instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(instanceName, actualComponentInstance.getName());
+        assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
+    }
 
-	@Test
-	public void updateServiceInstanceCheckedByOtherUser() throws Exception {
-		// see US534663 In case a PS/PM removes the current service instance
-		// name then BE has to generate again the "default" service instance
-		// name
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "blabla";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails2, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
-	}
+    @Test
+    public void updateServiceInstanceCheckedByOtherUser() throws Exception {
+        // see US534663 In case a PS/PM removes the current service instance
+        // name then BE has to generate again the "default" service instance
+        // name
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "blabla";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails2, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
+    }
 
-	@Test
-	public void updateServiceInstance_UserIdIsNonAsdcUser() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "blabla";
-		serviceInstanceReqDetails.setName(newName);
-		User nonSdncUserDetails = new User();
-		nonSdncUserDetails.setUserId("bt4567");
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, nonSdncUserDetails, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
-	}
+    @Test
+    public void updateServiceInstance_UserIdIsNonAsdcUser() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "blabla";
+        serviceInstanceReqDetails.setName(newName);
+        User nonSdncUserDetails = new User();
+        nonSdncUserDetails.setUserId("bt4567");
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, nonSdncUserDetails, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
+    }
 
-	@Test
-	public void updateServiceInstanceNameToAlreadyExisting() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String ServiceName1 = ResponseParser.getNameFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// Update service instance2 name to service instance1
-		serviceInstanceReqDetails.setName(ServiceName1);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		assertEquals("Check response code ", STATUS_CODE_ALREADY_EXISTS, updateServiceInstanceResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("Service Instance");
-		varibales.add(ServiceName1);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name(), varibales, updateServiceInstanceResponse.getResponse());
-	}
+    @Test
+    public void updateServiceInstanceNameToAlreadyExisting() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String ServiceName1 = ResponseParser.getNameFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // Update service instance2 name to service instance1
+        serviceInstanceReqDetails.setName(ServiceName1);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        assertEquals("Check response code ", STATUS_CODE_ALREADY_EXISTS, updateServiceInstanceResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("Service Instance");
+        varibales.add(ServiceName1);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name(), varibales, updateServiceInstanceResponse.getResponse());
+    }
 
-	@Test
-	public void updateServiceInstanceForNonExistingProduct() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "blabla";
-		serviceInstanceReqDetails.setName(newName);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blablabla", ComponentTypeEnum.PRODUCT);
-		AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
+    @Test
+    public void updateServiceInstanceForNonExistingProduct() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "blabla";
+        serviceInstanceReqDetails.setName(newName);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blablabla", ComponentTypeEnum.PRODUCT);
+        AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void updateNonExistingServiceInstance() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String newName = "blabla";
-		serviceInstanceReqDetails.setName(newName);
-		serviceInstanceReqDetails.setUniqueId("11111111");
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add(newName);
-		varibales.add("service instance");
-		AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
-		// need to change ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name() to
-		// ActionStatus.SERVICE_INSTANCE_NOT_FOUND.name()
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
-	}
+    @Test
+    public void updateNonExistingServiceInstance() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String newName = "blabla";
+        serviceInstanceReqDetails.setName(newName);
+        serviceInstanceReqDetails.setUniqueId("11111111");
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add(newName);
+        varibales.add("service instance");
+        AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
+        // need to change ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name() to
+        // ActionStatus.SERVICE_INSTANCE_NOT_FOUND.name()
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
+    }
 
-	@Test
-	public void updateServiceInstanceLocation() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		serviceInstanceReqDetails.setPosX("50");
-		serviceInstanceReqDetails.setPosY("100");
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
-		assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
-	}
+    @Test
+    public void updateServiceInstanceLocation() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        serviceInstanceReqDetails.setPosX("50");
+        serviceInstanceReqDetails.setPosY("100");
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
+        assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
+    }
 
-	@Test
-	public void updateServiceInstanceToNonExistingLocation() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		String nameFromResponse = ResponseParser.getNameFromResponse(createServiceInstanceResp);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		serviceInstanceReqDetails.setPosX("-50");
-		serviceInstanceReqDetails.setPosY("-100");
-		serviceInstanceReqDetails.setName(nameFromResponse);
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
-		assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
-		assertEquals(nameFromResponse, actualComponentInstance.getName());
-	}
+    @Test
+    public void updateServiceInstanceToNonExistingLocation() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        String nameFromResponse = ResponseParser.getNameFromResponse(createServiceInstanceResp);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        serviceInstanceReqDetails.setPosX("-50");
+        serviceInstanceReqDetails.setPosY("-100");
+        serviceInstanceReqDetails.setName(nameFromResponse);
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
+        assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
+        assertEquals(nameFromResponse, actualComponentInstance.getName());
+    }
 
-	@Test (enabled = false)
-	public void updateServiceInstanceLocationNameIsEmpty() throws Exception {
-		String expectedServiceInstanceName = serviceDetails_01.getName() + " 2";
-		String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "2";
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		serviceInstanceReqDetails.setPosX("100");
-		serviceInstanceReqDetails.setPosY("200");
-		serviceInstanceReqDetails.setName("");
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String nameFromResponse = ResponseParser.getNameFromResponse(updateServiceInstanceResponse);
-		String postX = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "posX");
-		String postY = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "posY");
-		assertEquals(nameFromResponse, expectedServiceInstanceName);
-		assertEquals(postX, "100");
-		assertEquals(postY, "200");
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
-		assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
-		assertEquals(nameFromResponse, actualComponentInstance.getName());
-		assertEquals(expectedServiceInstancenormalizedName.toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    @Test(enabled = false)
+    public void updateServiceInstanceLocationNameIsEmpty() throws Exception {
+        String expectedServiceInstanceName = serviceDetails_01.getName() + " 2";
+        String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "2";
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        serviceInstanceReqDetails.setPosX("100");
+        serviceInstanceReqDetails.setPosY("200");
+        serviceInstanceReqDetails.setName("");
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String nameFromResponse = ResponseParser.getNameFromResponse(updateServiceInstanceResponse);
+        String postX = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "posX");
+        String postY = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "posY");
+        assertEquals(nameFromResponse, expectedServiceInstanceName);
+        assertEquals(postX, "100");
+        assertEquals(postY, "200");
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
+        assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
+        assertEquals(nameFromResponse, actualComponentInstance.getName());
+        assertEquals(expectedServiceInstancenormalizedName.toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	// pass
-	@Test
-	public void updateServiceInstanceNameToProductName() throws Exception {
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
-		RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// ComponentInstance componentInstance =
-		// ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(),
-		// ComponentInstance.class);
-		// addCompInstReqCapToExpected(componentInstance,
-		// ComponentTypeEnum.PRODUCT);
-		serviceInstanceReqDetails.setName(productDetails_01.getName());
-		RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
-		String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
-		String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
-		assertEquals("check Resource Instance normalizedName ", (serviceInstanceReqDetails.getName()).toLowerCase(), instanceNormalizedName);
-		assertEquals("check Resource Instance Name ", serviceInstanceReqDetails.getName(), instanceName);
-		// get product and verify that service instanceName is correct
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		assertEquals(serviceInstanceReqDetails.getName(), actualComponentInstance.getName());
-		assertEquals((serviceInstanceReqDetails.getName()).toLowerCase(), actualComponentInstance.getNormalizedName());
-	}
+    // pass
+    @Test
+    public void updateServiceInstanceNameToProductName() throws Exception {
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+        RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // ComponentInstance componentInstance =
+        // ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(),
+        // ComponentInstance.class);
+        // addCompInstReqCapToExpected(componentInstance,
+        // ComponentTypeEnum.PRODUCT);
+        serviceInstanceReqDetails.setName(productDetails_01.getName());
+        RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
+        String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+        String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+        assertEquals("check Resource Instance normalizedName ", (serviceInstanceReqDetails.getName()).toLowerCase(), instanceNormalizedName);
+        assertEquals("check Resource Instance Name ", serviceInstanceReqDetails.getName(), instanceName);
+        // get product and verify that service instanceName is correct
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        assertEquals(serviceInstanceReqDetails.getName(), actualComponentInstance.getName());
+        assertEquals((serviceInstanceReqDetails.getName()).toLowerCase(), actualComponentInstance.getNormalizedName());
+    }
 
-	//// Delete Service Instance
+    //// Delete Service Instance
 
-	@Test
-	public void deleteAllServiceInstanceFromProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 0, 0);
-	}
+    @Test
+    public void deleteAllServiceInstanceFromProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 0, 0);
+    }
 
-	@Test
-	public void deleteServiceWhileServiceInstanceExistInProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		// Delete service while service instance of it exist in product
-		RestResponse deleteServiceResponse = ServiceRestUtils.deleteServiceById(serviceDetails_01.getUniqueId(), sdncDesignerDetails.getUserId());
-		assertTrue(deleteServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		// Get product and verify that service instance still exists
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		// ComponentInstance actualComponentInstance =
-		// actualProduct.getComponentInstances().get(0);
-		// assertTrue(serviceInstanceUniqueIdFromResponse ==
-		// actualComponentInstance.getUniqueId());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceWhileServiceInstanceExistInProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        // Delete service while service instance of it exist in product
+        RestResponse deleteServiceResponse = ServiceRestUtils.deleteServiceById(serviceDetails_01.getUniqueId(), sdncDesignerDetails.getUserId());
+        assertTrue(deleteServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        // Get product and verify that service instance still exists
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        // ComponentInstance actualComponentInstance =
+        // actualProduct.getComponentInstances().get(0);
+        // assertTrue(serviceInstanceUniqueIdFromResponse ==
+        // actualComponentInstance.getUniqueId());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	// pass
-	@Test
-	public void deleteServiceInstanceByPm() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    // pass
+    @Test
+    public void deleteServiceInstanceByPm() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceByPmCreatedByPm() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void deleteServiceInstanceByPmCreatedByPm() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceByPmWhichIsCheckedOutByAnotherPm() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails2);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceByPmWhichIsCheckedOutByAnotherPm() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails2);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	// DE190189
-	@Test
-	public void deleteServiceInstanceByPmCreatedByPs() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		String productOldUniqueId = productDetails_01.getUniqueId();
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get product and get service instance new uniquId
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 0, 0);
-	}
+    // DE190189
+    @Test
+    public void deleteServiceInstanceByPmCreatedByPs() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        String productOldUniqueId = productDetails_01.getUniqueId();
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get product and get service instance new uniquId
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 0, 0);
+    }
 
-	// DE190189
-	@Test
-	public void deleteServiceInstanceByAdminCreatedByPs() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		String productOldUniqueId = productDetails_01.getUniqueId();
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
-		updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
-		// get product and get service instance new uniquId
-		RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncAdminDetails.getUserId());
-		Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
-		ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
-		String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 0, 0);
-	}
+    // DE190189
+    @Test
+    public void deleteServiceInstanceByAdminCreatedByPs() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        String productOldUniqueId = productDetails_01.getUniqueId();
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
+        updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
+        // get product and get service instance new uniquId
+        RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncAdminDetails.getUserId());
+        Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
+        ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
+        String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 0, 0);
+    }
 
-	@Test
-	public void createAndDeleteServiceInstanceByAdmin() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		// productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void createAndDeleteServiceInstanceByAdmin() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        // productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceFromNonCheckOutProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void deleteServiceInstanceFromNonCheckOutProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceByDesigner() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncDesignerDetails);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceByDesigner() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncDesignerDetails);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceByTester() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncTesterDetails);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceByTester() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncTesterDetails);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceByPsWhichIsCheckedOutByAnotherPs() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPsDetails2);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceByPsWhichIsCheckedOutByAnotherPs() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPsDetails2);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	// pass
-	@Test
-	public void deleteServiceInstanceByNonAsdcUser() throws Exception {
-		User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
-		;
-		nonExistingSdncUser.setUserId("bt1234");
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonExistingSdncUser);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    // pass
+    @Test
+    public void deleteServiceInstanceByNonAsdcUser() throws Exception {
+        User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
+        ;
+        nonExistingSdncUser.setUserId("bt1234");
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonExistingSdncUser);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceFromNonExistingProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, "1234567890", serviceInstanceUniqueId, ComponentTypeEnum.PRODUCT);
-		assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceFromNonExistingProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, "1234567890", serviceInstanceUniqueId, ComponentTypeEnum.PRODUCT);
+        assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteNonExistingServiceInstanceFromProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		// String serviceInstanceUniqueId =
-		// ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), "1234567890123456unExistingServiceInstance", ComponentTypeEnum.PRODUCT);
-		assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("1234567890123456unExistingServiceInstance");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteNonExistingServiceInstanceFromProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        // String serviceInstanceUniqueId =
+        // ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), "1234567890123456unExistingServiceInstance", ComponentTypeEnum.PRODUCT);
+        assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("1234567890123456unExistingServiceInstance");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceFromNonSupportedComponentType() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.RESOURCE_INSTANCE);
-		assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("null");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, deleteResourceInstanceResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceFromNonSupportedComponentType() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.RESOURCE_INSTANCE);
+        assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("null");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, deleteResourceInstanceResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceComponentTypeIsNotProduct() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.SERVICE);
-		assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
-		ArrayList<String> varibales = new ArrayList<String>();
-		varibales.add("");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-	}
+    @Test
+    public void deleteServiceInstanceComponentTypeIsNotProduct() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.SERVICE);
+        assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
+        ArrayList<String> varibales = new ArrayList<String>();
+        varibales.add("");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+    }
 
-	@Test
-	public void deleteServiceInstanceUserIdIsEmpty() throws Exception {
-		User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-		nonSdncDetails.setUserId("");
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonSdncDetails);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void deleteServiceInstanceUserIdIsEmpty() throws Exception {
+        User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
+        nonSdncDetails.setUserId("");
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonSdncDetails);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	@Test
-	public void deleteCertifiedServiceInstance() throws Exception {
-		changeServiceStateToCertified(serviceDetails_01);
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
-		assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-	}
+    @Test
+    public void deleteCertifiedServiceInstance() throws Exception {
+        changeServiceStateToCertified(serviceDetails_01);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
+        assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+    }
 
-	////////////////////////////////////
+    ////////////////////////////////////
 
-	private void certifyVf(ResourceReqDetails resource) throws Exception {
-		RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+    private void certifyVf(ResourceReqDetails resource) throws Exception {
+        RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_02, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String computeCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_02, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String computeCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01, sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String vlCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01, sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String vlCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		// Fixing Vl/Cp req/cap
-		ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
-		User user = sdncDesignerDetails;
-		fulfillCpRequirement(resource, cpCompInstId, computeCompInstId, computeCompInstId, user, containerCompType);
-		consumeVlCapability(resource, cpCompInstId, vlCompInstId, cpCompInstId, user, containerCompType);
+        // Fixing Vl/Cp req/cap
+        ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
+        User user = sdncDesignerDetails;
+        fulfillCpRequirement(resource, cpCompInstId, computeCompInstId, computeCompInstId, user, containerCompType);
+        consumeVlCapability(resource, cpCompInstId, vlCompInstId, cpCompInstId, user, containerCompType);
 
-		RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails, resource.getUniqueId());
-		ResourceRestUtils.checkSuccess(response);
-		RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
-		ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
-	}
+        RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails, resource.getUniqueId());
+        ResourceRestUtils.checkSuccess(response);
+        RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
+        ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
+    }
 
-	private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
+    private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
+/*		RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		if (restResponse.getErrorCode() == 200) {
 			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails, LifeCycleStatesEnum.STARTCERTIFICATION);
 		} else
 			return restResponse;
-		if (restResponse.getErrorCode() == 200) {
-			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
-			if (restResponse.getErrorCode() == 200) {
-				String newVersion = ResponseParser.getVersionFromResponse(restResponse);
-				resourceDetails.setVersion(newVersion);
-				resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
-				resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
-				resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
-				String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
-				resourceDetails.setUniqueId(uniqueIdFromRresponse);
-			}
-		}
+		if (restResponse.getErrorCode() == 200) {*/
+        RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFY);
+        if (restResponse.getErrorCode() == 200) {
+            String newVersion = ResponseParser.getVersionFromResponse(restResponse);
+            resourceDetails.setVersion(newVersion);
+            resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
+            resourceDetails.setLastUpdaterUserId(sdncDesignerDetails.getUserId());
+            resourceDetails.setLastUpdaterFullName(sdncDesignerDetails.getFullName());
+            String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
+            resourceDetails.setUniqueId(uniqueIdFromRresponse);
+        }
 		return restResponse;
-	}
+}
 
-	private RestResponse changeServiceStateToCertified(ServiceReqDetails serviceDetails) throws Exception {
+    private RestResponse changeServiceStateToCertified(ServiceReqDetails serviceDetails) throws Exception {
 		/*
 		 * RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN); ResourceRestUtils.checkSuccess(restResponse);
 		 */
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		if (restResponse.getErrorCode() == 200) {
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.STARTCERTIFICATION);
-		} else
-			return restResponse;
-		if (restResponse.getErrorCode() == 200) {
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
-			if (restResponse.getErrorCode() == 200) {
-				serviceDetails.setVersion("1.0");
-				serviceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
-				serviceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
-				serviceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
-				String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
-				serviceDetails.setUniqueId(uniqueIdFromRresponse);
-			}
-		}
-		return restResponse;
-	}
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        if (restResponse.getErrorCode() == 200) {
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.STARTCERTIFICATION);
+        } else
+            return restResponse;
+        if (restResponse.getErrorCode() == 200) {
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
+            if (restResponse.getErrorCode() == 200) {
+                serviceDetails.setVersion("1.0");
+                serviceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
+                serviceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
+                serviceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
+                String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
+                serviceDetails.setUniqueId(uniqueIdFromRresponse);
+            }
+        }
+        return restResponse;
+    }
 
-	@Test
-	public void deleteServiceInstanceTest() throws Exception {
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
-		String compInstId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+    @Test
+    public void deleteServiceInstanceTest() throws Exception {
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
+        String compInstId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
 
-		createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 2, 0);
-		String compInstId2 = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 2, 0);
+        String compInstId2 = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
 
-		RestResponse deleteServiceInstanceResp = deleteServiceInstance(compInstId, productDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkDeleteResponse(deleteServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 1, 0);
+        RestResponse deleteServiceInstanceResp = deleteServiceInstance(compInstId, productDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkDeleteResponse(deleteServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 1, 0);
 
-		deleteServiceInstanceResp = deleteServiceInstance(compInstId2, productDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkDeleteResponse(deleteServiceInstanceResp);
-		getComponentAndValidateRIs(productDetails_01, 0, 0);
-	}
+        deleteServiceInstanceResp = deleteServiceInstance(compInstId2, productDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkDeleteResponse(deleteServiceInstanceResp);
+        getComponentAndValidateRIs(productDetails_01, 0, 0);
+    }
 
-	@Test
-	public void returnedServiceInstanceTypeAttributeTest() throws Exception {
-		String expectedServiceType = ComponentTypeEnum.SERVICE.getValue().toUpperCase();
+    @Test
+    public void returnedServiceInstanceTypeAttributeTest() throws Exception {
+        String expectedServiceType = ComponentTypeEnum.SERVICE.getValue().toUpperCase();
 
-		RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
-		ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
-		String serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
-		ComponentInstanceRestUtils.checkComponentInstanceType(createServiceInstanceResp, expectedServiceType);
+        RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+        ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+        String serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
+        ComponentInstanceRestUtils.checkComponentInstanceType(createServiceInstanceResp, expectedServiceType);
 
-		RestResponse getProductResp = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPsDetails1.getUserId());
-		ProductRestUtils.checkSuccess(getProductResp);
-		Product productObject = ResponseParser.parseToObjectUsingMapper(getProductResp.getResponse(), Product.class);
-		List<ComponentInstance> productComponentInstances = productObject.getComponentInstances();
-		for (ComponentInstance comp : productComponentInstances) {
-			String actualOriginType = comp.getOriginType().getValue().toUpperCase();
-			assertTrue(expectedServiceType.equals(actualOriginType));
-		}
+        RestResponse getProductResp = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPsDetails1.getUserId());
+        ProductRestUtils.checkSuccess(getProductResp);
+        Product productObject = ResponseParser.parseToObjectUsingMapper(getProductResp.getResponse(), Product.class);
+        List<ComponentInstance> productComponentInstances = productObject.getComponentInstances();
+        for (ComponentInstance comp : productComponentInstances) {
+            String actualOriginType = comp.getOriginType().getValue().toUpperCase();
+            assertTrue(expectedServiceType.equals(actualOriginType));
+        }
 
-		ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_02);
-		serviceInstanceReqDetails.setUniqueId(serviceUniqueIdFromResponse);
-		serviceInstanceReqDetails.setComponentUid(serviceDetails_01.getUniqueId());
-		RestResponse updateResourceInstance = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
-		ComponentInstanceRestUtils.checkSuccess(updateResourceInstance);
-		ComponentInstanceRestUtils.checkComponentInstanceType(updateResourceInstance, expectedServiceType);
+        ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_02);
+        serviceInstanceReqDetails.setUniqueId(serviceUniqueIdFromResponse);
+        serviceInstanceReqDetails.setComponentUid(serviceDetails_01.getUniqueId());
+        RestResponse updateResourceInstance = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+        ComponentInstanceRestUtils.checkSuccess(updateResourceInstance);
+        ComponentInstanceRestUtils.checkComponentInstanceType(updateResourceInstance, expectedServiceType);
 
-	}
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
index 2796fa8..a0a961d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Arrays;
-
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.junit.Rule;
@@ -48,6 +43,11 @@
 import org.openecomp.sdc.common.api.Constants;
 import org.testng.annotations.Test;
 
+import java.util.Arrays;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ProductCreateWithValidationsTest extends ProductBaseTest {
 	@Rule
 	public static TestName name = new TestName();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
index 88c0f4d..e22318e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
@@ -20,15 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -45,11 +40,7 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.Convertor;
 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.LifecycleRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ProductValidationUtils;
@@ -58,10 +49,14 @@
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 
 public class ProductCrudTest extends ProductBaseTest {
 	private static Logger log = LoggerFactory.getLogger(ProductCrudTest.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
index 26bb3e2..7404e8e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.Product;
 import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
@@ -32,6 +30,8 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.testng.annotations.BeforeMethod;
 
+import static org.testng.AssertJUnit.assertEquals;
+
 public abstract class ProductLifecycleTest extends ProductBaseTest {
 
 	protected static final String CHECKIN_ACTION = "Checkin";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java
index 479dbb9..fd59f8e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java
@@ -20,12 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
 import org.apache.log4j.lf5.util.ResourceUtils;
 import org.junit.Before;
 import org.junit.rules.TestName;
@@ -34,25 +28,18 @@
 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.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.*;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.ArtifactUtils;
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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 java.io.IOException;
+
+import static org.junit.Assert.*;
 
 public class ProductTestBase extends ProductBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductToscaYamlGenerationTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductToscaYamlGenerationTest.java
index 412e6fd..0c74f25 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductToscaYamlGenerationTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductToscaYamlGenerationTest.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
+import com.google.gson.Gson;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
@@ -31,7 +28,9 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 
 public class ProductToscaYamlGenerationTest extends ProductTestBase {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductUndoCheckoutTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductUndoCheckoutTest.java
index d4bfb62..4bd1dff 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductUndoCheckoutTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductUndoCheckoutTest.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.product;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.io.FileNotFoundException;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -44,6 +39,11 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import java.io.FileNotFoundException;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+
 public class ProductUndoCheckoutTest extends ProductLifecycleTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
index 1cf1697..ff9d3e6 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
@@ -20,18 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.execute.property;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
 import org.json.simple.parser.JSONParser;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -49,29 +40,25 @@
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 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.resource.ResourceApiTest;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.*;
 
 public class AdditionalInformationServletTest extends ComponentBaseTest {
 
@@ -534,8 +521,9 @@
 		String vendorRelease = "0.1";
 		String contactId = "al1976";
 		String icon = "myIcon";
+		String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
 
-		return new ServiceReqDetails(serviceName, category, tags, description, contactId, icon);
+		return new ServiceReqDetails(serviceName, category, tags, description, contactId, icon, instantiationType);
 	}
 
 	// TODO Tal: Since Cashing change partial resource returned that causes null
@@ -549,14 +537,14 @@
 		AssertJUnit.assertEquals("Check response code after create user", 200, checkInResponse.getErrorCode().intValue());
 
 		Resource resourceAfterOperation = gson.fromJson(checkInResponse.getResponse(), Resource.class);
-		// TODO Tal: Since Cashing change partial resource returned that causes
+		/*// TODO Tal: Since Cashing change partial resource returned that causes
 		// null pointer exception
-		/*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", 1, resourceAfterOperation.getAdditionalInformation().size());
-		 */
-		/*
+		 *//*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", numberOfAI, resourceAfterOperation.getAdditionalInformation().get(0). getParameters().size());
-		 */
+		 *//*
 
 		RestResponse req4certResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 
@@ -566,12 +554,12 @@
 		resourceAfterOperation = gson.fromJson(req4certResponse.getResponse(), Resource.class);
 		// TODO Tal: Since Cashing change partial resource returned that causes
 		// null pointer exception
-		/*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", 1, resourceAfterOperation.getAdditionalInformation().size());
-		 */
-		/*
+		 *//*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", numberOfAI, resourceAfterOperation.getAdditionalInformation().get(0). getParameters().size());
-		 */
+		 *//*
 
 		// change modifier
 		user.setUserId(UserRoleEnum.TESTER.getUserId());
@@ -584,10 +572,10 @@
 		resourceAfterOperation = gson.fromJson(startCertResourceResponse3.getResponse(), Resource.class);
 		// TODO Tal: Since Cashing change partial resource returned that causes
 		// null pointer exception
-		/*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", 1, resourceAfterOperation.getAdditionalInformation().size());
-		 */
-		/*
+		 *//*
+		*//*
 		 * AssertJUnit.assertEquals("check size of additional information", numberOfAI, resourceAfterOperation.getAdditionalInformation().get(0). getParameters().size());
 		 */
 
@@ -1253,9 +1241,9 @@
 		assertNotNull("check error code exists in response after create property", checkInResponse.getErrorCode());
 		assertEquals("Check response code after create property", 200, checkInResponse.getErrorCode().intValue());
 
-		RestResponse changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST, null);
-		changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION, null);
-		changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.CERTIFY, null);
+		/*RestResponse changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST, null);
+		changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION, null);*/
+		RestResponse changeStateResponse = LifecycleRestUtils.changeResourceState(resource, user, resourceVersion, LifeCycleStatesEnum.CERTIFY, null);
 
 		assertNotNull("check response object is not null after create property", checkInResponse);
 		assertNotNull("check error code exists in response after create property", checkInResponse.getErrorCode());
@@ -1960,11 +1948,11 @@
 		// response = LCSbaseTest.certifyResource(resourceDetails);
 		RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, LifeCycleStatesEnum.CHECKIN);
 		assertTrue("certify resource request returned status:" + restResponseResource.getErrorCode(), response.getErrorCode() == 200);
-		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+		/*restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertTrue("certify resource request returned status:" + restResponseResource.getErrorCode(), response.getErrorCode() == 200);
 		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterUser, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertTrue("certify resource request returned status:" + restResponseResource.getErrorCode(), response.getErrorCode() == 200);
-		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterUser, LifeCycleStatesEnum.CERTIFY);
+		assertTrue("certify resource request returned status:" + restResponseResource.getErrorCode(), response.getErrorCode() == 200);*/
+		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, user, LifeCycleStatesEnum.CERTIFY);
 		assertTrue("certify resource request returned status:" + restResponseResource.getErrorCode(), response.getErrorCode() == 200);
 
 		// add resource instance with HEAT deployment artifact to the service
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
index 6ba1b2c..5385eb9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
@@ -20,11 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.property;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
+import fj.data.Either;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -35,11 +31,7 @@
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -49,7 +41,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import fj.data.Either;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
 
 // open bug for this class: DE199108 - closed, DE199741
 public class ComponentInstancePropertyTest extends ComponentBaseTest {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
index 7ecdcf4..8bb637e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
@@ -20,14 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.property;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -37,11 +29,7 @@
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -53,6 +41,14 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ComponentProperty extends ComponentBaseTest {
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
index f6f6f23..21e1886 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
@@ -20,14 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.property;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.junit.Rule;
@@ -55,6 +47,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertTrue;
+
 public class PropertyApisTest extends SimpleOneRsrcOneServiceTest {
 
 	protected static final String RESOURCE_CATEGORY = "Generic/Databases";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
index 85dfe4e..6bae08b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
@@ -20,14 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
+import fj.data.Either;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.openecomp.sdc.common.util.SerializationUtils;
 
-import fj.data.Either;
-
 public class CheckGetResource {
 
 	public void checkGetVmmsc6() throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
index 675a588..4e2a521 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
@@ -20,33 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.http.client.ClientProtocolException;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.RelationshipImpl;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
@@ -55,15 +34,20 @@
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.*;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
+import static org.testng.AssertJUnit.*;
+
 public class ComponentRelationshipInVfTest extends ComponentBaseTest {
 
 	public ComponentRelationshipInVfTest() {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
index efa8393..0549eaa 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
@@ -20,16 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -41,17 +32,8 @@
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
@@ -60,13 +42,7 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.Convertor;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils;
@@ -74,7 +50,11 @@
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.util.*;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 
 /**
  * @author yshlosberg
@@ -2021,7 +2001,7 @@
 		assertEquals(invariantUUIDcreation, invariantUUIDcheckout);
 		assertEquals(version, "0.2");
 
-		// do certification request
+		/*// do certification request
 		RestResponse restResponseCertificationRequest = LifecycleRestUtils.changeResourceState(resourceDetails,
 				sdncUserDetails, resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		BaseRestUtils.checkSuccess(restResponseCertificationRequest);
@@ -2041,7 +2021,7 @@
 		String invariantUUIDStartCertification = startCertificationRequestResource.getInvariantUUID();
 		version = startCertificationRequestResource.getVersion();
 		assertEquals(invariantUUIDcreation, invariantUUIDStartCertification);
-		assertEquals(version, "0.2");
+		assertEquals(version, "0.2");*/
 
 		// certify
 		RestResponse restResponseCertify = LifecycleRestUtils.changeResourceState(resourceDetails, sdncUserDetails,
@@ -2075,7 +2055,8 @@
 		ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType("VF200", NormativeTypesEnum.ROOT,
 				ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, designerUser.getUserId(), ResourceTypeEnum.VF.toString());
 		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("newtestservice1",
-				ServiceCategoriesEnum.MOBILITY, designerUser.getUserId());
+				ServiceCategoriesEnum.MOBILITY, designerUser.getUserId(),
+				ServiceInstantiationType.A_LA_CARTE.getValue());
 
 		// ResourceReqDetails resourceDetails =
 		// ElementFactory.getDefaultResource();
@@ -2115,7 +2096,7 @@
 		assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
 		assertEquals(invariantUUIDcreation, ResponseParser.getInvariantUuid(restResponse));
 		getResourceValidateInvariantUuid(resource.getUniqueId(), invariantUUIDcreation);
-		// certification request
+		/*// certification request
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
@@ -2126,9 +2107,9 @@
 				LifeCycleStatesEnum.STARTCERTIFICATION);
 		assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
 		assertEquals(invariantUUIDcreation, ResponseParser.getInvariantUuid(restResponse));
-		getResourceValidateInvariantUuid(resource.getUniqueId(), invariantUUIDcreation);
+		getResourceValidateInvariantUuid(resource.getUniqueId(), invariantUUIDcreation);*/
 		// certify
-		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUser, LifeCycleStatesEnum.CERTIFY);
+		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser, LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
 		assertEquals(invariantUUIDcreation, ResponseParser.getInvariantUuid(restResponse));
 		getResourceValidateInvariantUuid(resource.getUniqueId(), invariantUUIDcreation);
@@ -2143,11 +2124,11 @@
 		assertEquals(BaseRestUtils.STATUS_CODE_SUCCESS, updateResponse.getErrorCode().intValue());
 		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);
 
-		// certification request
+		/*// certification request
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
-		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);
+		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);*/
 
 		// checkout resource
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser,
@@ -2155,7 +2136,7 @@
 		assertEquals(BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
 		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);
 
-		// certification request
+		/*// certification request
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals(BaseRestUtils.STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
@@ -2182,7 +2163,7 @@
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUser,
 				LifeCycleStatesEnum.FAILCERTIFICATION);
 		assertEquals(STATUS_CODE_SUCCESS, restResponse.getErrorCode().intValue());
-		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);
+		getResourceValidateInvariantUuid(resourceDetails.getUniqueId(), invariantUUIDcreation);*/
 
 		// upload artifact
 		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUser,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
index a337209..1b58c4e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.User;
@@ -48,6 +41,13 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class GetAllResourceVersions extends ComponentBaseTest {
 
 	private static Logger logger = LoggerFactory.getLogger(GetAllResourceVersions.class.getName());
@@ -151,14 +151,14 @@
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		AssertJUnit.assertEquals("Check response code after checkout resource", 200,
 				checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+		/*checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		AssertJUnit.assertEquals("Check response code after checkout resource", 200,
 				checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
 		AssertJUnit.assertEquals("Check response code after checkout resource", 200,
-				checkoutResource.getErrorCode().intValue());
+				checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		AssertJUnit.assertEquals("Check response code after checkout resource", 200,
@@ -292,12 +292,12 @@
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, designerDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
@@ -317,12 +317,12 @@
 		}
 
 		// resource version 2.0
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
@@ -384,9 +384,9 @@
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, designerDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+		/*checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
 		// validate get response
 		RestResponse resourceGetResponse = ResourceRestUtils.getResource(designerDetails,
@@ -399,7 +399,7 @@
 
 	@Test
 	public void getResourceAllVersions_CertifactionInProgress_version05() throws Exception {
-		Map<String, String> origVersionsMap = new HashMap<String, String>();
+		Map<String, String> origVersionsMap = new HashMap<>();
 		// create resource
 		RestResponse restResponse = createResource(designerDetails, resourceDetails);
 		assertTrue("create request returned status:" + restResponse.getErrorCode(), restResponse.getErrorCode() == 201);
@@ -430,12 +430,12 @@
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, designerDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
 		// validate get response
 		RestResponse resourceGetResponse = ResourceRestUtils.getResource(designerDetails,
@@ -476,12 +476,12 @@
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, designerDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
@@ -525,12 +525,12 @@
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, designerDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
@@ -549,12 +549,12 @@
 		}
 
 		// get to version 1.0
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+/*		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
 				resourceDetails.getVersion(), LifeCycleStatesEnum.CERTIFY);
 		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
index ccf6142..126aabd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
@@ -20,16 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.User;
@@ -50,10 +44,10 @@
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class GetResourceNotAbstractApiTest extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
index df8ff58..1b50e7f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
@@ -20,14 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.CloseableHttpClient;
@@ -58,7 +51,11 @@
 import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.*;
 
 public class ResourceApiTest extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SampleDataProvider.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SampleDataProvider.java
index f4a4fa1..8b8c653 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SampleDataProvider.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SampleDataProvider.java
@@ -20,14 +20,14 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import java.io.IOException;
-
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.testng.ITestContext;
 import org.testng.annotations.DataProvider;
 
+import java.io.IOException;
+
 public class SampleDataProvider {
 
 	@DataProvider
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
index 3002523..df72d35 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
@@ -20,10 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -35,6 +31,10 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.testng.annotations.Test;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 public class SimultaneousApiTest extends ComponentBaseTest {
 
 	protected static ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
index 2b84af9..bfd64c3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
@@ -20,18 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.junit.rules.TestName;
@@ -44,12 +33,7 @@
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
@@ -70,54 +54,57 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.FileNotFoundException;
+import java.util.*;
+
+import static org.testng.AssertJUnit.*;
 
 public class UpdateResourceMetadataTest extends ComponentBaseTest {
-	private static Logger logger = LoggerFactory.getLogger(UpdateResourceMetadataTest.class.getName());
-	protected List<String> Empty_List = new ArrayList<String>();
-	protected String extendedChars;
+    private static Logger logger = LoggerFactory.getLogger(UpdateResourceMetadataTest.class.getName());
+    protected List<String> Empty_List = new ArrayList<String>();
+    protected String extendedChars;
 
-	protected final String contentTypeHeaderData = "application/json";
-	protected final String acceptHeaderDate = "application/json";
-	protected final String CHARSET_ISO_8859 = "charset=ISO-8859-1";
+    protected final String contentTypeHeaderData = "application/json";
+    protected final String acceptHeaderDate = "application/json";
+    protected final String CHARSET_ISO_8859 = "charset=ISO-8859-1";
 
-	public static TestName name = new TestName();
-	protected User sdncModifierDetails;
-	protected ResourceReqDetails resourceDetails;
+    public static TestName name = new TestName();
+    protected User sdncModifierDetails;
+    protected ResourceReqDetails resourceDetails;
 
-	public UpdateResourceMetadataTest() {
-		super(name, UpdateResourceMetadataTest.class.getName());
+    public UpdateResourceMetadataTest() {
+        super(name, UpdateResourceMetadataTest.class.getName());
 
-	}
+    }
 
-	public String extendedCharsStringBuilder() throws Exception {
-		char[] extendedCharsArray = new char[128];
-		char ch = 128;
-		for (int i = 0; i < extendedCharsArray.length - 1; i++) {
-			extendedCharsArray[i] = ch;
-			ch++;
-		}
-		extendedChars = new String(extendedCharsArray);
-		return extendedChars;
+    public String extendedCharsStringBuilder() throws Exception {
+        char[] extendedCharsArray = new char[128];
+        char ch = 128;
+        for (int i = 0; i < extendedCharsArray.length - 1; i++) {
+            extendedCharsArray[i] = ch;
+            ch++;
+        }
+        extendedChars = new String(extendedCharsArray);
+        return extendedChars;
 
-	}
+    }
 
-	@BeforeMethod
-	public void setup() throws Exception {
-		sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		resourceDetails = defineResourse();
+    @BeforeMethod
+    public void setup() throws Exception {
+        sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        resourceDetails = defineResourse();
 
-	}
+    }
 
-	// Keep
-	@Test
-	public void UpdateDerivedFromSuccess() throws Exception {
+    // Keep
+    @Test
+    public void UpdateDerivedFromSuccess() throws Exception {
 
-		String oldDerivedFromName = NormativeTypesEnum.ROOT.getNormativeName();
-		String newDerivedFromName = NormativeTypesEnum.SOFTWARE_COMPONENT.getNormativeName();
+        String oldDerivedFromName = NormativeTypesEnum.ROOT.getNormativeName();
+        String newDerivedFromName = NormativeTypesEnum.SOFTWARE_COMPONENT.getNormativeName();
 
-		// Getting both derived from resources for validation
-		/*
+        // Getting both derived from resources for validation
+        /*
 		 * RestResponse resourceByNameAndVersion =
 		 * resourceUtils.getResourceByNameAndVersion(sdncModifierDetails,
 		 * oldDerivedFromName, "1.0");
@@ -135,1181 +122,1181 @@
 		 * resourceUtils.parseResourceResp(resourceByNameAndVersion);
 		 */
 
-		// Derived from set to Database
-		List<String> derivedFrom = new ArrayList<>();
-		derivedFrom.add(oldDerivedFromName);
-		resourceDetails.setDerivedFrom(derivedFrom);
+        // Derived from set to Database
+        List<String> derivedFrom = new ArrayList<>();
+        derivedFrom.add(oldDerivedFromName);
+        resourceDetails.setDerivedFrom(derivedFrom);
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		AssertJUnit.assertEquals("Check response code after create resource", 201,
-				restResponse.getErrorCode().intValue());
-		Resource currentResource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        AssertJUnit.assertEquals("Check response code after create resource", 201,
+                restResponse.getErrorCode().intValue());
+        Resource currentResource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		derivedFrom.clear();
-		derivedFrom.add(newDerivedFromName);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResource.getUniqueId(), "");
-		AssertJUnit.assertEquals("Check response code after create resource", 200,
-				updatedRestResponse.getErrorCode().intValue());
+        derivedFrom.clear();
+        derivedFrom.add(newDerivedFromName);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResource.getUniqueId(), "");
+        AssertJUnit.assertEquals("Check response code after create resource", 200,
+                updatedRestResponse.getErrorCode().intValue());
 
-	}
+    }
 
-	protected ResourceReqDetails defineUpdateResourceWithNonUpdatableFields(Resource resourceBeforeUpdate) {
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceBeforeUpdate.getName());
+    protected ResourceReqDetails defineUpdateResourceWithNonUpdatableFields(Resource resourceBeforeUpdate) {
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceBeforeUpdate.getName());
 
-		updatedResourceDetails.setVersion("mumu");
-		updatedResourceDetails.setIsAbstract(true);
-		updatedResourceDetails.setIsHighestVersion(true);
-		updatedResourceDetails.setCreatorUserId("df4444");
-		updatedResourceDetails.setCreatorFullName("John Doe");
-		updatedResourceDetails.setLastUpdaterUserId("gf5646");
-		updatedResourceDetails.setLastUpdaterFullName("Viktor Tzoy");
-		updatedResourceDetails.setCreationDate(new Long(4444));
-		updatedResourceDetails.setLastUpdateDate(new Long("534535"));
-		updatedResourceDetails.setLifecycleState(LifecycleStateEnum.READY_FOR_CERTIFICATION);
-		updatedResourceDetails.setCost("6.1");
-		updatedResourceDetails.setLicenseType("Installation");
-		updatedResourceDetails.setUUID("dfsfsdf");
-		return updatedResourceDetails;
-	}
+        updatedResourceDetails.setVersion("mumu");
+        updatedResourceDetails.setIsAbstract(true);
+        updatedResourceDetails.setIsHighestVersion(true);
+        updatedResourceDetails.setCreatorUserId("df4444");
+        updatedResourceDetails.setCreatorFullName("John Doe");
+        updatedResourceDetails.setLastUpdaterUserId("gf5646");
+        updatedResourceDetails.setLastUpdaterFullName("Viktor Tzoy");
+        updatedResourceDetails.setCreationDate(new Long(4444));
+        updatedResourceDetails.setLastUpdateDate(new Long("534535"));
+        updatedResourceDetails.setLifecycleState(LifecycleStateEnum.READY_FOR_CERTIFICATION);
+        updatedResourceDetails.setCost("6.1");
+        updatedResourceDetails.setLicenseType("Installation");
+        updatedResourceDetails.setUUID("dfsfsdf");
+        return updatedResourceDetails;
+    }
 
-	public void UpdateResourceNotFoundTest() throws Exception {
-		// init ADMIN user
-		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+    public void UpdateResourceNotFoundTest() throws Exception {
+        // init ADMIN user
+        User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
 
-		String resourceName = "cisco4";
-		// update resource
-		String description = "updatedDescription";
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceTags.add("tag2");
-		String category = ServiceCategoriesEnum.MOBILITY.getValue();
-		ArrayList<String> derivedFrom = new ArrayList<String>();
-		derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());
-		String vendorName = "newOracle";
-		String vendorRelease = "2.5";
-		String contactId = "jh0003";
-		String icon = "myICON";
+        String resourceName = "cisco4";
+        // update resource
+        String description = "updatedDescription";
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceTags.add("tag2");
+        String category = ServiceCategoriesEnum.MOBILITY.getValue();
+        ArrayList<String> derivedFrom = new ArrayList<String>();
+        derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());
+        String vendorName = "newOracle";
+        String vendorRelease = "2.5";
+        String contactId = "jh0003";
+        String icon = "myICON";
 
-		ResourceReqDetails updatedResourceDetails = new ResourceReqDetails(resourceName, description, resourceTags,
-				category, derivedFrom, vendorName, vendorRelease, contactId, icon);
-		updatedResourceDetails.setUniqueId("dummyId");
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, "0.1");
+        ResourceReqDetails updatedResourceDetails = new ResourceReqDetails(resourceName, description, resourceTags,
+                category, derivedFrom, vendorName, vendorRelease, contactId, icon);
+        updatedResourceDetails.setUniqueId("dummyId");
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, "0.1");
 
-		// validate response
-		AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after update resource",
-				updatedRestResponse.getErrorCode());
-		AssertJUnit.assertEquals("Check response code after update resource", 404,
-				updatedRestResponse.getErrorCode().intValue());
-		// String resourceId =
-		// UniqueIdBuilder.buildResourceUniqueId(resourceName, "0.1");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), Arrays.asList("dummyId"),
-				updatedRestResponse.getResponse());
+        // validate response
+        AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after update resource",
+                updatedRestResponse.getErrorCode());
+        AssertJUnit.assertEquals("Check response code after update resource", 404,
+                updatedRestResponse.getErrorCode().intValue());
+        // String resourceId =
+        // UniqueIdBuilder.buildResourceUniqueId(resourceName, "0.1");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), Arrays.asList("dummyId"),
+                updatedRestResponse.getResponse());
 
-		resourceName = "";
-		// resourceId = UniqueIdBuilder.buildResourceUniqueId(resourceName,
-		// "0.1");
-		updatedResourceDetails = defineUpdatedResourse(resourceName);
-		updatedResourceDetails.setUniqueId("dummyId");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				"0.1");
-		AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after update resource",
-				updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), Arrays.asList("dummyId"),
-				updatedRestResponse.getResponse());
+        resourceName = "";
+        // resourceId = UniqueIdBuilder.buildResourceUniqueId(resourceName,
+        // "0.1");
+        updatedResourceDetails = defineUpdatedResourse(resourceName);
+        updatedResourceDetails.setUniqueId("dummyId");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                "0.1");
+        AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after update resource",
+                updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), Arrays.asList("dummyId"),
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	public char[] getInValidChars() throws Exception {
+    public char[] getInValidChars() throws Exception {
 
-		char[] extendedCharsArray = new char[59];
-		char ch = 1;
-		for (int i = 0; i < 44; i++) {
-			extendedCharsArray[i] = ch;
-			ch++;
-		}
-		ch = 58;
-		for (int i = 44; i < 51; i++) {
-			extendedCharsArray[i] = ch;
-			ch++;
-		}
-		ch = 91;
-		for (int i = 51; i < 55; i++) {
-			extendedCharsArray[i] = ch;
-			ch++;
-		}
-		ch = 123;
-		for (int i = 55; i < 59; i++) {
-			extendedCharsArray[i] = ch;
-			ch++;
-		}
-		return extendedCharsArray;
-	}
+        char[] extendedCharsArray = new char[59];
+        char ch = 1;
+        for (int i = 0; i < 44; i++) {
+            extendedCharsArray[i] = ch;
+            ch++;
+        }
+        ch = 58;
+        for (int i = 44; i < 51; i++) {
+            extendedCharsArray[i] = ch;
+            ch++;
+        }
+        ch = 91;
+        for (int i = 51; i < 55; i++) {
+            extendedCharsArray[i] = ch;
+            ch++;
+        }
+        ch = 123;
+        for (int i = 55; i < 59; i++) {
+            extendedCharsArray[i] = ch;
+            ch++;
+        }
+        return extendedCharsArray;
+    }
 
-	public char[] getTagInValidFormatChars() throws Exception {
-		// Tag format is the same as defined for "Resource Name" :
-		// Allowed characters: Alphanumeric (a-zA-Z0-9), space (' '), underscore
-		// ('_'), dash ('-'), dot ('.')
-		char[] notValidCharsArray = new char[30];
-		char ch = 33;
-		for (int i = 0; i < 12; i++) {
-			notValidCharsArray[i] = ch;
-			ch++;
-		}
-		notValidCharsArray[13] = 47;
-		ch = 58;
-		for (int i = 14; i < 21; i++) {
-			notValidCharsArray[i] = ch;
-			ch++;
-		}
-		ch = 91;
-		for (int i = 21; i < 24; i++) {
-			notValidCharsArray[i] = ch;
-			ch++;
-		}
-		notValidCharsArray[24] = 96;
-		ch = 123;
-		for (int i = 25; i < 30; i++) {
-			notValidCharsArray[i] = ch;
-			ch++;
-		}
-		return notValidCharsArray;
-	}
+    public char[] getTagInValidFormatChars() throws Exception {
+        // Tag format is the same as defined for "Resource Name" :
+        // Allowed characters: Alphanumeric (a-zA-Z0-9), space (' '), underscore
+        // ('_'), dash ('-'), dot ('.')
+        char[] notValidCharsArray = new char[30];
+        char ch = 33;
+        for (int i = 0; i < 12; i++) {
+            notValidCharsArray[i] = ch;
+            ch++;
+        }
+        notValidCharsArray[13] = 47;
+        ch = 58;
+        for (int i = 14; i < 21; i++) {
+            notValidCharsArray[i] = ch;
+            ch++;
+        }
+        ch = 91;
+        for (int i = 21; i < 24; i++) {
+            notValidCharsArray[i] = ch;
+            ch++;
+        }
+        notValidCharsArray[24] = 96;
+        ch = 123;
+        for (int i = 25; i < 30; i++) {
+            notValidCharsArray[i] = ch;
+            ch++;
+        }
+        return notValidCharsArray;
+    }
 
-	public void Validation_UpdateWithIncompleteJsonBodyTest() throws Exception {
-		// init ADMIN user
-		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+    public void Validation_UpdateWithIncompleteJsonBodyTest() throws Exception {
+        // init ADMIN user
+        User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
 
-		// define and create resource
-		ResourceReqDetails resourceDetails = defineResourse();
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "0.1");
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.0");
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.1");
+        // define and create resource
+        ResourceReqDetails resourceDetails = defineResourse();
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "0.1");
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.0");
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.1");
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceId = resourceDetails.getUniqueId();
-		resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceId = resourceDetails.getUniqueId();
+        resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
 
-		// build Json Object
-		JSONObject jsonObject = JsonObjectBuilder(resourceDetails);
+        // build Json Object
+        JSONObject jsonObject = JsonObjectBuilder(resourceDetails);
 
-		List<String> resource = new ArrayList<>();
-		resource.add("Resource");
+        List<String> resource = new ArrayList<>();
+        resource.add("Resource");
 
-		// remove Description
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "description",
-				ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource);
-		// remove Tags
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "tags",
-				ActionStatus.COMPONENT_MISSING_TAGS.name(), Empty_List);
-		// remove Category
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "category",
-				ActionStatus.COMPONENT_MISSING_CATEGORY.name(), resource);
-		// remove VendorName
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "vendorName",
-				ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List);
-		// remove VendorRelease
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "vendorRelease",
-				ActionStatus.MISSING_VENDOR_RELEASE.name(), Empty_List);
-		// remove AT&T Contact
-		UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "contactId",
-				ActionStatus.COMPONENT_MISSING_CONTACT.name(), resource);
+        // remove Description
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "description",
+                ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource);
+        // remove Tags
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "tags",
+                ActionStatus.COMPONENT_MISSING_TAGS.name(), Empty_List);
+        // remove Category
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "category",
+                ActionStatus.COMPONENT_MISSING_CATEGORY.name(), resource);
+        // remove VendorName
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "vendorName",
+                ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List);
+        // remove VendorRelease
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "vendorRelease",
+                ActionStatus.MISSING_VENDOR_RELEASE.name(), Empty_List);
+        // remove AT&T Contact
+        UpdateAndValidateWithIncompletedJsonBody(sdncModifierDetails, jsonObject, resourceId, "contactId",
+                ActionStatus.COMPONENT_MISSING_CONTACT.name(), resource);
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails, "0.1");
-		// validate response
-		AssertJUnit.assertNotNull("check response object is not null after get resource", getRestResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after get resource",
-				getRestResponse.getErrorCode());
-		AssertJUnit.assertEquals("Check response code after update resource", 200,
-				getRestResponse.getErrorCode().intValue());
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails, "0.1");
+        // validate response
+        AssertJUnit.assertNotNull("check response object is not null after get resource", getRestResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after get resource",
+                getRestResponse.getErrorCode());
+        AssertJUnit.assertEquals("Check response code after update resource", 200,
+                getRestResponse.getErrorCode().intValue());
 
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "0.1");
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.0");
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.1");
-	}
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "0.1");
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.0");
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, resourceDetails.getName(), "1.1");
+    }
 
-	// End of validation tests
-	// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // End of validation tests
+    // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-	protected ResourceReqDetails defineUpdatedResourse(String resourceName) {
-		String description = "updatedDescription";
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		// Duplicate tags are allowed and should be de-duplicated by server side
-		resourceTags.add(resourceName);
-		resourceTags.add("tag1");
-		resourceTags.add("tag1");
-		resourceTags.add("tag2");
-		resourceTags.add("tag2");
-		String category = ServiceCategoriesEnum.VOIP.getValue();
-		ArrayList<String> derivedFrom = new ArrayList<String>();
-		derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());
-		String vendorName = "updatedOracle";
-		String vendorRelease = "3.5";
-		String contactId = "jh0001";
-		String icon = "myUpdatedICON";
+    protected ResourceReqDetails defineUpdatedResourse(String resourceName) {
+        String description = "updatedDescription";
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        // Duplicate tags are allowed and should be de-duplicated by server side
+        resourceTags.add(resourceName);
+        resourceTags.add("tag1");
+        resourceTags.add("tag1");
+        resourceTags.add("tag2");
+        resourceTags.add("tag2");
+        String category = ServiceCategoriesEnum.VOIP.getValue();
+        ArrayList<String> derivedFrom = new ArrayList<String>();
+        derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());
+        String vendorName = "updatedOracle";
+        String vendorRelease = "3.5";
+        String contactId = "jh0001";
+        String icon = "myUpdatedICON";
 
-		ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, category,
-				derivedFrom, vendorName, vendorRelease, contactId, icon);
-		resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getCategory(),
-				ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getSubCategory());
+        ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, category,
+                derivedFrom, vendorName, vendorRelease, contactId, icon);
+        resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getCategory(),
+                ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getSubCategory());
 
-		return resourceDetails;
-	}
+        return resourceDetails;
+    }
 
-	protected ResourceReqDetails defineResourse() {
-		String resourceName = "cisco4";
-		String description = "description";
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceTags.add(resourceName);
-		ArrayList<String> derivedFrom = new ArrayList<String>();
-		derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());// "tosca.nodes.Root");
-		String vendorName = "Oracle";
-		String vendorRelease = "1.5";
-		String contactId = "jh0003";
-		String icon = "objectStorage";
+    protected ResourceReqDetails defineResourse() {
+        String resourceName = "cisco4";
+        String description = "description";
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceTags.add(resourceName);
+        ArrayList<String> derivedFrom = new ArrayList<String>();
+        derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());// "tosca.nodes.Root");
+        String vendorName = "Oracle";
+        String vendorRelease = "1.5";
+        String contactId = "jh0003";
+        String icon = "objectStorage";
 
-		ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null,
-				derivedFrom, vendorName, vendorRelease, contactId, icon);
-		resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getCategory(),
-				ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getSubCategory());
+        ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null,
+                derivedFrom, vendorName, vendorRelease, contactId, icon);
+        resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getCategory(),
+                ResourceCategoryEnum.GENERIC_INFRASTRUCTURE.getSubCategory());
 
-		return resourceDetails;
-	}
+        return resourceDetails;
+    }
 
-	protected RestResponse createResource(User sdncModifierDetails, ResourceReqDetails resourceDetails)
-			throws Exception {
-		// clean ES DB
-		DbUtils.cleanAllAudits();
+    protected RestResponse createResource(User sdncModifierDetails, ResourceReqDetails resourceDetails)
+            throws Exception {
+        // clean ES DB
+        DbUtils.cleanAllAudits();
 
-		// create resource
-		RestResponse restResponse = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+        // create resource
+        RestResponse restResponse = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
 
-		// validate response
-		AssertJUnit.assertNotNull("check response object is not null after create resource", restResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after create resource",
-				restResponse.getErrorCode());
-		AssertJUnit.assertEquals("Check response code after create resource", 201,
-				restResponse.getErrorCode().intValue());
+        // validate response
+        AssertJUnit.assertNotNull("check response object is not null after create resource", restResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after create resource",
+                restResponse.getErrorCode());
+        AssertJUnit.assertEquals("Check response code after create resource", 201,
+                restResponse.getErrorCode().intValue());
 
-		return restResponse;
-	}
+        return restResponse;
+    }
 
-	protected RestResponse TryUpdateByAnotherVerb(ResourceReqDetails updatedResourceDetails, User sdncModifierDetails,
-			String uri) throws Exception {
-		// delete resource
-		Config config;
-		RestResponse ResourceResponse;
-		try {
-			config = Utils.getConfig();
-			Map<String, String> headersMap = new HashMap<String, String>();
-			headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
-			headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
-			headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
-			HttpRequest http = new HttpRequest();
-			String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(),
-					config.getCatalogBePort(), updatedResourceDetails.getName() + ".0.1");
+    protected RestResponse TryUpdateByAnotherVerb(ResourceReqDetails updatedResourceDetails, User sdncModifierDetails,
+                                                  String uri) throws Exception {
+        // delete resource
+        Config config;
+        RestResponse ResourceResponse;
+        try {
+            config = Utils.getConfig();
+            Map<String, String> headersMap = new HashMap<String, String>();
+            headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
+            headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
+            headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
+            HttpRequest http = new HttpRequest();
+            String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(),
+                    config.getCatalogBePort(), updatedResourceDetails.getName() + ".0.1");
 
-			if (uri == "GET") {
-				ResourceResponse = http.httpSendGet(url, headersMap);
-			} else if (uri == "POST") {
-				Gson gson = new Gson();
-				String userBodyJson = gson.toJson(updatedResourceDetails);
-				ResourceResponse = http.httpSendPost(url, userBodyJson, headersMap);
-			} else if (uri == "DELETE") {
-				ResourceResponse = http.httpSendDelete(url, headersMap);
-			} else
-				return null;
+            if (uri == "GET") {
+                ResourceResponse = http.httpSendGet(url, headersMap);
+            } else if (uri == "POST") {
+                Gson gson = new Gson();
+                String userBodyJson = gson.toJson(updatedResourceDetails);
+                ResourceResponse = http.httpSendPost(url, userBodyJson, headersMap);
+            } else if (uri == "DELETE") {
+                ResourceResponse = http.httpSendDelete(url, headersMap);
+            } else
+                return null;
 
-			return ResourceResponse;
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		}
+            return ResourceResponse;
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
 
-		return null;
+        return null;
 
-	}
+    }
 
-	protected JSONObject JsonObjectBuilder(ResourceReqDetails resourceDetails) throws JSONException {
-		// json object: resourceName and icon are must
-		JSONObject jObject = new JSONObject();
+    protected JSONObject JsonObjectBuilder(ResourceReqDetails resourceDetails) throws JSONException {
+        // json object: resourceName and icon are must
+        JSONObject jObject = new JSONObject();
 
-		List<String> tagsList = Arrays.asList(resourceDetails.getName());
-		List<String> derivedFromList = Arrays.asList("[tosca.nodes.Root]");
+        List<String> tagsList = Arrays.asList(resourceDetails.getName());
+        List<String> derivedFromList = Arrays.asList("[tosca.nodes.Root]");
 
-		jObject.put("name", resourceDetails.getName());
-		jObject.put("description", "updatedDescription");
-		jObject.put("tags", tagsList);
-		jObject.put("category", ServiceCategoriesEnum.VOIP.getValue());
-		jObject.put("derivedFrom", derivedFromList);
-		jObject.put("vendorName", "newOracle");
-		jObject.put("vendorRelease", "1.5");
-		jObject.put("contactId", "jh0003");
-		jObject.put("icon", resourceDetails.getIcon());
+        jObject.put("name", resourceDetails.getName());
+        jObject.put("description", "updatedDescription");
+        jObject.put("tags", tagsList);
+        jObject.put("category", ServiceCategoriesEnum.VOIP.getValue());
+        jObject.put("derivedFrom", derivedFromList);
+        jObject.put("vendorName", "newOracle");
+        jObject.put("vendorRelease", "1.5");
+        jObject.put("contactId", "jh0003");
+        jObject.put("icon", resourceDetails.getIcon());
 
-		return jObject;
-	}
+        return jObject;
+    }
 
-	protected JSONObject RemoveFromJsonObject(JSONObject jObject, String removedPropery) {
-		jObject.remove(removedPropery);
+    protected JSONObject RemoveFromJsonObject(JSONObject jObject, String removedPropery) {
+        jObject.remove(removedPropery);
 
-		return jObject;
-	}
+        return jObject;
+    }
 
-	// purpose: function for controlling json body fields and validating
-	// response
-	protected void UpdateAndValidateWithIncompletedJsonBody(User sdncModifierDetails, JSONObject jsonObject,
-			String resourceId, String removedField, String errorMessage, List<String> variables) throws Exception {
+    // purpose: function for controlling json body fields and validating
+    // response
+    protected void UpdateAndValidateWithIncompletedJsonBody(User sdncModifierDetails, JSONObject jsonObject,
+                                                            String resourceId, String removedField, String errorMessage, List<String> variables) throws Exception {
 
-		JSONObject jObject = new JSONObject(jsonObject, JSONObject.getNames(jsonObject));
-		// remove description from jsonObject
-		jObject = RemoveFromJsonObject(jObject, removedField);
-		// update with incomplete body.
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(jObject.toString(),
-				sdncModifierDetails, resourceId);
-		// validate response
-		AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after update resource",
-				updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(errorMessage, variables, updatedRestResponse.getResponse());
+        JSONObject jObject = new JSONObject(jsonObject, JSONObject.getNames(jsonObject));
+        // remove description from jsonObject
+        jObject = RemoveFromJsonObject(jObject, removedField);
+        // update with incomplete body.
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(jObject.toString(),
+                sdncModifierDetails, resourceId);
+        // validate response
+        AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after update resource",
+                updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(errorMessage, variables, updatedRestResponse.getResponse());
 
-	}
+    }
 
-	// purpose: function for validating error response
-	protected void UpdateAndValidate(User sdncModifierDetails, ResourceReqDetails resourceDetails,
-			String recievedMessage, List<String> variables) throws Exception {
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, "0.1");
-		// validate response
-		AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		AssertJUnit.assertNotNull("check error code exists in response after update resource",
-				updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(recievedMessage, variables, updatedRestResponse.getResponse());
+    // purpose: function for validating error response
+    protected void UpdateAndValidate(User sdncModifierDetails, ResourceReqDetails resourceDetails,
+                                     String recievedMessage, List<String> variables) throws Exception {
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, "0.1");
+        // validate response
+        AssertJUnit.assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        AssertJUnit.assertNotNull("check error code exists in response after update resource",
+                updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(recievedMessage, variables, updatedRestResponse.getResponse());
 
-	}
+    }
 
-	protected void parseResponseAndValidateNonUpdatable(ResourceReqDetails resourceDetails, RestResponse restResponse)
-			throws Exception {
-		// parse response to javaObject
-		Resource updatedResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
-		AssertJUnit.assertTrue(
-				!resourceDetails.getIsHighestVersion().equals(updatedResourceRespJavaObject.isHighestVersion()));
-		AssertJUnit.assertTrue(!resourceDetails.getVersion().equals(updatedResourceRespJavaObject.getName()));
-		AssertJUnit.assertTrue(!resourceDetails.getIsAbstract().equals(updatedResourceRespJavaObject.isAbstract()));
-		AssertJUnit.assertTrue(
-				!resourceDetails.getCreatorUserId().equals(updatedResourceRespJavaObject.getCreatorUserId()));
-		AssertJUnit.assertTrue(
-				!resourceDetails.getCreatorFullName().equals(updatedResourceRespJavaObject.getCreatorFullName()));
-		AssertJUnit.assertTrue(
-				!resourceDetails.getLastUpdateDate().equals(updatedResourceRespJavaObject.getLastUpdateDate()));
-		AssertJUnit
-				.assertTrue(!resourceDetails.getCreationDate().equals(updatedResourceRespJavaObject.getCreationDate()));
-		AssertJUnit.assertTrue(
-				!resourceDetails.getLastUpdaterUserId().equals(updatedResourceRespJavaObject.getLastUpdaterUserId()));
-		AssertJUnit.assertTrue(!resourceDetails.getLastUpdaterFullName()
-				.equals(updatedResourceRespJavaObject.getLastUpdaterFullName()));
-		AssertJUnit.assertTrue(
-				!resourceDetails.getLifecycleState().equals(updatedResourceRespJavaObject.getLifecycleState()));
-		AssertJUnit.assertTrue(!resourceDetails.getCost().equals(updatedResourceRespJavaObject.getCost()));
-		AssertJUnit
-				.assertTrue(!resourceDetails.getLicenseType().equals(updatedResourceRespJavaObject.getLicenseType()));
-		AssertJUnit.assertTrue(!resourceDetails.getUUID().equals(updatedResourceRespJavaObject.getUUID()));
+    protected void parseResponseAndValidateNonUpdatable(ResourceReqDetails resourceDetails, RestResponse restResponse)
+            throws Exception {
+        // parse response to javaObject
+        Resource updatedResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
+        AssertJUnit.assertTrue(
+                !resourceDetails.getIsHighestVersion().equals(updatedResourceRespJavaObject.isHighestVersion()));
+        AssertJUnit.assertTrue(!resourceDetails.getVersion().equals(updatedResourceRespJavaObject.getName()));
+        AssertJUnit.assertTrue(!resourceDetails.getIsAbstract().equals(updatedResourceRespJavaObject.isAbstract()));
+        AssertJUnit.assertTrue(
+                !resourceDetails.getCreatorUserId().equals(updatedResourceRespJavaObject.getCreatorUserId()));
+        AssertJUnit.assertTrue(
+                !resourceDetails.getCreatorFullName().equals(updatedResourceRespJavaObject.getCreatorFullName()));
+        AssertJUnit.assertTrue(
+                !resourceDetails.getLastUpdateDate().equals(updatedResourceRespJavaObject.getLastUpdateDate()));
+        AssertJUnit
+                .assertTrue(!resourceDetails.getCreationDate().equals(updatedResourceRespJavaObject.getCreationDate()));
+        AssertJUnit.assertTrue(
+                !resourceDetails.getLastUpdaterUserId().equals(updatedResourceRespJavaObject.getLastUpdaterUserId()));
+        AssertJUnit.assertTrue(!resourceDetails.getLastUpdaterFullName()
+                .equals(updatedResourceRespJavaObject.getLastUpdaterFullName()));
+        AssertJUnit.assertTrue(
+                !resourceDetails.getLifecycleState().equals(updatedResourceRespJavaObject.getLifecycleState()));
+        AssertJUnit.assertTrue(!resourceDetails.getCost().equals(updatedResourceRespJavaObject.getCost()));
+        AssertJUnit
+                .assertTrue(!resourceDetails.getLicenseType().equals(updatedResourceRespJavaObject.getLicenseType()));
+        AssertJUnit.assertTrue(!resourceDetails.getUUID().equals(updatedResourceRespJavaObject.getUUID()));
 
-	}
+    }
 
-	protected void parseResponseAndValidate(ResourceReqDetails ResourceDetails, RestResponse restResponse)
-			throws Exception {
-		// parse response to javaObject
-		Resource updatedResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
-		// validate request vs response
-		ResourceValidationUtils.validateResourceReqVsResp(ResourceDetails, updatedResourceRespJavaObject);
-	}
+    protected void parseResponseAndValidate(ResourceReqDetails ResourceDetails, RestResponse restResponse)
+            throws Exception {
+        // parse response to javaObject
+        Resource updatedResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
+        // validate request vs response
+        ResourceValidationUtils.validateResourceReqVsResp(ResourceDetails, updatedResourceRespJavaObject);
+    }
 
-	public ExpectedResourceAuditJavaObject constructFieldsForAuditValidation(ResourceReqDetails resourceDetails,
-			String resourceVersion) {
+    public ExpectedResourceAuditJavaObject constructFieldsForAuditValidation(ResourceReqDetails resourceDetails,
+                                                                             String resourceVersion) {
 
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+        ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
 
-		expectedResourceAuditJavaObject.setAction("Checkout");
-		expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
-		expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
-		expectedResourceAuditJavaObject.setStatus("200.0");
-		expectedResourceAuditJavaObject.setDesc("OK");
-		expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName().toLowerCase());
-		expectedResourceAuditJavaObject.setResourceType("Resource");
-		expectedResourceAuditJavaObject.setPrevVersion(String.valueOf(Float.parseFloat(resourceVersion) - 0.1f));
-		expectedResourceAuditJavaObject.setCurrVersion(resourceVersion);
-		expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
-		expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setAction("Checkout");
+        expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
+        expectedResourceAuditJavaObject.setModifierName(UserRoleEnum.ADMIN.getUserName());
+        expectedResourceAuditJavaObject.setStatus("200.0");
+        expectedResourceAuditJavaObject.setDesc("OK");
+        expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName().toLowerCase());
+        expectedResourceAuditJavaObject.setResourceType("Resource");
+        expectedResourceAuditJavaObject.setPrevVersion(String.valueOf(Float.parseFloat(resourceVersion) - 0.1f));
+        expectedResourceAuditJavaObject.setCurrVersion(resourceVersion);
+        expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+        expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
 
-		return expectedResourceAuditJavaObject;
+        return expectedResourceAuditJavaObject;
 
-	}
+    }
 
-	public enum FieldToValidate {
-		contactId, Tags, VendorName, VendorRelease, Description
-	}
+    public enum FieldToValidate {
+        contactId, Tags, VendorName, VendorRelease, Description
+    }
 
-	@Test
-	public void UpdateBy_postTest() throws Exception {
+    @Test
+    public void UpdateBy_postTest() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// update resource - without changing resourceName
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        // update resource - without changing resourceName
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
 
-		RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails, "POST");
+        RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails, "POST");
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(resourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(resourceDetails, getRestResponse);
 
-	}
+    }
 
-	@Test
-	public void UpdateBy_getTest() throws Exception {
+    @Test
+    public void UpdateBy_getTest() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// update resource - without changing resourceName
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails, "GET");
+        // update resource - without changing resourceName
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails, "GET");
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(resourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(resourceDetails, getRestResponse);
 
-	}
+    }
 
-	@Test
-	public void UpdateBy_deleteTest() throws Exception {
+    @Test
+    public void UpdateBy_deleteTest() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// update resource - without changing resourceName
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails,
-				"DELETE");
+        // update resource - without changing resourceName
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        RestResponse updatedRestResponse = TryUpdateByAnotherVerb(updatedResourceDetails, sdncModifierDetails,
+                "DELETE");
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_ALLOWED.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		RestResponse getRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(resourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(resourceDetails, getRestResponse);
 
-	}
+    }
 
-	// TODO DE
-	// @Ignore("")
-	@Test
-	public void UpdateWithInvaldJsonBodyTest() throws Exception {
+    // TODO DE
+    // @Ignore("")
+    @Test
+    public void UpdateWithInvaldJsonBodyTest() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
-		String resourceId = resourceDetails.getUniqueId();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
+        String resourceId = resourceDetails.getUniqueId();
 
-		// update Descirption value
-		String description = "updatedDescription";
+        // update Descirption value
+        String description = "updatedDescription";
 
-		// send update with incompleted json, only description string
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(description, sdncModifierDetails,
-				resourceId);
+        // send update with incompleted json, only description string
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(description, sdncModifierDetails,
+                resourceId);
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("check error code after update resource", 400, updatedRestResponse.getErrorCode().intValue());
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("check error code after update resource", 400, updatedRestResponse.getErrorCode().intValue());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(resourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(resourceDetails, getRestResponse);
 
-	}
+    }
 
-	// @Test
-	// public void UpdateResourceModifierNotOwnerStateTest() throws Exception {
-	//
-	//
-	// RestResponse restResponse = createResource(sdncModifierDetails,
-	// resourceDetails);
-	// String resourceName = resourceDetails.getName();
-	//
-	// // new user parameters
-	// String userFirstName = "Kot";
-	// String userLastName = "Matroskin";
-	// String role = "ADMIN";
-	// User sdncUserDetails = new User(userFirstName, userLastName,
-	// httpCspUserId, email, role,null);
-	// RestResponse deleteUserResponse = userUtils.deleteUser(sdncUserDetails,
-	// ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
-	//
-	// RestResponse createUserResponse = UserUtils.createUser(sdncUserDetails,
-	// ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
-	//
-	// User updatedSdncModifierDetails = new User(userFirstName, userLastName,
-	// httpCspUserId, email,role,null);
-	// ResourceReqDetails updatedResourceDetails =
-	// defineUpdatedResourse(resourceName);
-	// RestResponse updatedRestResponse =
-	// ResourceRestUtils.updateResource(updatedResourceDetails,
-	// updatedSdncModifierDetails, resourceDetails.getUniqueId(), "");
-	//
-	// // validate response
-	// assertNotNull("check response object is not null after update resource",
-	// updatedRestResponse);
-	// assertNotNull("check error code exists in response after update
-	// resource", updatedRestResponse.getErrorCode());
-	// ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(),
-	// Empty_List, updatedRestResponse.getResponse());
-	//
-	// RestResponse getRestResponse =
-	// ResourceRestUtils.getResource(sdncModifierDetails,
-	// resourceDetails.getUniqueId());
-	// assertNotNull("check response object is not null after update resource",
-	// getRestResponse);
-	// parseResponseAndValidate(resourceDetails, getRestResponse);
-	//
-	//
-	// }
+    // @Test
+    // public void UpdateResourceModifierNotOwnerStateTest() throws Exception {
+    //
+    //
+    // RestResponse restResponse = createResource(sdncModifierDetails,
+    // resourceDetails);
+    // String resourceName = resourceDetails.getName();
+    //
+    // // new user parameters
+    // String userFirstName = "Kot";
+    // String userLastName = "Matroskin";
+    // String role = "ADMIN";
+    // User sdncUserDetails = new User(userFirstName, userLastName,
+    // httpCspUserId, email, role,null);
+    // RestResponse deleteUserResponse = userUtils.deleteUser(sdncUserDetails,
+    // ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
+    //
+    // RestResponse createUserResponse = UserUtils.createUser(sdncUserDetails,
+    // ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
+    //
+    // User updatedSdncModifierDetails = new User(userFirstName, userLastName,
+    // httpCspUserId, email,role,null);
+    // ResourceReqDetails updatedResourceDetails =
+    // defineUpdatedResourse(resourceName);
+    // RestResponse updatedRestResponse =
+    // ResourceRestUtils.updateResource(updatedResourceDetails,
+    // updatedSdncModifierDetails, resourceDetails.getUniqueId(), "");
+    //
+    // // validate response
+    // assertNotNull("check response object is not null after update resource",
+    // updatedRestResponse);
+    // assertNotNull("check error code exists in response after update
+    // resource", updatedRestResponse.getErrorCode());
+    // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(),
+    // Empty_List, updatedRestResponse.getResponse());
+    //
+    // RestResponse getRestResponse =
+    // ResourceRestUtils.getResource(sdncModifierDetails,
+    // resourceDetails.getUniqueId());
+    // assertNotNull("check response object is not null after update resource",
+    // getRestResponse);
+    // parseResponseAndValidate(resourceDetails, getRestResponse);
+    //
+    //
+    // }
 
-	@Test
-	public void UpdateResourceNameSensitiveTest() throws Exception {
-		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
-		String resourceName = "Ab";
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		// Delete resources
-		RestResponse response = null;
-		response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.1");
-		BaseRestUtils.checkDeleteResponse(response);
-		response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.2");
-		BaseRestUtils.checkDeleteResponse(response);
+    @Test
+    public void UpdateResourceNameSensitiveTest() throws Exception {
+        User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
+        String resourceName = "Ab";
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        // Delete resources
+        RestResponse response = null;
+        response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.1");
+        BaseRestUtils.checkDeleteResponse(response);
+        response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.2");
+        BaseRestUtils.checkDeleteResponse(response);
 
-		RestResponse restResponse = createResource(sdncModifierDetails, updatedResourceDetails);
-		assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
+        RestResponse restResponse = createResource(sdncModifierDetails, updatedResourceDetails);
+        assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
 
-		// check-in Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(updatedResourceDetails,
-				sdncModifierDetails, resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // check-in Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(updatedResourceDetails,
+                sdncModifierDetails, resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// String resourceCertifyVersion = "0.1";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(updatedResourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // String resourceCertifyVersion = "0.1";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(updatedResourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		updatedResourceDetails.setName("ABC_-bt.aT");
-		ArrayList<String> resourceTag = new ArrayList<String>();
-		resourceTag.add(0, "ABC_-bt.aT");
-		updatedResourceDetails.setTags(resourceTag);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, updatedResourceDetails.getUniqueId(), "");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(updatedResourceDetails, updatedRestResponse);
+        updatedResourceDetails.setName("ABC_-bt.aT");
+        ArrayList<String> resourceTag = new ArrayList<String>();
+        resourceTag.add(0, "ABC_-bt.aT");
+        updatedResourceDetails.setTags(resourceTag);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, updatedResourceDetails.getUniqueId(), "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(updatedResourceDetails, updatedRestResponse);
 
-		// Delete resources
-		response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.1");
-		BaseRestUtils.checkDeleteResponse(response);
-		response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.2");
-		BaseRestUtils.checkDeleteResponse(response);
+        // Delete resources
+        response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.1");
+        BaseRestUtils.checkDeleteResponse(response);
+        response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.2");
+        BaseRestUtils.checkDeleteResponse(response);
 
-	}
+    }
 
-	@Test
-	public void UpdateIcon_InegativeFlow() throws Exception {
+    @Test
+    public void UpdateIcon_InegativeFlow() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		List<String> resourceList = new ArrayList<String>();
-		resourceList.add(0, "Resource");
-		// check InValid Characters
-		char[] notValidCharsArray = new char[59];
-		notValidCharsArray = getInValidChars();
-		// update metadata details
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		RestResponse updatedRestResponse;
+        List<String> resourceList = new ArrayList<String>();
+        resourceList.add(0, "Resource");
+        // check InValid Characters
+        char[] notValidCharsArray = new char[59];
+        notValidCharsArray = getInValidChars();
+        // update metadata details
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        RestResponse updatedRestResponse;
 
-		for (int i = 0; i < notValidCharsArray.length; i++) {
-			// change icon of metadata
-			updatedResourceDetails.setIcon("MyIcon" + notValidCharsArray[i]);
-			// PUT request
-			updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-					resourceDetails.getUniqueId(), "");
-			// validate response
-			assertNotNull("check response object is not null after update resource", updatedRestResponse);
-			assertNotNull("check error code exists in response after update resource",
-					updatedRestResponse.getErrorCode());
-			ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_ICON.name(), resourceList,
-					updatedRestResponse.getResponse());
-			assertEquals("Check response code after updating resource icon", 400,
-					updatedRestResponse.getErrorCode().intValue());
-			assertEquals("Check response code after updating resource icon", "Bad Request",
-					updatedRestResponse.getResponseMessage().toString());
+        for (int i = 0; i < notValidCharsArray.length; i++) {
+            // change icon of metadata
+            updatedResourceDetails.setIcon("MyIcon" + notValidCharsArray[i]);
+            // PUT request
+            updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                    resourceDetails.getUniqueId(), "");
+            // validate response
+            assertNotNull("check response object is not null after update resource", updatedRestResponse);
+            assertNotNull("check error code exists in response after update resource",
+                    updatedRestResponse.getErrorCode());
+            ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_ICON.name(), resourceList,
+                    updatedRestResponse.getResponse());
+            assertEquals("Check response code after updating resource icon", 400,
+                    updatedRestResponse.getErrorCode().intValue());
+            assertEquals("Check response code after updating resource icon", "Bad Request",
+                    updatedRestResponse.getResponseMessage().toString());
 
-		}
+        }
 
-		// empty icon
-		String updateIcon = "";
-		updatedResourceDetails.setIcon(updateIcon);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_ICON.name(), resourceList,
-				updatedRestResponse.getResponse());
+        // empty icon
+        String updateIcon = "";
+        updatedResourceDetails.setIcon(updateIcon);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_ICON.name(), resourceList,
+                updatedRestResponse.getResponse());
 
-		// Icon length more then 25 characters
-		resourceList.add(1, "25");
-		updatedResourceDetails.setIcon("1234567890_-qwertyuiopASDNNN");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT.name(), resourceList,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after create resource", 400, updatedRestResponse.getErrorCode().intValue());
-		assertEquals("Check response code after updating resource icon", "Bad Request",
-				updatedRestResponse.getResponseMessage().toString());
+        // Icon length more then 25 characters
+        resourceList.add(1, "25");
+        updatedResourceDetails.setIcon("1234567890_-qwertyuiopASDNNN");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT.name(), resourceList,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after create resource", 400, updatedRestResponse.getErrorCode().intValue());
+        assertEquals("Check response code after updating resource icon", "Bad Request",
+                updatedRestResponse.getResponseMessage().toString());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
 
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_NoTagsEqualToResourceName() throws Exception {
+    @Test
+    public void UpdateResource_NoTagsEqualToResourceName() throws Exception {
 
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		ResourceReqDetails updatedResourceDetails = defineResourse();
-		updatedResourceDetails.setName("updatedResourceName");
-		List<String> tags = updatedResourceDetails.getTags();
+        ResourceReqDetails updatedResourceDetails = defineResourse();
+        updatedResourceDetails.setName("updatedResourceName");
+        List<String> tags = updatedResourceDetails.getTags();
 
-		for (Iterator<String> iter = tags.listIterator(); iter.hasNext();) {
-			String a = iter.next();
-			if (a.equals("updatedResourceName")) {
-				iter.remove();
-			}
-		}
+        for (Iterator<String> iter = tags.listIterator(); iter.hasNext(); ) {
+            String a = iter.next();
+            if (a.equals("updatedResourceName")) {
+                iter.remove();
+            }
+        }
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME.name(),
-				resourceList, updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource icon", 400,
-				updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME.name(),
+                resourceList, updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource icon", 400,
+                updatedRestResponse.getErrorCode().intValue());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceName_negativeFlow() throws Exception {
-		// The validation are done in Tag's validation
-		User sdncAdminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+    @Test
+    public void UpdateResourceName_negativeFlow() throws Exception {
+        // The validation are done in Tag's validation
+        User sdncAdminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
 
-		RestResponse updatedRestResponse;
-		RestResponse restResponse = createResource(sdncAdminModifierDetails, resourceDetails);
-		assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
-		String uniqueId = resourceDetails.getUniqueId();
-		String resourceName = resourceDetails.getName();
-		// check InValid Characters
-		char[] notValidCharsArray = new char[59];
-		notValidCharsArray = getInValidChars();
-		ArrayList<String> resource_Name = new ArrayList<String>();
-		List<String> resourceList = new ArrayList<String>();
+        RestResponse updatedRestResponse;
+        RestResponse restResponse = createResource(sdncAdminModifierDetails, resourceDetails);
+        assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
+        String uniqueId = resourceDetails.getUniqueId();
+        String resourceName = resourceDetails.getName();
+        // check InValid Characters
+        char[] notValidCharsArray = new char[59];
+        notValidCharsArray = getInValidChars();
+        ArrayList<String> resource_Name = new ArrayList<String>();
+        List<String> resourceList = new ArrayList<String>();
 
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceList.add(0, "Resource");
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceList.add(0, "Resource");
 
-		// update metadata details
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		for (int i = 0; i < notValidCharsArray.length; i++, resource_Name.clear()) {
-			if (i != 1 && i != 46
-					&& /*
+        // update metadata details
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        for (int i = 0; i < notValidCharsArray.length; i++, resource_Name.clear()) {
+            if (i != 1 && i != 46
+                    && /*
 						 * i != 8 && i != 9 && i != 10 && i != 11 && i != 12 &&
 						 */ i != 31) // space ("") and dot(.)
-			{
-				// change resourceName parameter
-				updatedResourceDetails.setName("UpdatedResourceName" + notValidCharsArray[i]);
-				resource_Name.add("UpdatedResourceName" + notValidCharsArray[i]);
-				updatedResourceDetails.setTags(resource_Name);
-				updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-						sdncAdminModifierDetails, uniqueId, "");
-				// validate response
-				// ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_TAG.name(),
-				// Empty_List, updatedRestResponse.getResponse());
-				ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), resourceList,
-						updatedRestResponse.getResponse());
+            {
+                // change resourceName parameter
+                updatedResourceDetails.setName("UpdatedResourceName" + notValidCharsArray[i]);
+                resource_Name.add("UpdatedResourceName" + notValidCharsArray[i]);
+                updatedResourceDetails.setTags(resource_Name);
+                updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                        sdncAdminModifierDetails, uniqueId, "");
+                // validate response
+                // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_TAG.name(),
+                // Empty_List, updatedRestResponse.getResponse());
+                ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), resourceList,
+                        updatedRestResponse.getResponse());
 
-			}
-		}
+            }
+        }
 
-		// resourceName length more then 50 characters
-		// Duplicate tags are allowed and should be de-duplicated by server side
-		resource_Name.add(resourceName);
-		resource_Name.add("tag1");
-		resource_Name.add("tag1");
-		resource_Name.add("tag2");
-		resource_Name.add("tag2");
+        // resourceName length more then 50 characters
+        // Duplicate tags are allowed and should be de-duplicated by server side
+        resource_Name.add(resourceName);
+        resource_Name.add("tag1");
+        resource_Name.add("tag1");
+        resource_Name.add("tag2");
+        resource_Name.add("tag2");
 
-		resourceList.add(1, "1024");
-		// updatedResourceDetails.setName("123456789012345678901234567890123456789012345678901");
-		updatedResourceDetails.setName(new String(new char[1025]).replace("\0", "a"));
-		// resource_Name.add("123456789012345678901234567890123456789012345678901");
-		updatedResourceDetails.setTags(resource_Name);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncAdminModifierDetails,
-				uniqueId, "");
-		// validate response
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), resourceList,
-				updatedRestResponse.getResponse());
+        resourceList.add(1, "1024");
+        // updatedResourceDetails.setName("123456789012345678901234567890123456789012345678901");
+        updatedResourceDetails.setName(new String(new char[1025]).replace("\0", "a"));
+        // resource_Name.add("123456789012345678901234567890123456789012345678901");
+        updatedResourceDetails.setTags(resource_Name);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncAdminModifierDetails,
+                uniqueId, "");
+        // validate response
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), resourceList,
+                updatedRestResponse.getResponse());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncAdminModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncAdminModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-		// delete resource
-		RestResponse response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails,
-				updatedResourceDetails.getName(), "0.1");
-		BaseRestUtils.checkDeleteResponse(response);
-	}
+        // delete resource
+        RestResponse response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails,
+                updatedResourceDetails.getName(), "0.1");
+        BaseRestUtils.checkDeleteResponse(response);
+    }
 
-	@Test
-	public void UpdateResourceInformation_NotCheckedOut() throws Exception {
+    @Test
+    public void UpdateResourceInformation_NotCheckedOut() throws Exception {
 
-		String resourceBaseVersion = "0.1";
-		List<String> resourceList = new ArrayList<String>();
+        String resourceBaseVersion = "0.1";
+        List<String> resourceList = new ArrayList<String>();
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// CheckIn Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN); // NOT_CERTIFIED_CHECKIN
-		assertNotNull("check response object is not null after checkout resource", checkoutResource);
-		assertNotNull("check error code exists in response after checkIn resource", checkoutResource.getErrorCode());
-		assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
+        // CheckIn Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN); // NOT_CERTIFIED_CHECKIN
+        assertNotNull("check response object is not null after checkout resource", checkoutResource);
+        assertNotNull("check error code exists in response after checkIn resource", checkoutResource.getErrorCode());
+        assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
 
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), resourceList,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource icon", 409,
-				updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), resourceList,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource icon", 409,
+                updatedRestResponse.getErrorCode().intValue());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
 
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceInformation_resourceVersion_11() throws Exception {
+    @Test
+    public void UpdateResourceInformation_resourceVersion_11() throws Exception {
 
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), resourceList,
-				updatedRestResponse.getResponse());
-		// assertEquals("Check response code after updating resource icon", 409,
-		// updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), resourceList,
+                updatedRestResponse.getResponse());
+        // assertEquals("Check response code after updating resource icon", 409,
+        // updatedRestResponse.getErrorCode().intValue());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
 
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
 
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceInformation_resourceVersion_02() throws Exception {
+    @Test
+    public void UpdateResourceInformation_resourceVersion_02() throws Exception {
 
-		String resourceBaseVersion = "0.1";
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// String resourceCertifyVersion = "0.1";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // String resourceCertifyVersion = "0.1";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after updating resource icon", 200,
-				updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after updating resource icon", 200,
+                updatedRestResponse.getErrorCode().intValue());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
 
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(updatedResourceDetails, getResourceRespJavaObject);
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(updatedResourceDetails, getResourceRespJavaObject);
 
-		// delete resource
-		RestResponse response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.1");
-		BaseRestUtils.checkDeleteResponse(response);
-		response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
-				updatedResourceDetails.getName(), "0.2");
-		BaseRestUtils.checkDeleteResponse(response);
+        // delete resource
+        RestResponse response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.1");
+        BaseRestUtils.checkDeleteResponse(response);
+        response = ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails,
+                updatedResourceDetails.getName(), "0.2");
+        BaseRestUtils.checkDeleteResponse(response);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceIcon_resourceVersion_11() throws Exception {
-		// Can be changed only if major version is "0".
+    @Test
+    public void UpdateResourceIcon_resourceVersion_11() throws Exception {
+        // Can be changed only if major version is "0".
 
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// ResourceReqDetails updatedResourceDetails =
-		// defineUpdatedResourse(resourceName);
-		ResourceReqDetails updatedResourceDetails = defineResourse();
-		// updatedResourceDetails.setVendorName("updatedVandorName");
-		updatedResourceDetails.setIcon("updatedIcon");
+        // ResourceReqDetails updatedResourceDetails =
+        // defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineResourse();
+        // updatedResourceDetails.setVendorName("updatedVandorName");
+        updatedResourceDetails.setIcon("updatedIcon");
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ICON_CANNOT_BE_CHANGED.name(), resourceList,
-				updatedRestResponse.getResponse());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ICON_CANNOT_BE_CHANGED.name(), resourceList,
+                updatedRestResponse.getResponse());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceVandorName_resourceVersion_11() throws Exception {
-		// Can be changed only if the major resource version is "0".
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+    @Test
+    public void UpdateResourceVandorName_resourceVersion_11() throws Exception {
+        // Can be changed only if the major resource version is "0".
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// ResourceReqDetails updatedResourceDetails =
-		// defineUpdatedResourse(resourceName);
-		ResourceReqDetails updatedResourceDetails = defineResourse();
+        // ResourceReqDetails updatedResourceDetails =
+        // defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineResourse();
 
-		updatedResourceDetails.setVendorName("updatedVandorName");
+        updatedResourceDetails.setVendorName("updatedVandorName");
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED.name(),
-				resourceList, updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource icon", 400,
-				updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED.name(),
+                resourceList, updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource icon", 400,
+                updatedRestResponse.getErrorCode().intValue());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceName_resourceVersion_11() throws Exception {
-		// Can be changed only if the major resource version is "0".
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+    @Test
+    public void UpdateResourceName_resourceVersion_11() throws Exception {
+        // Can be changed only if the major resource version is "0".
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("create resource failed", 201, restResponse.getErrorCode().intValue());
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
 		/*
 		 * //ResourceReqDetails updatedResourceDetails =
@@ -1319,1330 +1306,1330 @@
 		 * updatedResourceDetails.setResourceName("updatedResourceName");
 		 * updatedResourceDetails.setIcon("updatedResourceName");
 		 */
-		resourceDetails.setName("updatedResourceName");
-		List<String> tagList = new ArrayList<String>();
-		tagList.add(0, "updatedResourceName");
-		resourceDetails.setTags(tagList);
+        resourceDetails.setName("updatedResourceName");
+        List<String> tagList = new ArrayList<String>();
+        tagList.add(0, "updatedResourceName");
+        resourceDetails.setTags(tagList);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NAME_CANNOT_BE_CHANGED.name(), resourceList,
-				updatedRestResponse.getResponse());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NAME_CANNOT_BE_CHANGED.name(), resourceList,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTag_resourceVersion_11() throws Exception {
-		// Tag Can be updated when major version is "0".
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+    @Test
+    public void UpdateResourceTag_resourceVersion_11() throws Exception {
+        // Tag Can be updated when major version is "0".
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// ResourceReqDetails updatedResourceDetails =
-		// defineUpdatedResourse(resourceName);
-		ResourceReqDetails updatedResourceDetails = defineResourse();
-		// updatedResourceDetails.setVendorName("updatedVandorName");
+        // ResourceReqDetails updatedResourceDetails =
+        // defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineResourse();
+        // updatedResourceDetails.setVendorName("updatedVandorName");
 
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceTags.add("NewTag");
-		resourceTags.add(resourceDetails.getName());
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceTags.add("NewTag");
+        resourceTags.add(resourceDetails.getName());
 
-		updatedResourceDetails.setTags(resourceTags);
+        updatedResourceDetails.setTags(resourceTags);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(updatedResourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(updatedResourceDetails, getRestResponse);
 
-	}
+    }
 
-	@Test
-	public void UpdateAllowedParames_resourceVersion_11() throws Exception {
+    @Test
+    public void UpdateAllowedParames_resourceVersion_11() throws Exception {
 
-		// Tag, contactId, vendorRelease,tags And description - Can be also
-		// updated when major version is NOT "0".
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+        // Tag, contactId, vendorRelease,tags And description - Can be also
+        // updated when major version is NOT "0".
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// ResourceReqDetails updatedResourceDetails =
-		// defineUpdatedResourse(resourceName);
-		ResourceReqDetails updatedResourceDetails = defineResourse();
-		// updatedResourceDetails.setVendorName("updatedVandorName");
+        // ResourceReqDetails updatedResourceDetails =
+        // defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineResourse();
+        // updatedResourceDetails.setVendorName("updatedVandorName");
 
-		// updated allowed parameters when major resource version is NOT "0"
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceTags.add("NewTag");
-		resourceTags.add(resourceDetails.getName());
-		updatedResourceDetails.setTags(resourceTags);
-		updatedResourceDetails.setDescription("UpdatedDescription");
-		updatedResourceDetails.setVendorRelease("5.1");
-		updatedResourceDetails.setContactId("bt750h");
+        // updated allowed parameters when major resource version is NOT "0"
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceTags.add("NewTag");
+        resourceTags.add(resourceDetails.getName());
+        updatedResourceDetails.setTags(resourceTags);
+        updatedResourceDetails.setDescription("UpdatedDescription");
+        updatedResourceDetails.setVendorRelease("5.1");
+        updatedResourceDetails.setContactId("bt750h");
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(updatedResourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(updatedResourceDetails, getRestResponse);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceDerivedFrom_resourceVersion_11() throws Exception {
-		// DerivedFrom parameter - Can be updated when major version is "0".
-		User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		String resourceBaseVersion = "0.1";
+    @Test
+    public void UpdateResourceDerivedFrom_resourceVersion_11() throws Exception {
+        // DerivedFrom parameter - Can be updated when major version is "0".
+        User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        String resourceBaseVersion = "0.1";
 
-		// create resource
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String resourceName = resourceDetails.getName();
+        // create resource
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String resourceName = resourceDetails.getName();
 
-		// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
-		// restResponse);
+        // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
+        // restResponse);
 
-		// Certify Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        // Certify Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        /*logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());*/
 
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
-				resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, adminModifierDetails,
+                resourceBaseVersion, LifeCycleStatesEnum.CERTIFY);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		String resourceCertifyVersion = "1.0";
-		logger.debug("Changing resource life cycle ");
-		checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
+        String resourceCertifyVersion = "1.0";
+        logger.debug("Changing resource life cycle ");
+        checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceCertifyVersion, LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after checkout resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// ResourceReqDetails updatedResourceDetails =
-		// defineUpdatedResourse(resourceName);
-		ResourceReqDetails updatedResourceDetails = defineResourse();
-		ArrayList<String> drivenFrom = new ArrayList<String>();
-		drivenFrom.add(0, "tosca.nodes.Container.Application");
-		updatedResourceDetails.setDerivedFrom(drivenFrom);
+        // ResourceReqDetails updatedResourceDetails =
+        // defineUpdatedResourse(resourceName);
+        ResourceReqDetails updatedResourceDetails = defineResourse();
+        ArrayList<String> drivenFrom = new ArrayList<String>();
+        drivenFrom.add(0, "tosca.nodes.Container.Application");
+        updatedResourceDetails.setDerivedFrom(drivenFrom);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		ResourceRestUtils.checkSuccess(updatedRestResponse);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        ResourceRestUtils.checkSuccess(updatedRestResponse);
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_vendorNameValidation() throws Exception {
+    @Test
+    public void UpdateResource_vendorNameValidation() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		String updatedVendorName = "";
-		String uniqueId = resourceDetails.getUniqueId();
-		resourceDetails.setVendorName(updatedVendorName);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, uniqueId, "");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        String updatedVendorName = "";
+        String uniqueId = resourceDetails.getUniqueId();
+        resourceDetails.setVendorName(updatedVendorName);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, uniqueId, "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		// update resource vendorName metadata: 1 characters
-		updatedVendorName = "	";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource vendorName metadata: 1 characters
+        updatedVendorName = "	";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		// update resource vendorName metadata: 25 characters
-		updatedVendorName = "Verification and validati";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource vendorName metadata: 25 characters
+        updatedVendorName = "Verification and validati";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// update resource vendorName metadata: 26 characters
-		updatedVendorName = "Verification and validatii";
-		// set vendorName
-		List<String> myList = new ArrayList<String>();
-		myList.add(0, "25");
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT.name(), myList,
-				updatedRestResponse.getResponse());
+        // update resource vendorName metadata: 26 characters
+        updatedVendorName = "Verification and validatii";
+        // set vendorName
+        List<String> myList = new ArrayList<String>();
+        myList.add(0, "25");
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		// update resource VendorRelease metadata: forbidden characters
-		updatedVendorName = "A1<";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource VendorRelease metadata: forbidden characters
+        updatedVendorName = "A1<";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1>";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1>";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1:";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1:";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1\"";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1\"";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1/";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1/";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1\\";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1\\";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1|";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1|";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1?";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1?";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorName = "A1*";
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorName = "A1*";
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		// update resource vendorName metadata: null
-		updatedVendorName = null;
-		// set vendorName
-		resourceDetails.setVendorName(updatedVendorName);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource vendorName metadata: null
+        updatedVendorName = null;
+        // set vendorName
+        resourceDetails.setVendorName(updatedVendorName);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_NAME.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_vendorReleaseValidation() throws Exception {
+    @Test
+    public void UpdateResource_vendorReleaseValidation() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		RestResponse updatedRestResponse;
-		String uniqueId = resourceDetails.getUniqueId();
-		String updatedVendorRelease;
-		// set VendorRelease
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        RestResponse updatedRestResponse;
+        String uniqueId = resourceDetails.getUniqueId();
+        String updatedVendorRelease;
+        // set VendorRelease
 
-		// update resource VendorRelease metadata: 1 characters
-		updatedVendorRelease = "1";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource VendorRelease metadata: 1 characters
+        updatedVendorRelease = "1";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// update resource VendorRelease metadata: 25 characters
-		updatedVendorRelease = "(!#1.00000000000000000000";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource VendorRelease metadata: 25 characters
+        updatedVendorRelease = "(!#1.00000000000000000000";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// update resource VendorRelease metadata: 26 characters
-		updatedVendorRelease = "(!#1.000000000000000000005";// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT.name(),
-				Arrays.asList("" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH), updatedRestResponse.getResponse());
+        // update resource VendorRelease metadata: 26 characters
+        updatedVendorRelease = "(!#1.000000000000000000005";// set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT.name(),
+                Arrays.asList("" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH), updatedRestResponse.getResponse());
 
-		// UpdateAndValidate(sdncModifierDetails, resourceDetails,
-		// ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT.name(),
-		// Arrays.asList(""+ValidationUtils.VENDOR_RELEASE_MAX_LENGTH));
+        // UpdateAndValidate(sdncModifierDetails, resourceDetails,
+        // ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT.name(),
+        // Arrays.asList(""+ValidationUtils.VENDOR_RELEASE_MAX_LENGTH));
 
-		// update resource VendorRelease metadata: forbidden characters
-		updatedVendorRelease = "A1<";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource VendorRelease metadata: forbidden characters
+        updatedVendorRelease = "A1<";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1>";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1>";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1:";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1:";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1\"";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1\"";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1/";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1/";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1\\";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1\\";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1|";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1|";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1?";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1?";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		updatedVendorRelease = "A1*";
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        updatedVendorRelease = "A1*";
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		// update resource VendorRelease metadata: null
-		updatedVendorRelease = null;
-		// set VendorRelease
-		resourceDetails.setVendorRelease(updatedVendorRelease);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_RELEASE.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource VendorRelease metadata: null
+        updatedVendorRelease = null;
+        // set VendorRelease
+        resourceDetails.setVendorRelease(updatedVendorRelease);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_VENDOR_RELEASE.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_contactIdValidation() throws Exception { // [a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]{1}
-																			// (6
-																			// characters
-																			// now,
-																			// may
-																			// be
-																			// expanded
-																			// up
-																			// to
-																			// 8
-																			// characters
-																			// in
-																			// the
-																			// future).
-																			// Convert
-																			// Upper
-																			// case
-																			// character
-																			// to
-																			// lower
-																			// case
-		RestResponse updatedRestResponse;
+    @Test
+    public void UpdateResource_contactIdValidation() throws Exception { // [a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]{1}
+        // (6
+        // characters
+        // now,
+        // may
+        // be
+        // expanded
+        // up
+        // to
+        // 8
+        // characters
+        // in
+        // the
+        // future).
+        // Convert
+        // Upper
+        // case
+        // character
+        // to
+        // lower
+        // case
+        RestResponse updatedRestResponse;
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		String uniqueId = resourceDetails.getUniqueId();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        String uniqueId = resourceDetails.getUniqueId();
 
-		List<String> myList = new ArrayList<String>();
-		myList.add(0, "Resource");
-		String updatedcontactId = "";
-		resourceDetails.setContactId(updatedcontactId);
+        List<String> myList = new ArrayList<String>();
+        myList.add(0, "Resource");
+        String updatedcontactId = "";
+        resourceDetails.setContactId(updatedcontactId);
 
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "ab12345";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "ab12345";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "      ";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "      ";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "ab 50h";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "ab 50h";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "ab123c";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        updatedcontactId = "ab123c";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		updatedcontactId = "cd789E";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        updatedcontactId = "cd789E";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		resourceDetails.setContactId(updatedcontactId.toLowerCase());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        resourceDetails.setContactId(updatedcontactId.toLowerCase());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		updatedcontactId = "ef4567";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        updatedcontactId = "ef4567";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		updatedcontactId = "AA012A";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        updatedcontactId = "AA012A";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		resourceDetails.setContactId(updatedcontactId.toLowerCase());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        resourceDetails.setContactId(updatedcontactId.toLowerCase());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		updatedcontactId = "CD012c";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        updatedcontactId = "CD012c";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		resourceDetails.setContactId(updatedcontactId.toLowerCase());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        resourceDetails.setContactId(updatedcontactId.toLowerCase());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		updatedcontactId = "EF0123";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        updatedcontactId = "EF0123";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
 
-		resourceDetails.setContactId(updatedcontactId.toLowerCase());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        resourceDetails.setContactId(updatedcontactId.toLowerCase());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		////////////////////////////// **************//////////////////////////////
-		List<String> resource = Arrays.asList("Resource");
-		updatedcontactId = "01345a";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        ////////////////////////////// **************//////////////////////////////
+        List<String> resource = Arrays.asList("Resource");
+        updatedcontactId = "01345a";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "0y000B";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "0y000B";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "Y1000b";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "Y1000b";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "abxyzC";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "abxyzC";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "cdXYZc";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "cdXYZc";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "efXY1D";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "efXY1D";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "EFabcD";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "EFabcD";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "EFABCD";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "EFABCD";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "EFABC1";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "EFABC1";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "efui1D";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "efui1D";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "efui1!";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "efui1!";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "ef555!";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "ef555!";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = ",f555";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = ",f555";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		updatedcontactId = "EF55.5";
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        updatedcontactId = "EF55.5";
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		// update resource contactId metadata: extended character set (128–255)
-		resourceDetails.setContactId(extendedCharsStringBuilder());
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        // update resource contactId metadata: extended character set (128–255)
+        resourceDetails.setContactId(extendedCharsStringBuilder());
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-		// update resource contactId metadata: null
-		updatedcontactId = null;
-		resourceDetails.setContactId(updatedcontactId);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
-				updatedRestResponse.getResponse());
+        // update resource contactId metadata: null
+        updatedcontactId = null;
+        resourceDetails.setContactId(updatedcontactId);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CONTACT.name(), myList,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_TagsFieldValidation() throws Exception {
-		RestResponse updatedRestResponse;
-		// define and create resource
+    @Test
+    public void UpdateResource_TagsFieldValidation() throws Exception {
+        RestResponse updatedRestResponse;
+        // define and create resource
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		String uniqueId = resourceDetails.getUniqueId();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        String uniqueId = resourceDetails.getUniqueId();
 
-		String updatedTagField = "";
-		ArrayList<String> resourceTags = new ArrayList<String>();
-		resourceTags.add(updatedTagField);
-		// set description
-		resourceDetails.setTags(resourceTags);
-		List<String> variables = Arrays.asList("Resource", "tag");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_FIELD_FORMAT.name(), variables,
-				updatedRestResponse.getResponse());
+        String updatedTagField = "";
+        ArrayList<String> resourceTags = new ArrayList<String>();
+        resourceTags.add(updatedTagField);
+        // set description
+        resourceDetails.setTags(resourceTags);
+        List<String> variables = Arrays.asList("Resource", "tag");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_FIELD_FORMAT.name(), variables,
+                updatedRestResponse.getResponse());
 
-		// update resource tags metadata: empty
-		resourceTags = new ArrayList<String>();
-		// set Tags
-		resourceDetails.setTags(resourceTags);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_TAGS.name(), Empty_List,
-				updatedRestResponse.getResponse());
+        // update resource tags metadata: empty
+        resourceTags = new ArrayList<String>();
+        // set Tags
+        resourceDetails.setTags(resourceTags);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_TAGS.name(), Empty_List,
+                updatedRestResponse.getResponse());
 
-		// update resource description metadata: 1 characters
-		updatedTagField = "A";
-		resourceTags = new ArrayList<String>();
-		resourceTags.add(updatedTagField);
-		resourceTags.add(resourceDetails.getName());
-		// set description
-		resourceDetails.setTags(resourceTags);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource description metadata: 1 characters
+        updatedTagField = "A";
+        resourceTags = new ArrayList<String>();
+        resourceTags.add(updatedTagField);
+        resourceTags.add(resourceDetails.getName());
+        // set description
+        resourceDetails.setTags(resourceTags);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// OK - tag up to 50 chars
-		updatedTagField = "The Indian-crested.porcupine_The Indian cresteddds";
-		resourceTags.add(updatedTagField);
-		resourceDetails.setTags(resourceTags);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // OK - tag up to 50 chars
+        updatedTagField = "The Indian-crested.porcupine_The Indian cresteddds";
+        resourceTags.add(updatedTagField);
+        resourceDetails.setTags(resourceTags);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// OK - sum is 1024, 50x20+48+20(commas)+6(cisco4 - resource name)
-		String updatedTagField1 = "The Indian-crested.porcupine_The Indian crestedd01";
-		String updatedTagField2 = "The Indian-crested.porcupine_The Indian crestedd02";
-		String updatedTagField3 = "The Indian-crested.porcupine_The Indian crestedd03";
-		String updatedTagField4 = "The Indian-crested.porcupine_The Indian crestedd04";
-		String updatedTagField5 = "The Indian-crested.porcupine_The Indian crestedd05";
-		String updatedTagField6 = "The Indian-crested.porcupine_The Indian crestedd06";
-		String updatedTagField7 = "The Indian-crested.porcupine_The Indian crestedd07";
-		String updatedTagField8 = "The Indian-crested.porcupine_The Indian crestedd08";
-		String updatedTagField9 = "The Indian-crested.porcupine_The Indian crestedd09";
-		String updatedTagField10 = "The Indian-crested.porcupine_The Indian crestedd10";
-		String updatedTagField11 = "The Indian-crested.porcupine_The Indian crestedd11";
-		String updatedTagField12 = "The Indian-crested.porcupine_The Indian crestedd12";
-		String updatedTagField13 = "The Indian-crested.porcupine_The Indian crestedd13";
-		String updatedTagField14 = "The Indian-crested.porcupine_The Indian crestedd14";
-		String updatedTagField15 = "The Indian-crested.porcupine_The Indian crestedd15";
-		String updatedTagField16 = "The Indian-crested.porcupine_The Indian crestedd16";
-		String updatedTagField17 = "The Indian-crested.porcupine_The Indian crestedd17";
-		String updatedTagField18 = "The Indian-crested.porcupine_The Indian crestedd18";
-		String updatedTagField19 = "The Indian-crested.porcupine_The Indian crestaa";
+        // OK - sum is 1024, 50x20+48+20(commas)+6(cisco4 - resource name)
+        String updatedTagField1 = "The Indian-crested.porcupine_The Indian crestedd01";
+        String updatedTagField2 = "The Indian-crested.porcupine_The Indian crestedd02";
+        String updatedTagField3 = "The Indian-crested.porcupine_The Indian crestedd03";
+        String updatedTagField4 = "The Indian-crested.porcupine_The Indian crestedd04";
+        String updatedTagField5 = "The Indian-crested.porcupine_The Indian crestedd05";
+        String updatedTagField6 = "The Indian-crested.porcupine_The Indian crestedd06";
+        String updatedTagField7 = "The Indian-crested.porcupine_The Indian crestedd07";
+        String updatedTagField8 = "The Indian-crested.porcupine_The Indian crestedd08";
+        String updatedTagField9 = "The Indian-crested.porcupine_The Indian crestedd09";
+        String updatedTagField10 = "The Indian-crested.porcupine_The Indian crestedd10";
+        String updatedTagField11 = "The Indian-crested.porcupine_The Indian crestedd11";
+        String updatedTagField12 = "The Indian-crested.porcupine_The Indian crestedd12";
+        String updatedTagField13 = "The Indian-crested.porcupine_The Indian crestedd13";
+        String updatedTagField14 = "The Indian-crested.porcupine_The Indian crestedd14";
+        String updatedTagField15 = "The Indian-crested.porcupine_The Indian crestedd15";
+        String updatedTagField16 = "The Indian-crested.porcupine_The Indian crestedd16";
+        String updatedTagField17 = "The Indian-crested.porcupine_The Indian crestedd17";
+        String updatedTagField18 = "The Indian-crested.porcupine_The Indian crestedd18";
+        String updatedTagField19 = "The Indian-crested.porcupine_The Indian crestaa";
 
-		resourceTags = new ArrayList<String>();
-		resourceTags.add(updatedTagField);
-		resourceTags.add(updatedTagField1);
-		resourceTags.add(updatedTagField2);
-		resourceTags.add(updatedTagField3);
-		resourceTags.add(updatedTagField4);
-		resourceTags.add(updatedTagField5);
-		resourceTags.add(updatedTagField6);
-		resourceTags.add(updatedTagField7);
-		resourceTags.add(updatedTagField8);
-		resourceTags.add(updatedTagField9);
-		resourceTags.add(updatedTagField10);
-		resourceTags.add(updatedTagField11);
-		resourceTags.add(updatedTagField12);
-		resourceTags.add(updatedTagField13);
-		resourceTags.add(updatedTagField14);
-		resourceTags.add(updatedTagField15);
-		resourceTags.add(updatedTagField16);
-		resourceTags.add(updatedTagField17);
-		resourceTags.add(updatedTagField18);
-		resourceTags.add(updatedTagField19);
-		resourceTags.add(resourceDetails.getName());
-		// set description
-		resourceDetails.setTags(resourceTags);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        resourceTags = new ArrayList<String>();
+        resourceTags.add(updatedTagField);
+        resourceTags.add(updatedTagField1);
+        resourceTags.add(updatedTagField2);
+        resourceTags.add(updatedTagField3);
+        resourceTags.add(updatedTagField4);
+        resourceTags.add(updatedTagField5);
+        resourceTags.add(updatedTagField6);
+        resourceTags.add(updatedTagField7);
+        resourceTags.add(updatedTagField8);
+        resourceTags.add(updatedTagField9);
+        resourceTags.add(updatedTagField10);
+        resourceTags.add(updatedTagField11);
+        resourceTags.add(updatedTagField12);
+        resourceTags.add(updatedTagField13);
+        resourceTags.add(updatedTagField14);
+        resourceTags.add(updatedTagField15);
+        resourceTags.add(updatedTagField16);
+        resourceTags.add(updatedTagField17);
+        resourceTags.add(updatedTagField18);
+        resourceTags.add(updatedTagField19);
+        resourceTags.add(resourceDetails.getName());
+        // set description
+        resourceDetails.setTags(resourceTags);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// Add another tag-exceeds limit
-		resourceTags.add("d");
-		resourceDetails.setTags(resourceTags);
-		ArrayList<String> myArray = new ArrayList<String>();
-		myArray.add(0, "1024");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT.name(), myArray,
-				updatedRestResponse.getResponse());
+        // Add another tag-exceeds limit
+        resourceTags.add("d");
+        resourceDetails.setTags(resourceTags);
+        ArrayList<String> myArray = new ArrayList<String>();
+        myArray.add(0, "1024");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT.name(), myArray,
+                updatedRestResponse.getResponse());
 
-		// Tag exceeds limit - 51
-		resourceTags = new ArrayList<String>();
-		updatedTagField = "The Indian-crested.porcupine_The Indian crestedddsw";
-		resourceTags.add(updatedTagField);
-		resourceTags.add(resourceDetails.getName());
-		// set description
-		resourceDetails.setTags(resourceTags);
-		myArray.remove(0);
-		myArray.add(0, "50");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT.name(), myArray,
-				updatedRestResponse.getResponse());
+        // Tag exceeds limit - 51
+        resourceTags = new ArrayList<String>();
+        updatedTagField = "The Indian-crested.porcupine_The Indian crestedddsw";
+        resourceTags.add(updatedTagField);
+        resourceTags.add(resourceDetails.getName());
+        // set description
+        resourceDetails.setTags(resourceTags);
+        myArray.remove(0);
+        myArray.add(0, "50");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT.name(), myArray,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_DesriptionFieldValidation() throws Exception {
-		// define and create resource
-		RestResponse updatedRestResponse;
+    @Test
+    public void UpdateResource_DesriptionFieldValidation() throws Exception {
+        // define and create resource
+        RestResponse updatedRestResponse;
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		String uniqueId = resourceDetails.getUniqueId();
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		List<String> resource = new ArrayList<>();
-		resource.add("Resource");
-		// update resource description metadata: 0 characters
-		String updatedDescription = "";
-		// set description
-		resourceDetails.setDescription(updatedDescription);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource,
-				updatedRestResponse.getResponse());
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        String uniqueId = resourceDetails.getUniqueId();
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        List<String> resource = new ArrayList<>();
+        resource.add("Resource");
+        // update resource description metadata: 0 characters
+        String updatedDescription = "";
+        // set description
+        resourceDetails.setDescription(updatedDescription);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource,
+                updatedRestResponse.getResponse());
 
-		// update resource description metadata: null
-		updatedDescription = null;
-		// set description
-		resourceDetails.setDescription(updatedDescription);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource,
-				updatedRestResponse.getResponse());
+        // update resource description metadata: null
+        updatedDescription = null;
+        // set description
+        resourceDetails.setDescription(updatedDescription);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name(), resource,
+                updatedRestResponse.getResponse());
 
-		// update resource description metadata: 1 characters
-		updatedDescription = "A";
-		// set description
-		resourceDetails.setDescription(updatedDescription);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource description metadata: 1 characters
+        updatedDescription = "A";
+        // set description
+        resourceDetails.setDescription(updatedDescription);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// update resource description metadata: 1024 characters
-		updatedDescription = "The Indian crested porcupine *{Hystrix indica}*, or Indian porcupine is a member of the Old World porcupines."
-				+ "It is quite an adaptable rodent, found throughout southern Asia and the Middle East."
-				+ "It is tolerant of several different habitats: mountains, tropical and subtropical grasslands, scrublands, and forests."
-				+ "It is a large rodent, growing more than 0.9 m = (3 ft) long and weighing 14.5 kg = (32 lb)! [citation needed] It is covered in multiple layers of quills."
-				+ "The longest quills grow from its shoulders to about a third of the animal's length."
-				+ "Its tail is covered in short, hollow quills that can rattle when threatened."
-				+ "It has broad feet and long claws for digging. When attacked, the Indian crested porcupine raises its quills and rattles the hollow quills on its tail."
-				+ "If the predator persists past these threats, the porcupine launches a backwards assault, hoping to stab its attacker with its quills."
-				+ "It does this so effectively that most brushes between predators and the Indian porcupine end in death or severe injury";
-		// set description
-		resourceDetails.setDescription(updatedDescription);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		parseResponseAndValidate(resourceDetails, updatedRestResponse);
+        // update resource description metadata: 1024 characters
+        updatedDescription = "The Indian crested porcupine *{Hystrix indica}*, or Indian porcupine is a member of the Old World porcupines."
+                + "It is quite an adaptable rodent, found throughout southern Asia and the Middle East."
+                + "It is tolerant of several different habitats: mountains, tropical and subtropical grasslands, scrublands, and forests."
+                + "It is a large rodent, growing more than 0.9 m = (3 ft) long and weighing 14.5 kg = (32 lb)! [citation needed] It is covered in multiple layers of quills."
+                + "The longest quills grow from its shoulders to about a third of the animal's length."
+                + "Its tail is covered in short, hollow quills that can rattle when threatened."
+                + "It has broad feet and long claws for digging. When attacked, the Indian crested porcupine raises its quills and rattles the hollow quills on its tail."
+                + "If the predator persists past these threats, the porcupine launches a backwards assault, hoping to stab its attacker with its quills."
+                + "It does this so effectively that most brushes between predators and the Indian porcupine end in death or severe injury";
+        // set description
+        resourceDetails.setDescription(updatedDescription);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        parseResponseAndValidate(resourceDetails, updatedRestResponse);
 
-		// update resource description metadata: 1025 characters
-		updatedDescription = "The Indian crested porcupine *{Hystrix indica}*, or Indian porcupine is a member of the Old World porcupines."
-				+ "It is quite an adaptable rodent, found throughout southern Asia and the Middle East."
-				+ "It is tolerant of several different habitats: mountains, tropical and subtropical grasslands, scrublands, and forests."
-				+ "It is a large rodent, growing more than 0.9 m = (3 ft) long and weighing 14.5 kg = (32 lb)! [citation needed] It is covered in multiple layers of quills."
-				+ "The longest quills grow from its shoulders to about a third of the animal's length."
-				+ "Its tail is covered in short, hollow quills that can rattle when threatened."
-				+ "It has broad feet and long claws for digging. When attacked, the Indian crested porcupine raises its quills and rattles the hollow quills on its tail."
-				+ "If the predator persists past these threats, the porcupine launches a backwards assault, hoping to stab its attacker with its quills."
-				+ "It does this so effectively that most brushes between predators and the Indian porcupine end in death or severe injury.";
-		// set description
-		resourceDetails.setDescription(updatedDescription);
-		resource.add(1, "1024");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
-				"");
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT.name(), resource,
-				updatedRestResponse.getResponse());
+        // update resource description metadata: 1025 characters
+        updatedDescription = "The Indian crested porcupine *{Hystrix indica}*, or Indian porcupine is a member of the Old World porcupines."
+                + "It is quite an adaptable rodent, found throughout southern Asia and the Middle East."
+                + "It is tolerant of several different habitats: mountains, tropical and subtropical grasslands, scrublands, and forests."
+                + "It is a large rodent, growing more than 0.9 m = (3 ft) long and weighing 14.5 kg = (32 lb)! [citation needed] It is covered in multiple layers of quills."
+                + "The longest quills grow from its shoulders to about a third of the animal's length."
+                + "Its tail is covered in short, hollow quills that can rattle when threatened."
+                + "It has broad feet and long claws for digging. When attacked, the Indian crested porcupine raises its quills and rattles the hollow quills on its tail."
+                + "If the predator persists past these threats, the porcupine launches a backwards assault, hoping to stab its attacker with its quills."
+                + "It does this so effectively that most brushes between predators and the Indian porcupine end in death or severe injury.";
+        // set description
+        resourceDetails.setDescription(updatedDescription);
+        resource.add(1, "1024");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails, sdncModifierDetails, uniqueId,
+                "");
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT.name(), resource,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResource_TagsFormatValidation() throws Exception {
-		char[] notValidCharsArray = getTagInValidFormatChars();
+    @Test
+    public void UpdateResource_TagsFormatValidation() throws Exception {
+        char[] notValidCharsArray = getTagInValidFormatChars();
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check recourse created ", 201, restResponse.getErrorCode().intValue());
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check recourse created ", 201, restResponse.getErrorCode().intValue());
+        String resourceName = resourceDetails.getName();
 
-		// update tag details
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		ArrayList<String> resourceTags = new ArrayList<String>();
+        // update tag details
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        ArrayList<String> resourceTags = new ArrayList<String>();
 
-		String updatedTagField;
-		RestResponse updatedRestResponse;
-		List<String> variables = Arrays.asList("Resource", "tag");
+        String updatedTagField;
+        RestResponse updatedRestResponse;
+        List<String> variables = Arrays.asList("Resource", "tag");
 
-		for (int i = 0; i < notValidCharsArray.length; i++) {
-			updatedTagField = "UpdatedTag" + notValidCharsArray[i];
-			resourceTags = new ArrayList<String>();
-			resourceTags.add(updatedTagField);
-			resourceTags.add(resourceDetails.getName());
-			// set description
-			updatedResourceDetails.setTags(resourceTags);
+        for (int i = 0; i < notValidCharsArray.length; i++) {
+            updatedTagField = "UpdatedTag" + notValidCharsArray[i];
+            resourceTags = new ArrayList<String>();
+            resourceTags.add(updatedTagField);
+            resourceTags.add(resourceDetails.getName());
+            // set description
+            updatedResourceDetails.setTags(resourceTags);
 
-			updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-					resourceDetails.getUniqueId(), "");
-			// validate response
-			assertNotNull("check response object is not null after update resource", updatedRestResponse);
-			assertNotNull("check error code exists in response after update resource",
-					updatedRestResponse.getErrorCode());
-			ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_FIELD_FORMAT.name(), variables,
-					updatedRestResponse.getResponse());
-			assertEquals("Check response code after updating resource icon", 400,
-					updatedRestResponse.getErrorCode().intValue());
-			assertEquals("Check response code after updating resource icon", "Bad Request",
-					updatedRestResponse.getResponseMessage().toString());
+            updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                    resourceDetails.getUniqueId(), "");
+            // validate response
+            assertNotNull("check response object is not null after update resource", updatedRestResponse);
+            assertNotNull("check error code exists in response after update resource",
+                    updatedRestResponse.getErrorCode());
+            ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_FIELD_FORMAT.name(), variables,
+                    updatedRestResponse.getResponse());
+            assertEquals("Check response code after updating resource icon", 400,
+                    updatedRestResponse.getErrorCode().intValue());
+            assertEquals("Check response code after updating resource icon", "Bad Request",
+                    updatedRestResponse.getResponseMessage().toString());
 
-		}
+        }
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceCategory_negativeFlow() throws Exception {
+    @Test
+    public void UpdateResourceCategory_negativeFlow() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after update resource", 201, restResponse.getErrorCode().intValue());
-		Resource resourceBeforeUpdate = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
-		String uniqueID = resourceDetails.getUniqueId();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after update resource", 201, restResponse.getErrorCode().intValue());
+        Resource resourceBeforeUpdate = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
+        String uniqueID = resourceDetails.getUniqueId();
 
-		// Update resource Category Successfully
-		ResourceReqDetails updatedResourceDetails = resourceDetails;
+        // Update resource Category Successfully
+        ResourceReqDetails updatedResourceDetails = resourceDetails;
 
-		updatedResourceDetails.removeAllCategories();
-		updatedResourceDetails.addCategoryChain(ServiceCategoriesEnum.MOBILITY.getValue(),
-				ResourceCategoryEnum.APPLICATION_L4_DATABASE.getSubCategory());
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        updatedResourceDetails.removeAllCategories();
+        updatedResourceDetails.addCategoryChain(ServiceCategoriesEnum.MOBILITY.getValue(),
+                ResourceCategoryEnum.APPLICATION_L4_DATABASE.getSubCategory());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
 
-		// validate response
-		List<String> resourceList = new ArrayList<String>();
-		resourceList.add(0, "Resource");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CATEGORY.name(), resourceList,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
+        // validate response
+        List<String> resourceList = new ArrayList<String>();
+        resourceList.add(0, "Resource");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CATEGORY.name(), resourceList,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
 
-		// Updating resource category
-		updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
-		updatedResourceDetails.addCategory("");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		// validate response
-		resourceList = new ArrayList<String>();
-		resourceList.add(0, "Resource");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CATEGORY.name(), resourceList,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
+        // Updating resource category
+        updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
+        updatedResourceDetails.addCategory("");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        // validate response
+        resourceList = new ArrayList<String>();
+        resourceList.add(0, "Resource");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_CATEGORY.name(), resourceList,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
 
-		// Updating resource category
-		updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
-		updatedResourceDetails.addCategory("XXXXXX");
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		// validate response
-		resourceList = new ArrayList<String>();
-		resourceList.add(0, "Resource");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CATEGORY.name(), resourceList,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
+        // Updating resource category
+        updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
+        updatedResourceDetails.addCategory("XXXXXX");
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        // validate response
+        resourceList = new ArrayList<String>();
+        resourceList.add(0, "Resource");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_CATEGORY.name(), resourceList,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource", 400, updatedRestResponse.getErrorCode().intValue());
 
-		// CheckIn Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN); // NOT_CERTIFIED_CHECKIN
-		assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
+        // CheckIn Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkoutResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN); // NOT_CERTIFIED_CHECKIN
+        assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
 
-		// Update resource Category
-		updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
-		updatedResourceDetails.addCategory(ServiceCategoriesEnum.VOIP.getValue());
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		// verify response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), Empty_List,
-				updatedRestResponse.getResponse());
-		assertEquals("Check response code after updating resource", 409, updatedRestResponse.getErrorCode().intValue());
+        // Update resource Category
+        updatedResourceDetails = defineUpdateResourceWithNonUpdatableFields(resourceBeforeUpdate);
+        updatedResourceDetails.addCategory(ServiceCategoriesEnum.VOIP.getValue());
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        // verify response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), Empty_List,
+                updatedRestResponse.getResponse());
+        assertEquals("Check response code after updating resource", 409, updatedRestResponse.getErrorCode().intValue());
 
-		// CheckIn Resource
-		logger.debug("Changing resource life cycle ");
-		RestResponse checkinResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT); // NOT_CERTIFIED_CHECKIN
-		assertNotNull("check response object is not null after checkout resource", checkoutResource);
-		assertNotNull("check error code exists in response after checkIn resource", checkoutResource.getErrorCode());
-		assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
+        // CheckIn Resource
+        logger.debug("Changing resource life cycle ");
+        RestResponse checkinResource = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                resourceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT); // NOT_CERTIFIED_CHECKIN
+        assertNotNull("check response object is not null after checkout resource", checkoutResource);
+        assertNotNull("check error code exists in response after checkIn resource", checkoutResource.getErrorCode());
+        assertEquals("Check response code after checkin resource", 200, checkoutResource.getErrorCode().intValue());
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails, uniqueID);
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(resourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails, uniqueID);
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(resourceDetails, getRestResponse);
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceCategorySuccessfully() throws Exception {
+    @Test
+    public void UpdateResourceCategorySuccessfully() throws Exception {
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after update resource", 201, restResponse.getErrorCode().intValue());
-		Resource resourceBeforeUpdate = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after update resource", 201, restResponse.getErrorCode().intValue());
+        Resource resourceBeforeUpdate = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		// Update resource Category Successfully
-		ResourceReqDetails updatedResourceDetails = resourceDetails;
+        // Update resource Category Successfully
+        ResourceReqDetails updatedResourceDetails = resourceDetails;
 
-		updatedResourceDetails.removeAllCategories();
-		updatedResourceDetails.addCategoryChain(ResourceCategoryEnum.APPLICATION_L4_DATABASE.getCategory(),
-				ResourceCategoryEnum.APPLICATION_L4_DATABASE.getSubCategory());
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncModifierDetails, resourceDetails.getUniqueId(), "");
+        updatedResourceDetails.removeAllCategories();
+        updatedResourceDetails.addCategoryChain(ResourceCategoryEnum.APPLICATION_L4_DATABASE.getCategory(),
+                ResourceCategoryEnum.APPLICATION_L4_DATABASE.getSubCategory());
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncModifierDetails, resourceDetails.getUniqueId(), "");
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
-		// parseResponseAndValidateNonUpdatable(updatedResourceDetails,
-		// updatedRestResponse);
-		parseResponseAndValidate(updatedResourceDetails, updatedRestResponse);
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, updatedRestResponse.getErrorCode().intValue());
+        // parseResponseAndValidateNonUpdatable(updatedResourceDetails,
+        // updatedRestResponse);
+        parseResponseAndValidate(updatedResourceDetails, updatedRestResponse);
 
-		// validate category updated
-		assertTrue(updatedResourceDetails.getCategories().get(0).getName()
-				.equals(ResourceCategoryEnum.APPLICATION_L4_DATABASE.getCategory()));
+        // validate category updated
+        assertTrue(updatedResourceDetails.getCategories().get(0).getName()
+                .equals(ResourceCategoryEnum.APPLICATION_L4_DATABASE.getCategory()));
 
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
-				resourceDetails.getUniqueId());
-		assertNotNull("check response object is not null after update resource", getRestResponse);
-		parseResponseAndValidate(updatedResourceDetails, getRestResponse);
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+                resourceDetails.getUniqueId());
+        assertNotNull("check response object is not null after update resource", getRestResponse);
+        parseResponseAndValidate(updatedResourceDetails, getRestResponse);
 
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, updatedResourceDetails.getName(), "0.1");
-	}
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncModifierDetails, updatedResourceDetails.getName(), "0.1");
+    }
 
-	// Benny
+    // Benny
 
-	@Test
-	public void Validation_UpdateIcon() throws Exception {
-		// Fields to update (Forbidden)
-		String _updatedIcon = "mySecondIcon.Jpg";
+    @Test
+    public void Validation_UpdateIcon() throws Exception {
+        // Fields to update (Forbidden)
+        String _updatedIcon = "mySecondIcon.Jpg";
 
-		// administrator permissions
-		User sdncAdminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        // administrator permissions
+        User sdncAdminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
 
-		// define and create resource
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails, resourceDetails.getName(), "0.1");
+        // define and create resource
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails, resourceDetails.getName(), "0.1");
 
-		RestResponse restResponse = createResource(sdncAdminModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		String resourceName = resourceDetails.getName();
+        RestResponse restResponse = createResource(sdncAdminModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        String resourceName = resourceDetails.getName();
 
-		// update metadata details
-		ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
-		// change icon of metadata
-		updatedResourceDetails.setIcon(_updatedIcon);
-		// PUT request
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
-				sdncAdminModifierDetails, resourceDetails.getUniqueId(), "");
+        // update metadata details
+        ResourceReqDetails updatedResourceDetails = defineUpdatedResourse(resourceName);
+        // change icon of metadata
+        updatedResourceDetails.setIcon(_updatedIcon);
+        // PUT request
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails,
+                sdncAdminModifierDetails, resourceDetails.getUniqueId(), "");
 
-		// validate response
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_ICON.name(),
-				Arrays.asList("Resource"), updatedRestResponse.getResponse());
+        // validate response
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INVALID_ICON.name(),
+                Arrays.asList("Resource"), updatedRestResponse.getResponse());
 
-		// empty icon
-		_updatedIcon = "";
-		updatedResourceDetails.setIcon(_updatedIcon);
-		updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncAdminModifierDetails,
-				resourceDetails.getUniqueId(), "");
-		assertNotNull("check response object is not null after update resource", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_ICON.name(),
-				Arrays.asList("Resource"), updatedRestResponse.getResponse());
+        // empty icon
+        _updatedIcon = "";
+        updatedResourceDetails.setIcon(_updatedIcon);
+        updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncAdminModifierDetails,
+                resourceDetails.getUniqueId(), "");
+        assertNotNull("check response object is not null after update resource", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_MISSING_ICON.name(),
+                Arrays.asList("Resource"), updatedRestResponse.getResponse());
 
-		// get resource with original name. original metadata should be returned
-		RestResponse getRestResponse = ResourceRestUtils.getResource(sdncAdminModifierDetails,
-				resourceDetails.getUniqueId());
-		// validate response
-		assertNotNull("check response object is not null after get resource", getRestResponse);
-		assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
+        // get resource with original name. original metadata should be returned
+        RestResponse getRestResponse = ResourceRestUtils.getResource(sdncAdminModifierDetails,
+                resourceDetails.getUniqueId());
+        // validate response
+        assertNotNull("check response object is not null after get resource", getRestResponse);
+        assertNotNull("check error code exists in response after get resource", getRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", 200, getRestResponse.getErrorCode().intValue());
 
-		// parse updated response to javaObject
-		Resource getResourceRespJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(getRestResponse.getResponse());
-		// validate that metadata was not changed
-		ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
+        // parse updated response to javaObject
+        Resource getResourceRespJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(getRestResponse.getResponse());
+        // validate that metadata was not changed
+        ResourceValidationUtils.validateResourceReqVsResp(resourceDetails, getResourceRespJavaObject);
 
-		ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails, updatedResourceDetails.getName(),
-				"0.1");
+        ResourceRestUtils.deleteResourceByNameAndVersion(sdncAdminModifierDetails, updatedResourceDetails.getName(),
+                "0.1");
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeSuccess() throws Exception {
-		// LCS is CheckOut
-		String newResourceType = ResourceTypeEnum.VL.toString();
-		String currentResourceType = resourceDetails.getResourceType();
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+    @Test
+    public void UpdateResourceTypeSuccess() throws Exception {
+        // LCS is CheckOut
+        String newResourceType = ResourceTypeEnum.VL.toString();
+        String currentResourceType = resourceDetails.getResourceType();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		resourceDetails.setResourceType(newResourceType);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
-		assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
-		Resource updatedResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
-		// assertTrue("Check resource type after update resource",
-		// updatedResourceJavaObject.getResourceType().toString().equals(resourceType));
-		assertTrue("Check resource type after update resource",
-				updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
+        resourceDetails.setResourceType(newResourceType);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
+        Resource updatedResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
+        // assertTrue("Check resource type after update resource",
+        // updatedResourceJavaObject.getResourceType().toString().equals(resourceType));
+        assertTrue("Check resource type after update resource",
+                updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeAndNameSuccess() throws Exception {
-		// LCS is CheckOut
-		String newResourceType = ResourceTypeEnum.VL.toString();
-		String currentResourceType = resourceDetails.getResourceType();
-		String newResourceName = "new Name";
+    @Test
+    public void UpdateResourceTypeAndNameSuccess() throws Exception {
+        // LCS is CheckOut
+        String newResourceType = ResourceTypeEnum.VL.toString();
+        String currentResourceType = resourceDetails.getResourceType();
+        String newResourceName = "new Name";
 
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		resourceDetails.setResourceType(newResourceType);
-		resourceDetails.setName(newResourceName);
-		List<String> tags = resourceDetails.getTags();
-		tags.add(newResourceName);
-		resourceDetails.setTags(tags);
+        resourceDetails.setResourceType(newResourceType);
+        resourceDetails.setName(newResourceName);
+        List<String> tags = resourceDetails.getTags();
+        tags.add(newResourceName);
+        resourceDetails.setTags(tags);
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
-		assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
-		Resource updatedResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
-		assertTrue("Check resource type after update resource",
-				updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
-		assertTrue("Check resource name after update resource",
-				updatedResourceJavaObject.getName().equals(newResourceName));
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
+        Resource updatedResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
+        assertTrue("Check resource type after update resource",
+                updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
+        assertTrue("Check resource name after update resource",
+                updatedResourceJavaObject.getName().equals(newResourceName));
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeAfterResourceCertification() throws Exception {
+    @Test
+    public void UpdateResourceTypeAfterResourceCertification() throws Exception {
 
-		String newResourceType = ResourceTypeEnum.VF.toString();
-		String currentResourceType = resourceDetails.getResourceType();
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+        String newResourceType = ResourceTypeEnum.VF.toString();
+        String currentResourceType = resourceDetails.getResourceType();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		resourceDetails.setResourceType(newResourceType);
-		restResponse = LifecycleRestUtils.certifyResource(resourceDetails);
-		assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
-		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
-		currentResourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
+        resourceDetails.setResourceType(newResourceType);
+        restResponse = LifecycleRestUtils.certifyResource(resourceDetails);
+        assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
+        restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
+        currentResourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
-		assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
-		Resource updatedResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
-		// assertTrue("Check resource type after update resource",
-		// updatedResourceJavaObject.getResourceType().toString().equals(newResourceType));
-		assertTrue("Check resource type after update resource",
-				updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        assertEquals("Check response code after create resource", 200, updatedRestResponse.getErrorCode().intValue());
+        Resource updatedResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(updatedRestResponse.getResponse());
+        // assertTrue("Check resource type after update resource",
+        // updatedResourceJavaObject.getResourceType().toString().equals(newResourceType));
+        assertTrue("Check resource type after update resource",
+                updatedResourceJavaObject.getResourceType().toString().equals(currentResourceType));
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeCheckInLCS() throws Exception {
+    @Test
+    public void UpdateResourceTypeCheckInLCS() throws Exception {
 
-		String resourceType = ResourceTypeEnum.VL.toString();
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+        String resourceType = ResourceTypeEnum.VL.toString();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		resourceDetails.setResourceType(resourceType);
-		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
+        resourceDetails.setResourceType(resourceType);
+        restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
 
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
 
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
 
-		assertNotNull("check response object is not null after create resouce", updatedRestResponse);
-		assertNotNull("check error code exists in response after create resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after create resource", errorInfo.getCode(),
-				updatedRestResponse.getErrorCode());
+        assertNotNull("check response object is not null after create resouce", updatedRestResponse);
+        assertNotNull("check error code exists in response after create resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after create resource", errorInfo.getCode(),
+                updatedRestResponse.getErrorCode());
 
-		List<String> variables = new ArrayList<>();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
-				updatedRestResponse.getResponse());
+        List<String> variables = new ArrayList<>();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeCertifiedLCS() throws Exception {
+    @Test
+    public void UpdateResourceTypeCertifiedLCS() throws Exception {
 
-		String resourceType = ResourceTypeEnum.VL.toString();
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+        String resourceType = ResourceTypeEnum.VL.toString();
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		restResponse = LifecycleRestUtils.certifyResource(resourceDetails);
-		assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
+        restResponse = LifecycleRestUtils.certifyResource(resourceDetails);
+        assertEquals("Check response code after resource CheckIn", 200, restResponse.getErrorCode().intValue());
 
-		resourceDetails.setResourceType(resourceType);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        resourceDetails.setResourceType(resourceType);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
 
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
 
-		assertNotNull("check response object is not null after create resouce", updatedRestResponse);
-		assertNotNull("check error code exists in response after create resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after create resource", errorInfo.getCode(),
-				updatedRestResponse.getErrorCode());
+        assertNotNull("check response object is not null after create resouce", updatedRestResponse);
+        assertNotNull("check error code exists in response after create resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after create resource", errorInfo.getCode(),
+                updatedRestResponse.getErrorCode());
 
-		List<String> variables = new ArrayList<>();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
-				updatedRestResponse.getResponse());
+        List<String> variables = new ArrayList<>();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 
-	@Test
-	public void UpdateResourceTypeInvalidType() throws Exception {
+    @Test
+    public void UpdateResourceTypeInvalidType() throws Exception {
 
-		String resourceType = "INVALID TYPE";
-		RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
-		assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
-		Resource currentResourceJavaObject = ResponseParser
-				.convertResourceResponseToJavaObject(restResponse.getResponse());
+        String resourceType = "INVALID TYPE";
+        RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
+        assertEquals("Check response code after create resource", 201, restResponse.getErrorCode().intValue());
+        Resource currentResourceJavaObject = ResponseParser
+                .convertResourceResponseToJavaObject(restResponse.getResponse());
 
-		resourceDetails.setResourceType(resourceType);
-		RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
-				sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
+        resourceDetails.setResourceType(resourceType);
+        RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(resourceDetails,
+                sdncModifierDetails, currentResourceJavaObject.getUniqueId(), "");
 
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
 
-		assertNotNull("check response object is not null after update resouce", updatedRestResponse);
-		assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
-		assertEquals("Check response code after update resource", errorInfo.getCode(),
-				updatedRestResponse.getErrorCode());
+        assertNotNull("check response object is not null after update resouce", updatedRestResponse);
+        assertNotNull("check error code exists in response after update resource", updatedRestResponse.getErrorCode());
+        assertEquals("Check response code after update resource", errorInfo.getCode(),
+                updatedRestResponse.getErrorCode());
 
-		List<String> variables = new ArrayList<>();
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), variables,
-				updatedRestResponse.getResponse());
+        List<String> variables = new ArrayList<>();
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), variables,
+                updatedRestResponse.getResponse());
 
-	}
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
index 895390f..82a894f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
@@ -20,14 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
+import com.google.gson.Gson;
+import fj.data.Either;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -49,19 +43,18 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 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.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.*;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class VFResourceInstanceNameCRUD extends ComponentBaseTest {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
index 37e7539..c731b59 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
@@ -20,11 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
+import fj.data.Either;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
@@ -36,12 +32,7 @@
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.AssocType;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -51,7 +42,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import fj.data.Either;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class ValidateExtendedVfData extends ComponentBaseTest {
 
@@ -217,7 +211,7 @@
 		callAllCheckMethods(resource);
 	}
 
-	@Test
+	/*@Test
 	public void lifeCycleRequestForCertification() throws Exception {
 
 		RestResponse response = LifecycleRestUtils.changeComponentState(resourceDetailsVF, sdncUserDetails,
@@ -232,7 +226,7 @@
 
 		Resource resource = ResponseParser.convertResourceResponseToJavaObject(response.getResponse());
 		callAllCheckMethods(resource);
-	}
+	}*/
 
 	@Test
 	public void lifeCycleCertificationRequest() throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java
index dddab57..e966b4a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java
@@ -20,56 +20,31 @@
 
 package org.openecomp.sdc.ci.tests.execute.resource;
 
-import static org.junit.Assert.assertTrue;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_DELETE;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_NOT_FOUND;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.RelationshipImpl;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.validation.BaseValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.*;
+
 public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest {
 
 	@Rule
@@ -1728,7 +1703,7 @@
 
 	}
 
-	@Test
+	/*@Test
 	public void testUnsatisfiedCpReqInVF() throws Exception {
 
 		// Certify all the needed atomic resources
@@ -1766,7 +1741,7 @@
 		submitForTesting = LifecycleRestUtils.changeResourceState(resourceDetailsVF_02, sdncDesignerDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		BaseValidationUtils.checkSuccess(submitForTesting);
-	}
+	}*/
 
 	private void getVfResourceReqCapUsingAPI(int numberOfRIs, int numberOfRelations, User user)
 			throws IOException, Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
index c8a20cf..5bb01d5 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
@@ -20,23 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.DistributionStatusEnum;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-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.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -59,6 +47,12 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.AssertJUnit.*;
+
 public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest {
 
 	protected ResourceReqDetails resourceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
index 56cfeb5..0716246 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
@@ -20,14 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.json.JSONObject;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -56,12 +49,7 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 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.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils;
@@ -69,7 +57,13 @@
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 
 public class CreateServiceMetadataApiTest extends ComponentBaseTest {
 	private static Logger logger = LoggerFactory.getLogger(CreateServiceMetadataApiTest.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
index 760d002..a0091f9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
@@ -20,14 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -54,6 +46,14 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class GetAllServiceVersions extends ComponentBaseTest {
 	protected ResourceReqDetails resourceDetails;
 	protected ServiceReqDetails serviceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
index 0417d56..544a7b1 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
@@ -20,14 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import fj.data.Either;
 import org.apache.http.HttpStatus;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -50,23 +45,21 @@
 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.general.FileUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.common.api.Constants;
-import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
 import org.openecomp.sdc.common.datastructure.Wrapper;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class GetComponentAuditApiTest extends ComponentBaseTest {
 
@@ -140,7 +133,7 @@
 		List<String> actions = new ArrayList<>();
 		JsonArray jsonArray = element.getAsJsonArray();
 		for( int i =0 ; i < jsonArray.size(); i++){
-			actions.add(jsonArray.get(i).getAsJsonObject().get(AuditingFieldsKeysEnum.AUDIT_ACTION.getDisplayName()).getAsString());
+			actions.add(jsonArray.get(i).getAsJsonObject().get(AuditingFieldsKey.AUDIT_ACTION.getDisplayName()).getAsString());
 		}
 		long checkinCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.CHECKIN_RESOURCE.getName())).count();
 		assertTrue(checkinCount == 5);
@@ -161,13 +154,13 @@
 	}
 
 	protected void certifyResource(ResourceReqDetails defaultResource) throws IOException {
-		RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
+/*		RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
 		response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser,
 				LifeCycleStatesEnum.STARTCERTIFICATION);
-		AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
-		response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser, LifeCycleStatesEnum.CERTIFY);
+		AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);*/
+		RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser, LifeCycleStatesEnum.CERTIFY);
 		AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
 	}
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
index 19bed4d..fc99946 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
@@ -20,13 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -39,646 +35,638 @@
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class GetServiceLatestVersionTest extends ComponentInstanceBaseTest {
 
-	protected ArtifactReqDetails heatArtifactDetails;
+    protected ArtifactReqDetails heatArtifactDetails;
 
-	@Rule
-	public static TestName name = new TestName();
+    @Rule
+    public static TestName name = new TestName();
 
-	public GetServiceLatestVersionTest() {
-		super(name, GetServiceLatestVersionTest.class.getName());
-	}
+    public GetServiceLatestVersionTest() {
+        super(name, GetServiceLatestVersionTest.class.getName());
+    }
 
-	@BeforeMethod
-	public void before() throws Exception {
-		initMembers();
-		createAtomicResource(resourceDetailsVFC_01);
-		changeResourceStateToCertified(resourceDetailsVFC_01);
-		createAtomicResource(resourceDetailsCP_01);
-		changeResourceStateToCertified(resourceDetailsCP_01);
-		createAtomicResource(resourceDetailsVL_01);
-		changeResourceStateToCertified(resourceDetailsVL_01);
-		createVF(resourceDetailsVF_01);
-		certifyVf(resourceDetailsVF_01);
-		createService(serviceDetails_01);
-		createService(serviceDetails_02);
-		createService(serviceDetails_03);
-		createProduct(productDetails_01);
-		createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails); // create
-																									// certified
-																									// VF
-																									// instance
-																									// in
-																									// service
-		/*
-		 * RestResponse restResponse =
+    @BeforeMethod
+    public void before() throws Exception {
+        initMembers();
+        createAtomicResource(resourceDetailsVFC_01);
+        changeResourceStateToCertified(resourceDetailsVFC_01);
+        createAtomicResource(resourceDetailsCP_01);
+        changeResourceStateToCertified(resourceDetailsCP_01);
+        createAtomicResource(resourceDetailsVL_01);
+        changeResourceStateToCertified(resourceDetailsVL_01);
+        createVF(resourceDetailsVF_01);
+        certifyVf(resourceDetailsVF_01);
+        createService(serviceDetails_01);
+        createService(serviceDetails_02);
+        createService(serviceDetails_03);
+        createProduct(productDetails_01);
+        createVFInstanceDuringSetup(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails); // create
+        // certified
+        // VF
+        // instance
+        // in
+        // service
+        /*
+         * RestResponse restResponse =
 		 * LifecycleRestUtils.changeServiceState(serviceDetails_01,
 		 * sdncDesignerDetails, LifeCycleStates.CHECKIN);
 		 * ResourceRestUtils.checkSuccess(restResponse);
 		 */
-	}
+    }
 
-	public void initMembers() throws Exception {
-		heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
-		sdncPsDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1);
-		sdncPmDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
-		sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
-		sdncTesterDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-		resourceDetailsVFC_01 = ElementFactory.getDefaultResourceByType("VFC100", NormativeTypesEnum.COMPUTE,
-				ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
-				ResourceTypeEnum.VFC.toString()); // resourceType = VFC
-		resourceDetailsVF_01 = ElementFactory.getDefaultResourceByType("VF100", NormativeTypesEnum.ROOT,
-				ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
-				ResourceTypeEnum.VF.toString());
-		resourceDetailsCP_01 = ElementFactory.getDefaultResourceByType("CP100", NormativeTypesEnum.PORT,
-				ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
-				ResourceTypeEnum.CP.toString());
-		resourceDetailsVL_01 = ElementFactory.getDefaultResourceByType("VL100", NormativeTypesEnum.NETWORK,
-				ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
-				ResourceTypeEnum.VL.toString());
-		serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
-		serviceDetails_02 = ElementFactory.getDefaultService("newtestservice2", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
-		serviceDetails_03 = ElementFactory.getDefaultService("newtestservice3", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
-		productDetails_01 = ElementFactory.getDefaultProduct("product01");
-	}
+    public void initMembers() throws Exception {
+        heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+        sdncPsDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1);
+        sdncPmDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
+        sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+        sdncTesterDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
+        resourceDetailsVFC_01 = ElementFactory.getDefaultResourceByType("VFC100", NormativeTypesEnum.COMPUTE,
+                ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
+                ResourceTypeEnum.VFC.toString()); // resourceType = VFC
+        resourceDetailsVF_01 = ElementFactory.getDefaultResourceByType("VF100", NormativeTypesEnum.ROOT,
+                ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
+                ResourceTypeEnum.VF.toString());
+        resourceDetailsCP_01 = ElementFactory.getDefaultResourceByType("CP100", NormativeTypesEnum.PORT,
+                ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
+                ResourceTypeEnum.CP.toString());
+        resourceDetailsVL_01 = ElementFactory.getDefaultResourceByType("VL100", NormativeTypesEnum.NETWORK,
+                ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
+                ResourceTypeEnum.VL.toString());
+        serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY,
+				sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+        serviceDetails_02 = ElementFactory.getDefaultService("newtestservice2", ServiceCategoriesEnum.MOBILITY,
+				sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+        serviceDetails_03 = ElementFactory.getDefaultService("newtestservice3", ServiceCategoriesEnum.MOBILITY,
+				sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+        productDetails_01 = ElementFactory.getDefaultProduct("product01");
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceInCheckOutState() throws Exception {
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPsDetails1);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertNull("No Service returned, one service in checkout state 0.1", servcieFromList);
-	}
+    @Test
+    public void getServicesLatestVersionServiceInCheckOutState() throws Exception {
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPsDetails1);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertNull("No Service returned, one service in checkout state 0.1", servcieFromList);
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceInCheckInState() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPsDetails1);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-	}
+    @Test
+    public void getServicesLatestVersionServiceInCheckInState() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPsDetails1);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+    }
 
-	@Test
-	public void getServicesLatestVersionByPm() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPmDetails1);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-	}
+    @Test
+    public void getServicesLatestVersionByPm() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncPmDetails1);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+    }
 
-	@Test
-	public void getServicesLatestVersionByAdmin() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncAdminDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-	}
+    @Test
+    public void getServicesLatestVersionByAdmin() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncAdminDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+    }
 
-	@Test
-	public void getServicesLatestVersionService02CheckOutState() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		String serviceUniqueID = ResponseParser.getUniqueIdFromResponse(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueID);
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-		servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertNull(servcieFromList);
-	}
+    @Test
+    public void getServicesLatestVersionService02CheckOutState() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        String serviceUniqueID = ResponseParser.getUniqueIdFromResponse(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueID);
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+        servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertNull(servcieFromList);
+    }
 
-	@Test
-	public void getServicesLatestVersionService02CheckInState() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.2"));
-	}
+    @Test
+    public void getServicesLatestVersionService02CheckInState() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.2"));
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceWaitingForCertification() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.2"));
-	}
+    @Test
+    public void getServicesLatestVersionServiceWaitingForCertification() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.2"));
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceCertificationInProgress() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.2"));
-	}
+    @Test
+    public void getServicesLatestVersionServiceCertificationInProgress() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.2"));
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceCertificationFail() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.FAILCERTIFICATION);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.2"));
-	}
+    @Test
+    public void getServicesLatestVersionServiceCertificationFail() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ResourceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.FAILCERTIFICATION);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.2"));
+    }
 
-	@Test
-	public void getServicesLatestVersionServiceCertifed() throws Exception {
-		certifyService(serviceDetails_01);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("1.0"));
-	}
+    @Test
+    public void getServicesLatestVersionServiceCertifed() throws Exception {
+        certifyService(serviceDetails_01);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("1.0"));
+    }
 
-	@Test
-	public void getLatestVersionServiceHasSeveralCertifedVersion_01() throws Exception {
-		RestResponse certifyServiceResponse;
-		String serviceUniqueIdFromResponse = null;
-		int numberOfCertifiedService = 3;
-		for (int i = 0; i < numberOfCertifiedService; i++) {
-			certifyServiceResponse = certifyService(serviceDetails_01);
-			ServiceRestUtils.checkSuccess(certifyServiceResponse);
-			if (i == (numberOfCertifiedService - 1)) {
-				serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(certifyServiceResponse);
-			}
-			RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKOUT);
-			ServiceRestUtils.checkSuccess(restResponse);
-		}
-		// We have service with following versions : 1.0, 2.0 ,3.0 and
-		// 3.1(checkedOut)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
-		assertTrue(servcieFromList.getVersion().equals("3.0"));
-	}
+    @Test
+    public void getLatestVersionServiceHasSeveralCertifedVersion_01() throws Exception {
+        RestResponse certifyServiceResponse;
+        String serviceUniqueIdFromResponse = null;
+        int numberOfCertifiedService = 3;
+        for (int i = 0; i < numberOfCertifiedService; i++) {
+            certifyServiceResponse = certifyService(serviceDetails_01);
+            ServiceRestUtils.checkSuccess(certifyServiceResponse);
+            if (i == (numberOfCertifiedService - 1)) {
+                serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(certifyServiceResponse);
+            }
+            RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKOUT);
+            ServiceRestUtils.checkSuccess(restResponse);
+        }
+        // We have service with following versions : 1.0, 2.0 ,3.0 and
+        // 3.1(checkedOut)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
+        assertTrue(servcieFromList.getVersion().equals("3.0"));
+    }
 
-	@Test
-	public void getLatestVersionServiceHasSeveralCertifedVersions02() throws Exception {
-		RestResponse certifyServiceResponse;
-		certifyServiceResponse = certifyService(serviceDetails_01);
-		ServiceRestUtils.checkSuccess(certifyServiceResponse);
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		certifyServiceResponse = certifyService(serviceDetails_01);
-		ServiceRestUtils.checkSuccess(certifyServiceResponse);
-		// We have service with following versions : 1.0, 2.0
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("2.0"));
-	}
+    @Test
+    public void getLatestVersionServiceHasSeveralCertifedVersions02() throws Exception {
+        RestResponse certifyServiceResponse;
+        certifyServiceResponse = certifyService(serviceDetails_01);
+        ServiceRestUtils.checkSuccess(certifyServiceResponse);
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        certifyServiceResponse = certifyService(serviceDetails_01);
+        ServiceRestUtils.checkSuccess(certifyServiceResponse);
+        // We have service with following versions : 1.0, 2.0
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("2.0"));
+    }
 
-	@Test
-	public void getLatestVersionServiceCertifedWasCheckedOutAndCheckedin() throws Exception {
-		RestResponse certifyServiceResponse;
-		int numberOfCertifiedService = 3;
-		for (int i = 0; i < numberOfCertifiedService; i++) {
-			certifyServiceResponse = certifyService(serviceDetails_01);
-			ServiceRestUtils.checkSuccess(certifyServiceResponse);
-			RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKOUT);
-			ServiceRestUtils.checkSuccess(restResponse);
-		}
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		// We have service with following versions : 1.0, 2.0 and 2.1(checkedIn)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("3.1"));
-	}
+    @Test
+    public void getLatestVersionServiceCertifedWasCheckedOutAndCheckedin() throws Exception {
+        RestResponse certifyServiceResponse;
+        int numberOfCertifiedService = 3;
+        for (int i = 0; i < numberOfCertifiedService; i++) {
+            certifyServiceResponse = certifyService(serviceDetails_01);
+            ServiceRestUtils.checkSuccess(certifyServiceResponse);
+            RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKOUT);
+            ServiceRestUtils.checkSuccess(restResponse);
+        }
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        // We have service with following versions : 1.0, 2.0 and 2.1(checkedIn)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("3.1"));
+    }
 
-	@Test
-	public void getLatestVersionServiceCheckOutCertifedService() throws Exception {
-		RestResponse restResponse;
-		String serviceUniqueIdFromResponse = null;
-		RestResponse certifyServiceResponse = certifyService(serviceDetails_01);
-		ServiceRestUtils.checkSuccess(certifyServiceResponse);
-		for (int i = 0; i < 11; i++) {
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKOUT);
-			ServiceRestUtils.checkSuccess(restResponse);
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKIN);
-			ServiceRestUtils.checkSuccess(restResponse);
-			if (i == (10)) {
-				serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
-			}
-		}
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		// We have service with following versions : 1.0 and 1.11(Check-out)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
-		assertTrue(servcieFromList.getVersion().equals("1.11"));
-	}
+    @Test
+    public void getLatestVersionServiceCheckOutCertifedService() throws Exception {
+        RestResponse restResponse;
+        String serviceUniqueIdFromResponse = null;
+        RestResponse certifyServiceResponse = certifyService(serviceDetails_01);
+        ServiceRestUtils.checkSuccess(certifyServiceResponse);
+        for (int i = 0; i < 11; i++) {
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKOUT);
+            ServiceRestUtils.checkSuccess(restResponse);
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKIN);
+            ServiceRestUtils.checkSuccess(restResponse);
+            if (i == (10)) {
+                serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
+            }
+        }
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        // We have service with following versions : 1.0 and 1.11(Check-out)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
+        assertTrue(servcieFromList.getVersion().equals("1.11"));
+    }
 
-	@Test
-	public void getLatestVersionServiceCheckOutCheckInCertifedService() throws Exception {
-		RestResponse restResponse;
-		String serviceUniqueIdFromResponse = null;
-		RestResponse certifyServiceResponse = certifyService(serviceDetails_01);
-		ServiceRestUtils.checkSuccess(certifyServiceResponse);
-		for (int i = 0; i < 12; i++) {
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKOUT);
-			ServiceRestUtils.checkSuccess(restResponse);
-			restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-					LifeCycleStatesEnum.CHECKIN);
-			ServiceRestUtils.checkSuccess(restResponse);
-			if (i == (11)) {
-				serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
-			}
-		}
-		// We have service with following versions : 1.0 and 1.11(Check-out)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
-		assertTrue(servcieFromList.getVersion().equals("1.12"));
-	}
+    @Test
+    public void getLatestVersionServiceCheckOutCheckInCertifedService() throws Exception {
+        RestResponse restResponse;
+        String serviceUniqueIdFromResponse = null;
+        RestResponse certifyServiceResponse = certifyService(serviceDetails_01);
+        ServiceRestUtils.checkSuccess(certifyServiceResponse);
+        for (int i = 0; i < 12; i++) {
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKOUT);
+            ServiceRestUtils.checkSuccess(restResponse);
+            restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                    LifeCycleStatesEnum.CHECKIN);
+            ServiceRestUtils.checkSuccess(restResponse);
+            if (i == (11)) {
+                serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
+            }
+        }
+        // We have service with following versions : 1.0 and 1.11(Check-out)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceUniqueIdFromResponse);
+        assertTrue(servcieFromList.getVersion().equals("1.12"));
+    }
 
-	@Test
-	public void getLatestVersionServiceCertifedCheckedOutAndInWaitingForCertificationState() throws Exception {
-		certifyService(serviceDetails_01); // 1.0
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ServiceRestUtils.checkSuccess(restResponse);
-		// We have service with following versions : 1.0 and 1.1(Waiting For
-		// Certification)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("1.1"));
-	}
+    @Test
+    public void getLatestVersionServiceCertifedCheckedOutAndInWaitingForCertificationState() throws Exception {
+        certifyService(serviceDetails_01); // 1.0
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ServiceRestUtils.checkSuccess(restResponse);
+        // We have service with following versions : 1.0 and 1.1(Waiting For
+        // Certification)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("1.1"));
+    }
 
-	@Test
-	public void getLatestVersionServiceCertifedCheckedOutAndInCertificationInProgressState() throws Exception {
-		certifyService(serviceDetails_01); // 1.0
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ServiceRestUtils.checkSuccess(restResponse);
-		// We have service with following versions : 1.0 and 1.1(Certification
-		// In Progress)
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("1.1"));
-	}
+    @Test
+    public void getLatestVersionServiceCertifedCheckedOutAndInCertificationInProgressState() throws Exception {
+        certifyService(serviceDetails_01); // 1.0
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ServiceRestUtils.checkSuccess(restResponse);
+        // We have service with following versions : 1.0 and 1.1(Certification
+        // In Progress)
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("1.1"));
+    }
 
-	// DE190818
-	@Test(enabled = false)
-	public void getLatestVersionByNonAsdcUser() throws Exception {
-		User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		nonAsdcUser.setUserId("gg750g");
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(nonAsdcUser);
-		assertTrue(getServicesLatestVersion.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				getServicesLatestVersion.getResponse());
-	}
+    // DE190818
+    @Test(enabled = false)
+    public void getLatestVersionByNonAsdcUser() throws Exception {
+        User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        nonAsdcUser.setUserId("gg750g");
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(nonAsdcUser);
+        assertTrue(getServicesLatestVersion.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                getServicesLatestVersion.getResponse());
+    }
 
-	// DE190818
-	@Test(enabled = false)
-	public void getLatestVersionUserIdIsEmpty() throws Exception {
-		User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		nonAsdcUser.setUserId("");
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(nonAsdcUser);
-		assertTrue(getServicesLatestVersion.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
-				getServicesLatestVersion.getResponse());
-	}
+    // DE190818
+    @Test(enabled = false)
+    public void getLatestVersionUserIdIsEmpty() throws Exception {
+        User nonAsdcUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        nonAsdcUser.setUserId("");
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(nonAsdcUser);
+        assertTrue(getServicesLatestVersion.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
+        ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
+                getServicesLatestVersion.getResponse());
+    }
 
-	@Test
-	public void getServicesLatestVersionByTester() throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncTesterDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 1);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-	}
+    @Test
+    public void getServicesLatestVersionByTester() throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncTesterDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 1);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_01.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+    }
 
-	@Test
-	public void getLatestVersionSeveralServicesInDifferentVersion() throws Exception {
-		RestResponse restResponse = certifyService(serviceDetails_01); // 1.0
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = certifyService(serviceDetails_01);
-		ServiceRestUtils.checkSuccess(restResponse);
-		String service1_UniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_01
-														// version is 2.1
-														// (check-out)
+    @Test
+    public void getLatestVersionSeveralServicesInDifferentVersion() throws Exception {
+        RestResponse restResponse = certifyService(serviceDetails_01); // 1.0
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = certifyService(serviceDetails_01);
+        ServiceRestUtils.checkSuccess(restResponse);
+        String service1_UniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_01
+        // version is 2.1
+        // (check-out)
 
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_02
-														// version 0.2
-														// (Check-in)
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_02
+        // version 0.2
+        // (Check-in)
 
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		String service3_UniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_03
-														// version 0.2
-														// (Check-out)
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        String service3_UniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse); // serviceDetails_03
+        // version 0.2
+        // (Check-out)
 
-		RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
-		ServiceRestUtils.checkSuccess(getServicesLatestVersion);
-		List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
-		assertTrue(serviceList.size() == 3);
-		Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, service1_UniqueIdFromResponse);
-		assertTrue(servcieFromList.getVersion().equals("2.0"));
-		servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_02.getUniqueId());
-		assertTrue(servcieFromList.getVersion().equals("0.2"));
-		servcieFromList = getResourceObjectFromResourceListByUid(serviceList, service3_UniqueIdFromResponse);
-		assertTrue(servcieFromList.getVersion().equals("0.1"));
-	}
+        RestResponse getServicesLatestVersion = ServiceRestUtils.getServiceLatestVersionList(sdncDesignerDetails);
+        ServiceRestUtils.checkSuccess(getServicesLatestVersion);
+        List<Service> serviceList = restResponseToResourceObjectList(getServicesLatestVersion);
+        assertTrue(serviceList.size() == 3);
+        Service servcieFromList = getResourceObjectFromResourceListByUid(serviceList, service1_UniqueIdFromResponse);
+        assertTrue(servcieFromList.getVersion().equals("2.0"));
+        servcieFromList = getResourceObjectFromResourceListByUid(serviceList, serviceDetails_02.getUniqueId());
+        assertTrue(servcieFromList.getVersion().equals("0.2"));
+        servcieFromList = getResourceObjectFromResourceListByUid(serviceList, service3_UniqueIdFromResponse);
+        assertTrue(servcieFromList.getVersion().equals("0.1"));
+    }
 
-	///////////////////////////////////////////////////////////////
-	private RestResponse certifyService(ServiceReqDetails serviceDetails) throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKOUT);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
-				LifeCycleStatesEnum.STARTCERTIFICATION);
-		ServiceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
-				LifeCycleStatesEnum.CERTIFY);
-		ServiceRestUtils.checkSuccess(restResponse);
-		return restResponse;
-	}
+    ///////////////////////////////////////////////////////////////
+    private RestResponse certifyService(ServiceReqDetails serviceDetails) throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKOUT);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
+                LifeCycleStatesEnum.STARTCERTIFICATION);
+        ServiceRestUtils.checkSuccess(restResponse);
+        restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
+                LifeCycleStatesEnum.CERTIFY);
+        ServiceRestUtils.checkSuccess(restResponse);
+        return restResponse;
+    }
 
-	protected List<Service> restResponseToResourceObjectList(RestResponse restResponse) {
-		JsonElement jelement = new JsonParser().parse(restResponse.getResponse());
-		JsonArray jsonArray = jelement.getAsJsonArray();
-		List<Service> restResponseArray = new ArrayList<>();
-		Service service = null;
-		for (int i = 0; i < jsonArray.size(); i++) {
-			String serviceString = (String) jsonArray.get(i).toString();
-			service = ResponseParser.convertServiceResponseToJavaObject(serviceString);
-			restResponseArray.add(service);
-		}
-		return restResponseArray;
-	}
+    protected List<Service> restResponseToResourceObjectList(RestResponse restResponse) {
+        JsonElement jelement = new JsonParser().parse(restResponse.getResponse());
+        JsonArray jsonArray = jelement.getAsJsonArray();
+        List<Service> restResponseArray = new ArrayList<>();
+        Service service = null;
+        for (int i = 0; i < jsonArray.size(); i++) {
+            String serviceString = (String) jsonArray.get(i).toString();
+            service = ResponseParser.convertServiceResponseToJavaObject(serviceString);
+            restResponseArray.add(service);
+        }
+        return restResponseArray;
+    }
 
-	protected Service getResourceObjectFromResourceListByUid(List<Service> serviceList, String uid) {
-		if (serviceList != null && serviceList.size() > 0) {
-			for (Service service : serviceList) {
-				if (service.getUniqueId().equals(uid))
-					return service;
-			}
-		} else
-			return null;
-		return null;
-	}
+    protected Service getResourceObjectFromResourceListByUid(List<Service> serviceList, String uid) {
+        if (serviceList != null && serviceList.size() > 0) {
+            for (Service service : serviceList) {
+                if (service.getUniqueId().equals(uid))
+                    return service;
+            }
+        } else
+            return null;
+        return null;
+    }
 
-	private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
-		RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
-				LifeCycleStatesEnum.CHECKIN);
-		ResourceRestUtils.checkSuccess(restResponse);
-		restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
+    private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
+        RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
+                LifeCycleStatesEnum.CHECKIN);
+        ResourceRestUtils.checkSuccess(restResponse);
+		/*restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		if (restResponse.getErrorCode() == 200) {
 			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
 					LifeCycleStatesEnum.STARTCERTIFICATION);
 		} else
 			return restResponse;
-		if (restResponse.getErrorCode() == 200) {
-			restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
-					LifeCycleStatesEnum.CERTIFY);
-			if (restResponse.getErrorCode() == 200) {
-				String newVersion = ResponseParser.getVersionFromResponse(restResponse);
-				resourceDetails.setVersion(newVersion);
-				resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
-				resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
-				resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
-				String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
-						"uniqueId");
-				resourceDetails.setUniqueId(uniqueIdFromRresponse);
-			}
-		}
-		return restResponse;
-	}
+		if (restResponse.getErrorCode() == 200) {*/
+        restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
+        if (restResponse.getErrorCode() == 200) {
+            String newVersion = ResponseParser.getVersionFromResponse(restResponse);
+            resourceDetails.setVersion(newVersion);
+            resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
+            resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
+            resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
+            String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
+                    "uniqueId");
+            resourceDetails.setUniqueId(uniqueIdFromRresponse);
+        }
+        return restResponse;
+    }
 
-	// private void certifyVf(ResourceReqDetails resource) throws Exception {
-	// RestResponse createAtomicResourceInstance =
-	// createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_01,
-	// sdncDesignerDetails);
-	// ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-	// createAtomicResourceInstance =
-	// createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01,
-	// sdncDesignerDetails);
-	// ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-	// createAtomicResourceInstance =
-	// createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01,
-	// sdncDesignerDetails);
-	// ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-	// //createVFInstanceDuringSetup(service, resource, sdncDesignerDetails);
-	// RestResponse response =
-	// ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
-	// sdncDesignerDetails, resource.getUniqueId());
-	// ResourceRestUtils.checkSuccess(response);
-	// RestResponse changeResourceStateToCertified =
-	// changeResourceStateToCertified(resource);
-	// ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
-	// }
+    // private void certifyVf(ResourceReqDetails resource) throws Exception {
+    // RestResponse createAtomicResourceInstance =
+    // createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_01,
+    // sdncDesignerDetails);
+    // ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+    // createAtomicResourceInstance =
+    // createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01,
+    // sdncDesignerDetails);
+    // ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+    // createAtomicResourceInstance =
+    // createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01,
+    // sdncDesignerDetails);
+    // ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+    // //createVFInstanceDuringSetup(service, resource, sdncDesignerDetails);
+    // RestResponse response =
+    // ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
+    // sdncDesignerDetails, resource.getUniqueId());
+    // ResourceRestUtils.checkSuccess(response);
+    // RestResponse changeResourceStateToCertified =
+    // changeResourceStateToCertified(resource);
+    // ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
+    // }
 
-	private void certifyVf(ResourceReqDetails resource) throws Exception {
-		RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+    private void certifyVf(ResourceReqDetails resource) throws Exception {
+        RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_01,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String computeCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_01,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String computeCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01,
-				sdncDesignerDetails);
-		ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
-		String vlCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
+        createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01,
+                sdncDesignerDetails);
+        ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
+        String vlCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
 
-		// Fixing Vl/Cp req/cap
-		ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
-		User user = sdncDesignerDetails;
-		fulfillCpRequirement(resource, cpCompInstId, computeCompInstId, computeCompInstId, user, containerCompType);
-		consumeVlCapability(resource, cpCompInstId, vlCompInstId, cpCompInstId, user, containerCompType);
+        // Fixing Vl/Cp req/cap
+        ComponentTypeEnum containerCompType = ComponentTypeEnum.RESOURCE;
+        User user = sdncDesignerDetails;
+        fulfillCpRequirement(resource, cpCompInstId, computeCompInstId, computeCompInstId, user, containerCompType);
+        consumeVlCapability(resource, cpCompInstId, vlCompInstId, cpCompInstId, user, containerCompType);
 
-		RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
-				sdncDesignerDetails, resource.getUniqueId());
-		ResourceRestUtils.checkSuccess(response);
-		RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
-		ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
-	}
+        RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
+                sdncDesignerDetails, resource.getUniqueId());
+        ResourceRestUtils.checkSuccess(response);
+        RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
+        ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
+    }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java
index fdec834..6db27b9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java
@@ -20,10 +20,23 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
+import org.apache.http.client.ClientProtocolException;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.ImportUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.io.File;
 import java.io.IOException;
@@ -32,44 +45,8 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 
-import org.apache.http.client.ClientProtocolException;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.RelationshipImpl;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-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.ci.tests.api.ComponentInstanceBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.general.ImportUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.validation.ErrorValidationUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
+import static org.testng.AssertJUnit.*;
 
 public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest {
 
@@ -164,7 +141,7 @@
 		ResourceRestUtils.checkCreateResponse(createResourceVF200);
 		// Create Service
 		serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY,
-				sdncDesignerDetails.getUserId());
+				sdncDesignerDetails.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
 		RestResponse createServiceRestResponse = ServiceRestUtils.createService(serviceDetails_01, sdncDesignerDetails);
 		ResourceRestUtils.checkCreateResponse(createServiceRestResponse);
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
index b2728ea..60ca71d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
@@ -20,45 +20,20 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.codehaus.jettison.json.JSONException;
 import org.json.JSONArray;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.CapReqDef;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.*;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.slf4j.Logger;
@@ -67,6 +42,15 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
 public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest {
 	private static Logger log = LoggerFactory.getLogger(ServiceComponentInstanceCRUDTest.class.getName());
 	private static final String SPACE_STRING = " ";
@@ -115,9 +99,9 @@
 	}
 
 	private void certifyResource(ResourceReqDetails resource) throws Exception {
-		changeResourceLifecycleState(resource, sdncDesignerDetails.getUserId(),
+		/*changeResourceLifecycleState(resource, sdncDesignerDetails.getUserId(),
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-		changeResourceLifecycleState(resource, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.STARTCERTIFICATION);
+		changeResourceLifecycleState(resource, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.STARTCERTIFICATION);*/
 		changeResourceLifecycleState(resource, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.CERTIFY);
 	}
 
@@ -444,7 +428,7 @@
 		getComponentAndValidateRIs(serviceDetails_01, 2, 0);
 	}
 
-	@Test
+	/*@Test
 	public void createResourceInstance_ResourceInCertificationRequestStateTest() throws Exception {
 		changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(),
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
@@ -453,9 +437,9 @@
 
 		createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
 		getComponentAndValidateRIs(serviceDetails_01, 2, 0);
-	}
+	}*/
 
-	@Test
+	/*@Test
 	public void createResourceInstance_startCertificationStateTest() throws Exception {
 		changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(),
 				LifeCycleStatesEnum.CERTIFICATIONREQUEST);
@@ -471,7 +455,7 @@
 				sdncDesignerDetails);
 		getComponentAndValidateRIs(serviceDetails_01, 2, 0);
 
-	}
+	}*/
 
 	@Test
 	public void createResourceInstance_certifiedStateTest() throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
index 304f61d..18c2614 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.service;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jettison.json.JSONException;
 import org.junit.Rule;
@@ -59,6 +52,13 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+
 public class UpdateServiceMetadataTest extends ComponentBaseTest {
 
 	protected ArrayList<String> listForMessage = new ArrayList<String>();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
index 28cf1b7..df1e6b2 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
@@ -20,18 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.execute.user;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
 import org.apache.http.HttpStatus;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -54,11 +44,7 @@
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 import org.openecomp.sdc.ci.tests.utils.general.Convertor;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils;
-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.UserRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils;
@@ -69,12 +55,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.google.gson.reflect.TypeToken;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static org.testng.AssertJUnit.*;
 
 /**
  * @author alitvinsky
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
index 2f979f3..d509966 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.user;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.io.IOException;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -47,6 +42,11 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+
 public class CreateUserApiTest extends ComponentBaseTest {
 
 	protected User sdncAdminUser;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
index c7c2fdd..5a56af5 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
@@ -20,14 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.execute.user;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.junit.Rule;
@@ -50,17 +42,18 @@
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 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.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.List;
+
+import static org.testng.AssertJUnit.*;
+
 public class GovernorWorkspaceApiTest extends ComponentBaseTest {
 
 	private static Logger logger = LoggerFactory.getLogger(GovernorWorkspaceApiTest.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/ComplexResourceBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/ComplexResourceBaseTest.java
index 14c7a37..32f355d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/ComplexResourceBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/ComplexResourceBaseTest.java
@@ -20,12 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.preRequisites;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -42,14 +36,13 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-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.testng.annotations.BeforeMethod;
 
+import java.io.IOException;
+
+import static org.testng.AssertJUnit.*;
+
 public class ComplexResourceBaseTest extends ComponentBaseTest {
 
 	protected ServiceReqDetails serviceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java
index bde6852..a512206 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.preRequisites;
 
-import java.io.IOException;
-
 import org.apache.log4j.lf5.util.ResourceUtils;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -39,14 +37,12 @@
 import org.openecomp.sdc.ci.tests.utils.ArtifactUtils;
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-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.testng.AssertJUnit;
 import org.testng.annotations.BeforeMethod;
 
+import java.io.IOException;
+
 public class DownloadArtifactBaseTest extends ComponentBaseTest {
 
 	protected ResourceReqDetails downloadResourceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java
index add06a5..319109a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java
@@ -20,10 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.preRequisites;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-
 import org.apache.log4j.lf5.util.ResourceUtils;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.User;
@@ -42,6 +38,10 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
 import org.testng.annotations.BeforeMethod;
 
+import java.io.IOException;
+
+import static org.testng.AssertJUnit.assertTrue;
+
 public abstract class SimpleOneRsrcOneServiceTest extends ComponentBaseTest {
 
 	protected ResourceReqDetails resourceDetails;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
index a515502..c1a4e39 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
@@ -20,6 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.run;
 
+import org.apache.log4j.PropertyConfigurator;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.TestNG;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -34,13 +41,6 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.log4j.PropertyConfigurator;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.TestNG;
-
 public class StartTest {
 
 	// private List<Class<? extends AttSdcTest>> testClasses = new
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
index c9b1e13..bb53610 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
@@ -20,6 +20,17 @@
 
 package org.openecomp.sdc.ci.tests.run;
 
+import org.apache.log4j.PropertyConfigurator;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.openecomp.sdc.ci.tests.api.AttSdcTest;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -36,17 +47,6 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.log4j.PropertyConfigurator;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.openecomp.sdc.ci.tests.api.AttSdcTest;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 public class StartTest2backup {
 
 	private List<Class<? extends AttSdcTest>> testClasses = new ArrayList<Class<? extends AttSdcTest>>();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
index b676b29..f3d48bf 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
@@ -20,42 +20,26 @@
 
 package org.openecomp.sdc.ci.tests.sanity;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
+import fj.data.Either;
 import org.apache.commons.lang3.tuple.Pair;
 import org.junit.Rule;
 import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-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.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.AssocType;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.LifecycleRestUtils;
-import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
 
 public class CrudE2E extends ComponentBaseTest {
 	private static Logger log = LoggerFactory.getLogger(CrudE2E.class.getName());
@@ -196,10 +180,10 @@
 
 		//////// certify VF1 - failed due to uncertified CP instance ////////
 
-		RestResponse changeVfStateFailed = LifecycleRestUtils.changeComponentState(resourceDetailsVF_01, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+		/*RestResponse changeVfStateFailed = LifecycleRestUtils.changeComponentState(resourceDetailsVF_01, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		Resource resResourceDetailsVF_01 = (Resource) resourceDetailsVF_01;
 		variablesAsList = Arrays.asList(resResourceDetailsVF_01.getResourceType().toString(), resourceDetailsCP_01.getName());
-		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList, changeVfStateFailed.getResponse());
+		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList, changeVfStateFailed.getResponse());*/
 
 		//////// certify resources CP1 ////////
 		resourceDetailsCP_01 = AtomicOperationUtils.changeComponentState(resourceDetailsCP_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
@@ -226,10 +210,10 @@
 
 		//////// certify service1 - failed due to uncertified instances ////////
 		designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-		RestResponse changeServicetStateFailed = LifecycleRestUtils.changeComponentState(defaultService1, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+		/*RestResponse changeServicetStateFailed = LifecycleRestUtils.changeComponentState(defaultService1, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		variablesAsList = Arrays.asList(defaultService1.getComponentType().toString().toLowerCase(), resourceDetailsVF_01.getName());
 		ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList, changeServicetStateFailed.getResponse());
-
+*/
 		////// change VF1 state to CERTIFIED
 		resourceDetailsVF_01 = AtomicOperationUtils.changeComponentState(resourceDetailsVF_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
index 33cf6cb..e6e96cc 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.sanity;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -32,11 +27,7 @@
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.AssocType;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -44,6 +35,11 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
+
 public class MultipleResourceUpdate extends ComponentBaseTest {
 
 	@Rule
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 a64c377..99bfad6 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
@@ -21,9 +21,8 @@
 package org.openecomp.sdc.ci.tests.sanity;
 
 
-
-
-
+import com.aventstack.extentreports.Status;
+import fj.data.Either;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.model.ComponentInstance;
@@ -42,16 +41,7 @@
 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.general.OnboardingUtillViaApis;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
-
-import fj.data.Either;
+import org.testng.annotations.*;
 
 
 
@@ -108,9 +98,8 @@
 		ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
 		User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
      	ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
-		Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user);
-		VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
-		vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
+		VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user);
+//		vendorSoftwareProductObject.setName(vendorSoftwareProductObject.getName());
 
 		//		create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
 //		ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaAnnotationsTypesDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaAnnotationsTypesDefinition.java
new file mode 100644
index 0000000..da84077
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaAnnotationsTypesDefinition.java
@@ -0,0 +1,29 @@
+package org.openecomp.sdc.ci.tests.tosca.datatypes;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.ToscaKeysEnum;
+import org.yaml.snakeyaml.TypeDescription;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ToscaAnnotationsTypesDefinition extends ToscaTypesDefinition {
+
+    public static final String SOURCE_ANNOTATION = "org.openecomp.annotations.Source";
+
+    private Map<String, ToscaTypeDefinition> annotation_types = new HashMap<>();
+
+    public Map<String, ToscaTypeDefinition> getAnnotation_types() {
+        return annotation_types;
+    }
+
+    public void setAnnotation_types(Map<String, ToscaTypeDefinition> annotation_types) {
+        this.annotation_types = annotation_types;
+    }
+
+    public static TypeDescription getTypeDescription(){
+        TypeDescription typeDescription = new TypeDescription(ToscaAnnotationsTypesDefinition.class);
+        typeDescription.putListPropertyType(ToscaKeysEnum.IMPORTS.getToscaKey(), String.class);
+        typeDescription.putMapPropertyType(ToscaKeysEnum.ANNOTATION_TYPES.getToscaKey(), String.class, ToscaTypeDefinition.class);
+        return typeDescription;
+    }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
index 3a63237..5bbb71b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
@@ -20,13 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import org.yaml.snakeyaml.TypeDescription;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.yaml.snakeyaml.TypeDescription;
-
 public class ToscaDefinition {
 
 	String tosca_definitions_version;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupPropertyDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupPropertyDefinition.java
index 5340902..e6c2a4f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupPropertyDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupPropertyDefinition.java
@@ -109,4 +109,42 @@
         TypeDescription typeDescription = new TypeDescription(ToscaGroupPropertyDefinition.class);
         return typeDescription;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        ToscaGroupPropertyDefinition that = (ToscaGroupPropertyDefinition) o;
+
+        if (min_vf_module_instances != null ? !min_vf_module_instances.equals(that.min_vf_module_instances) : that.min_vf_module_instances != null)
+            return false;
+        if (max_vf_module_instances != null ? !max_vf_module_instances.equals(that.max_vf_module_instances) : that.max_vf_module_instances != null)
+            return false;
+        if (vf_module_label != null ? !vf_module_label.equals(that.vf_module_label) : that.vf_module_label != null)
+            return false;
+        if (vfc_list != null ? !vfc_list.equals(that.vfc_list) : that.vfc_list != null) return false;
+        if (vf_module_type != null ? !vf_module_type.equals(that.vf_module_type) : that.vf_module_type != null)
+            return false;
+        if (vf_module_description != null ? !vf_module_description.equals(that.vf_module_description) : that.vf_module_description != null)
+            return false;
+        if (initial_count != null ? !initial_count.equals(that.initial_count) : that.initial_count != null)
+            return false;
+        if (volume_group != null ? !volume_group.equals(that.volume_group) : that.volume_group != null) return false;
+        return availability_zone_count != null ? availability_zone_count.equals(that.availability_zone_count) : that.availability_zone_count == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = min_vf_module_instances != null ? min_vf_module_instances.hashCode() : 0;
+        result = 31 * result + (max_vf_module_instances != null ? max_vf_module_instances.hashCode() : 0);
+        result = 31 * result + (vf_module_label != null ? vf_module_label.hashCode() : 0);
+        result = 31 * result + (vfc_list != null ? vfc_list.hashCode() : 0);
+        result = 31 * result + (vf_module_type != null ? vf_module_type.hashCode() : 0);
+        result = 31 * result + (vf_module_description != null ? vf_module_description.hashCode() : 0);
+        result = 31 * result + (initial_count != null ? initial_count.hashCode() : 0);
+        result = 31 * result + (volume_group != null ? volume_group.hashCode() : 0);
+        result = 31 * result + (availability_zone_count != null ? availability_zone_count.hashCode() : 0);
+        return result;
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
index fd30691..a536578 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
@@ -20,36 +20,44 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import org.yaml.snakeyaml.TypeDescription;
+
+import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
-import org.yaml.snakeyaml.TypeDescription;
-
 //	spec page 102
 
-public class ToscaGroupsTopologyTemplateDefinition {
+public class ToscaGroupsTopologyTemplateDefinition extends ToscaServiceGroupsMetadataDefinition implements Serializable {
 
-	private String type; // required
-	private String description;
+	public static final long serialVersionUID = -6373752349967949120L;
+	public String type; // required
+	public String description;
 	//	private Map<String, String> properties;
-	private ToscaGroupPropertyDefinition properties;
-	private Map<String, String> targets; // required
-	private Map<String, Object> interfaces;
-	private List<String> members;
+	public ToscaGroupPropertyDefinition properties;
+	public Map<String, String> targets; // required
+	public Map<String, Object> interfaces;
+	public List<String> members;
 	//	private Map<String, String> metadata;
-	private ToscaServiceGroupsMetadataDefinition metadata;
+//	private ToscaServiceGroupsMetadataDefinition metadata;
 
 	public ToscaGroupsTopologyTemplateDefinition() {
 		super();
 	}
 
-	public ToscaServiceGroupsMetadataDefinition getMetadata() {
-		return metadata;
+//	public ToscaServiceGroupsMetadataDefinition getMetadata() {
+//		return metadata;
+//	}
+//
+	public void setMetadata(ToscaServiceGroupsMetadataDefinition metadata) {
+		this.vfModuleModelCustomizationUUID = metadata.vfModuleModelCustomizationUUID;
+		this.vfModuleModelInvariantUUID = metadata.vfModuleModelInvariantUUID;
+		this.vfModuleModelName = metadata.vfModuleModelName;
+		this.vfModuleModelUUID = metadata.vfModuleModelUUID;
+		this.vfModuleModelVersion = metadata.vfModuleModelVersion;
 	}
 
-	public void setMetadata(ToscaServiceGroupsMetadataDefinition metadata) {
-		this.metadata = metadata;
-	}
+
 
 	public String getType() {
 		return type;
@@ -115,10 +123,42 @@
 //		this.metadata = metadata;
 //	}
 
+//	@Override
+//	public String toString() {
+//		return "ToscaGroupsTopologyTemplateDefinition [type=" + type + ", description=" + description + ", properties=" + properties + ", targets=" + targets + ", interfaces=" + interfaces + ", members=" + members + ", metadata=" + metadata
+//				+ "]";
+//	}
+
+
 	@Override
 	public String toString() {
-		return "ToscaGroupsTopologyTemplateDefinition [type=" + type + ", description=" + description + ", properties=" + properties + ", targets=" + targets + ", interfaces=" + interfaces + ", members=" + members + ", metadata=" + metadata
-				+ "]";
+		return "ToscaGroupsTopologyTemplateDefinition{" +
+				"type='" + type + '\'' +
+				", description='" + description + '\'' +
+				", properties=" + properties +
+				", targets=" + targets +
+				", interfaces=" + interfaces +
+				", members=" + members +
+				'}';
+	}
+
+
+	@Override
+	public boolean equals(Object o) {
+		if (this == o) return true;
+		if (!(o instanceof ToscaGroupsTopologyTemplateDefinition)) return false;
+		if (!super.equals(o)) return false;
+
+		ToscaGroupsTopologyTemplateDefinition that = (ToscaGroupsTopologyTemplateDefinition) o;
+
+//		if (type != null ? !type.equals(that.type) : that.type != null) return false;
+//		if (description != null ? !description.equals(that.description) : that.description != null) return false;
+//		if (properties != null ? !properties.equals(that.properties) : that.properties != null) return false;
+//		if (targets != null ? !targets.equals(that.targets) : that.targets != null) return false;
+//		if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) return false;
+//		return members != null ? members.equals(that.members) : that.members == null;
+
+		return (properties != null ? properties.equals(that.properties) : false);
 	}
 
 	//gets Type description for Yaml snake
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsAnnotation.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsAnnotation.java
new file mode 100644
index 0000000..4d31bdf
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsAnnotation.java
@@ -0,0 +1,51 @@
+package org.openecomp.sdc.ci.tests.tosca.datatypes;
+
+import org.yaml.snakeyaml.TypeDescription;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class ToscaInputsAnnotation {
+	
+	String name;
+	String type;
+	private Map<String, Object> properties;
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+	public Map<String, Object> getProperties() {
+		return properties;
+	}
+	public void setProperties(Map<String, Object> properties) {
+		this.properties = properties;
+	}
+	
+	
+	//gets Type description for Yaml snake
+	public static TypeDescription getTypeDescription(){
+        return new TypeDescription(ToscaInputsAnnotation.class);
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		if (this == o) return true;
+		if (o == null || getClass() != o.getClass()) return false;
+		ToscaInputsAnnotation that = (ToscaInputsAnnotation) o;
+		return Objects.equals(type, that.type);
+	}
+
+	@Override
+	public int hashCode() {
+		return Objects.hash(type);
+	}
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
index c3b11f2..3f0bac0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
@@ -20,14 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import com.google.gson.annotations.SerializedName;
+import org.yaml.snakeyaml.TypeDescription;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import org.yaml.snakeyaml.TypeDescription;
-
-import com.google.gson.annotations.SerializedName;
-
 public class ToscaInputsTopologyTemplateDefinition {
 	
 	public String name;
@@ -40,11 +39,12 @@
 	public Object Default;
 
 	public String status;
-	public List<Object> constraints = new ArrayList<Object>();
+	public List<Object> constraints = new ArrayList<>();
 	public Map<String, Object> entry_schema;
 	public Object value;
+	public Map<String, ToscaInputsAnnotation> annotations;
 
-	public ToscaInputsTopologyTemplateDefinition(String name, String type, String description, Boolean required, Object default1, String status, List<Object> constraints, Map<String, Object> entry_schema, Object value, Boolean immutable, Boolean hidden) {
+	public ToscaInputsTopologyTemplateDefinition(String name, String type, String description, Boolean required, Object default1, String status, List<Object> constraints, Map<String, Object> entry_schema, Object value, Boolean immutable, Boolean hidden, Map<String, ToscaInputsAnnotation> annotations) {
 		super();
 		this.name = name;
 		this.type = type;
@@ -57,6 +57,7 @@
 		this.value = value;
 		this.immutable = immutable;
 		this.hidden = hidden;
+		this.annotations = annotations;
 	}
 
 	public ToscaInputsTopologyTemplateDefinition() {
@@ -164,11 +165,20 @@
 		this.value = value;
 	}
 
+	public Map<String, ToscaInputsAnnotation> getAnnotations() {
+		return annotations;
+	}
+
+	public void setAnnotations(Map<String, ToscaInputsAnnotation> annotations) {
+		this.annotations = annotations;
+	}
+
 	//gets Type description for Yaml snake
 	public static TypeDescription getTypeDescription(){
         TypeDescription typeDescription = new TypeDescription(ToscaInputsTopologyTemplateDefinition.class);
         typeDescription.putListPropertyType("constraints", Object.class);
         typeDescription.putMapPropertyType("entry_schema", String.class, Object.class);
+        typeDescription.putMapPropertyType("annotations", String.class, ToscaInputsAnnotation.class); 
     	return typeDescription;
 	}
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java
index 168f7c6..442656e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import org.yaml.snakeyaml.TypeDescription;
+
 import java.util.List;
 import java.util.Map;
 
-import org.yaml.snakeyaml.TypeDescription;
-
 public class ToscaNodeTemplatesTopologyTemplateDefinition {
 
 	private String name;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
index 9f1d544..1e36099 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
@@ -2,10 +2,11 @@
 
 public interface ToscaParameterConstants {
 
-	public static final String ENTRY_DEFINITION = "Entry-Definitions";
-	public static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
-	public static final String HEAT_META_PATH = "Artifacts/HEAT.meta";
-	public static final String IMPORT_STRUCTURE = "importStructure";
-	public static final String NODE_TYPES = "node_types";
-	public static final String PROPERTIES = "properties";
+	String TOSCA_DEFINITION_PATH = "Definitions";
+	String ENTRY_DEFINITION = "Entry-Definitions";
+	String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
+	String HEAT_META_PATH = "Artifacts/HEAT.meta";
+	String IMPORT_STRUCTURE = "importStructure";
+	String NODE_TYPES = "node_types";
+	String PROPERTIES = "properties";
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java
index da8c99a..5b50b0e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java
@@ -20,7 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
-public class ToscaServiceGroupsMetadataDefinition {
+import java.io.Serializable;
+
+public class ToscaServiceGroupsMetadataDefinition implements Serializable {
+
+	public static final long serialVersionUID = -6373756459974949120L;
 
 	public String vfModuleModelName;
 	public String vfModuleModelInvariantUUID;
@@ -77,7 +81,26 @@
 		return "ToscaGroupsMetadataDefinition [vfModuleModelName=" + vfModuleModelName + ", vfModuleModelInvariantUUID=" + vfModuleModelInvariantUUID + ", vfModuleModelCustomizationUUID=" + vfModuleModelCustomizationUUID
 				+ ", vfModuleModelUUID=" + vfModuleModelUUID + ", vfModuleModelVersion=" + vfModuleModelVersion + "]";
 	}
-	
-	
-	
+
+	@Override
+	public boolean equals(Object o) {
+		if (this == o) return true;
+		if (!(o instanceof ToscaServiceGroupsMetadataDefinition)) return false;
+
+		ToscaServiceGroupsMetadataDefinition that = (ToscaServiceGroupsMetadataDefinition) o;
+
+		if (vfModuleModelName != null ? !vfModuleModelName.equals(that.vfModuleModelName) : that.vfModuleModelName != null)
+			return false;
+		if (!vfModuleModelInvariantUUID.equals(that.vfModuleModelInvariantUUID)) return false;
+		if (vfModuleModelCustomizationUUID != null ? !vfModuleModelCustomizationUUID.equals(that.vfModuleModelCustomizationUUID) : that.vfModuleModelCustomizationUUID != null)
+			return false;
+		if (vfModuleModelUUID != null ? !vfModuleModelUUID.equals(that.vfModuleModelUUID) : that.vfModuleModelUUID != null)
+			return false;
+		return vfModuleModelVersion != null ? vfModuleModelVersion.equals(that.vfModuleModelVersion) : that.vfModuleModelVersion == null;
+	}
+
+	@Override
+	public int hashCode() {
+		return vfModuleModelInvariantUUID.hashCode();
+	}
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java
index 9b474e9..d3bb2a0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import org.yaml.snakeyaml.TypeDescription;
+
 import java.util.HashMap;
 import java.util.Map;
 
-import org.yaml.snakeyaml.TypeDescription;
-
 public class ToscaSubstitutionMappingsDefinition {
 
 	private String node_type;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
index 03f83b4..9b29960 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
@@ -20,17 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.tosca.datatypes;
 
+import org.yaml.snakeyaml.TypeDescription;
+
 import java.util.HashMap;
 import java.util.Map;
 import java.util.stream.Collectors;
 
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.yaml.snakeyaml.TypeDescription;
-
-import com.clearspring.analytics.util.Pair;
-
-import io.netty.util.collection.IntObjectMap.Entry;
-
 //	spec page 104	
 public class ToscaTopologyTemplateDefinition {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypeDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypeDefinition.java
new file mode 100644
index 0000000..e208b77
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypeDefinition.java
@@ -0,0 +1,26 @@
+package org.openecomp.sdc.ci.tests.tosca.datatypes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ToscaTypeDefinition {
+
+    private String description;
+    private Map<String, Object> properties = new HashMap<>();
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypesDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypesDefinition.java
new file mode 100644
index 0000000..6fc8044
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTypesDefinition.java
@@ -0,0 +1,26 @@
+package org.openecomp.sdc.ci.tests.tosca.datatypes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ToscaTypesDefinition {
+
+    private String tosca_definitions_version;
+    private List<String> imports = new ArrayList<>();
+
+    public String getTosca_definitions_version() {
+        return tosca_definitions_version;
+    }
+
+    public void setTosca_definitions_version(String tosca_definitions_version) {
+        this.tosca_definitions_version = tosca_definitions_version;
+    }
+
+    public List<String> getImports() {
+        return imports;
+    }
+
+    public void setImports(List<String> imports) {
+        this.imports = imports;
+    }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/VfModuleDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/VfModuleDefinition.java
new file mode 100644
index 0000000..2f9c1d4
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/VfModuleDefinition.java
@@ -0,0 +1,37 @@
+package org.openecomp.sdc.ci.tests.tosca.datatypes;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class VfModuleDefinition extends ToscaGroupsTopologyTemplateDefinition implements Serializable {
+
+    private List<String> artifacts;
+
+    public static final long serialVersionUID = -6373756459967949586L;
+
+    public List<String> getArtifacts() {
+        return artifacts;
+    }
+
+    public void setArtifacts(List<String> artifacts) {
+        this.artifacts = artifacts;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof VfModuleDefinition)) return false;
+        if (!super.equals(o)) return false;
+
+        VfModuleDefinition that = (VfModuleDefinition) o;
+
+        return artifacts != null ? artifacts.containsAll(that.artifacts) : that.artifacts == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (artifacts != null ? artifacts.hashCode() : 0);
+        return result;
+    }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java
index cdea2ff..247a41d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java
@@ -23,6 +23,7 @@
 		SERVICE_ECOMP_NAMING                   ("serviceEcompNaming",               ComponentTypeEnum.SERVICE.value),
 		ECOMP_GENERATED_NAMING                 ("ecompGeneratedNaming",             ComponentTypeEnum.SERVICE.value),
 		NAMING_POLICY                          ("namingPolicy",                     ComponentTypeEnum.SERVICE.value),
+		INSTANTIATION_TYPE                     ("instantiationType",                ComponentTypeEnum.SERVICE.value),
 		
 //		node_template
 		CUSTOMIZATION_UUID                     ("customizationUUID",                ComponentTypeEnum.NODE_TEMPLATE.value), 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarParserUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarParserUtils.java
index 157377f..fc717ca 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarParserUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarParserUtils.java
@@ -20,30 +20,51 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import static org.testng.AssertJUnit.assertTrue;
+import org.apache.commons.codec.binary.Base64;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.junit.Assert;
+import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.PropertyHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.PropertyHeatMetaDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
-import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class CsarParserUtils {
+	public static final String CSAR_ARTIFACT = "assettoscacsar";
 	private static Logger log = LoggerFactory.getLogger(CsarValidationUtils.class.getName());
 
+	public static byte[] downloadComponentCsar(Component csarOwner, User user) throws Exception {
+		String artifactUniqeId = csarOwner.getToscaArtifacts().get(CSAR_ARTIFACT).getUniqueId();
+		RestResponse csarResponse = ArtifactRestUtils.downloadResourceArtifactInternalApi(csarOwner.getUniqueId(), user, artifactUniqeId);
+		Assert.assertNotNull(csarResponse);
+		BaseRestUtils.checkSuccess(csarResponse);
+		ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(csarResponse.getResponse(),
+				ArtifactUiDownloadData.class);
+		byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
+		return Base64.decodeBase64(fromUiDownload);
+	}
+	
 	public static List<TypeHeatMetaDefinition> getListTypeHeatMetaDefinition(File csarFileLocation) throws Exception {
 
 		String artifactHeatMetaLocation = ToscaParameterConstants.HEAT_META_PATH;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java
index 8270515..0b62f4a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java
@@ -1,11 +1,5 @@
 package org.openecomp.sdc.ci.tests.utils;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
 import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
 import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
 import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
@@ -15,6 +9,12 @@
 import org.onap.sdc.toscaparser.api.elements.Metadata;
 import org.onap.sdc.toscaparser.api.parameters.Input;
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
 public class CsarToscaTester {
 
 	public static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException {
@@ -78,7 +78,8 @@
 	private static void generateReport(String time, String name, String currentCsarDir, List<String> criticalsReport, String type)
 			throws IOException {
 		FileWriter fw;
-		fw = new FileWriter(new File(currentCsarDir + "/" + criticalsReport.size() + "-"+type+"-" + name +"-"+time + ".txt"));
+		try (FileWriter fileWriter = fw = new FileWriter(new File(currentCsarDir + "/" + criticalsReport.size() + "-" + type + "-" + name + "-" + time + ".txt"))) {
+		}
 		for (String exception : criticalsReport) {
 			fw.write(exception);
 			fw.write("\r\n");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
index 16266fb..dea9084 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
@@ -20,14 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
+import com.google.gson.*;
+import com.thinkaurelius.titan.core.TitanEdge;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanVertex;
+import fj.data.Either;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -39,17 +37,9 @@
 import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject;
 import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
-
-import fj.data.Either;
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
 
 public class DbUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Decoder.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Decoder.java
index 7d90eb0..3b11388 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Decoder.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Decoder.java
@@ -20,12 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
+import org.apache.commons.codec.binary.Base64;
+
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
 
-import org.apache.commons.codec.binary.Base64;
-
 public class Decoder {
 
 	public static String encode(byte[] byteArrayToEncode) {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java
index 835ef6e..479fdcb 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java
@@ -20,15 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -40,20 +33,20 @@
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
-import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.ResponseParser;
 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.*;
+import java.util.Map.Entry;
+
 //import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNotificationEnum;
 
-import com.clearspring.analytics.util.Pair;
-import com.google.gson.Gson;
-
-import fj.data.Either;
-
  public class DistributionUtils extends BaseRestUtils{
 	 
 	 final static String serviceDistributionSuffix = "/sdc/v1/catalog/services/";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java
index 9ac02a0..55cc748 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java
@@ -20,47 +20,26 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Product;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-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.datatypes.ComponentInstanceReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.ComponentInstanceRestUtils;
-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.testng.Assert;
 
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.*;
+
 public class ReqCap {
 
 	public static Map<String, List<CapabilityDefinition>> expectedContainerCapabilities;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
index f345aad..be235d0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
@@ -20,26 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Map;
-
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaImportsDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaMetadataDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaNodeTemplatesTopologyTemplateDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaSubstitutionMappingsDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.*;
 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.ImportRestUtils;
@@ -51,6 +33,16 @@
 import org.yaml.snakeyaml.constructor.Constructor;
 import org.yaml.snakeyaml.introspector.PropertyUtils;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
 public class ToscaParserUtils {
 
 	private static Logger log = LoggerFactory.getLogger(ToscaParserUtils.class.getName());
@@ -112,7 +104,8 @@
 //        File path = new File("C:/Data/D2.0/TOSCA_Ex/Definitions/tosca_definition_version.yaml");
         FileInputStream fis = null;
         try {
-        	fis = new FileInputStream(path);
+			try (FileInputStream fileInputStream = fis = new FileInputStream(path)) {
+			}
 			
 		} catch (Exception e) {
 			System.out.println("Exception: " + e);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaTypesDefinitionUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaTypesDefinitionUtils.java
new file mode 100644
index 0000000..4af84a7
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaTypesDefinitionUtils.java
@@ -0,0 +1,54 @@
+package org.openecomp.sdc.ci.tests.utils;
+
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaAnnotationsTypesDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+import static org.junit.Assert.assertNotNull;
+import static org.openecomp.sdc.ci.tests.utils.CsarParserUtils.downloadComponentCsar;
+import static org.openecomp.sdc.ci.tests.utils.ToscaParserUtils.getDataFromZipFileByBytes;
+import static org.testng.AssertJUnit.fail;
+
+public class ToscaTypesDefinitionUtils {
+
+    private ToscaTypesDefinitionUtils() {
+    }
+
+    private static final String ANNOTATIONS_TYPE_PATH = ToscaParameterConstants.TOSCA_DEFINITION_PATH + "/annotations.yml";
+    private static Logger log = LoggerFactory.getLogger(ToscaTypesDefinitionUtils.class);
+
+    public static ToscaAnnotationsTypesDefinition getToscaAnnotationsFromCsar(Component csarOwner, User user) throws Exception {
+        byte[] decodeBase64 = downloadComponentCsar(csarOwner, user);
+        String dataFromZipFileByBytes = getDataFromZipFileByBytes(ANNOTATIONS_TYPE_PATH, decodeBase64);
+        assertNotNull(dataFromZipFileByBytes);
+        return parseToscaAnnotationsYml(dataFromZipFileByBytes);
+    }
+
+    private static ToscaAnnotationsTypesDefinition parseToscaAnnotationsYml(String payload){
+        Constructor constructor = initToscaAnnotationDefObject();
+        return (ToscaAnnotationsTypesDefinition) parseToscaYamlPayload(payload, constructor);
+    }
+
+    private static Object parseToscaYamlPayload(String payload, Constructor constructor) {
+        Yaml yaml = new Yaml(constructor);
+        try {
+            return yaml.load(payload);
+        } catch (Exception e) {
+            log.debug("Failed to parse tosca yaml file", e);
+            e.printStackTrace();
+            fail("Failed to parse tosca yaml file");
+        }
+        return null;
+    }
+
+    private static Constructor initToscaAnnotationDefObject() {
+        Constructor toscaStructure = new Constructor(ToscaAnnotationsTypesDefinition.class);
+        toscaStructure.addTypeDescription(ToscaAnnotationsTypesDefinition.getTypeDescription());
+        return toscaStructure;
+    }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
index 05dcc7e..ea6ef62 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
@@ -20,9 +20,20 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.tosca.model.ToscaMetadataFieldsPresentationEnum;
+import org.openecomp.sdc.common.api.ToscaNodeTypeInfo;
+import org.openecomp.sdc.common.api.YamlConstants;
+import org.yaml.snakeyaml.Yaml;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -31,23 +42,13 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.common.api.ToscaNodeTypeInfo;
-import org.openecomp.sdc.common.api.YamlConstants;
-import org.yaml.snakeyaml.Yaml;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import static org.testng.AssertJUnit.*;
 
 public final class Utils {
 
@@ -701,7 +702,49 @@
 		long startTime = System.nanoTime();
 		func.run();
 		long estimateTime = System.nanoTime();
-		long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+        Long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
 		return duration;
 	}
+
+    public static Long getAndValidateActionDuration (Runnable action, int regularTestRunTime){
+        Long actualTestRunTime = null;
+        try {
+            actualTestRunTime = Utils.getActionDuration(() -> {
+                try {
+                    action.run();
+                } catch (Throwable throwable) {
+                    throwable.printStackTrace();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        double factor = 1.5;
+
+        assertTrue("Expected test run time should be less than " + regularTestRunTime*factor + ", " +
+                "actual time is " + actualTestRunTime , regularTestRunTime*factor>actualTestRunTime);
+//        SetupCDTest.getExtendTest().log(Status.INFO, "Actual catalog loading time is  " + actualTestRunTime + " seconds");
+        return actualTestRunTime;
+    }
+
+
+	public static Map<String, String> generateServiceMetadataToExpectedObject(ServiceReqDetails serviceReqDetails, Component component) {
+			
+			Map<String, String> metadata = new HashMap<>();
+			
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, serviceReqDetails.getCategories().get(0).getName());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, serviceReqDetails.getDescription());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, component.getInvariantUUID());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, "Service");
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, component.getUUID());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, component.getName());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INSTANTIATION_TYPE.value, serviceReqDetails.getInstantiationType());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_TYPE.value, serviceReqDetails.getServiceType());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_ROLE.value, serviceReqDetails.getServiceRole());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAMING_POLICY.value, serviceReqDetails.getNamingPolicy());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.ECOMP_GENERATED_NAMING.value, serviceReqDetails.getEcompGeneratedNaming().toString());
+			metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_ECOMP_NAMING.value, serviceReqDetails.getEcompGeneratedNaming().toString());//equals to ECOMP_GENERATED_NAMING
+			
+			return metadata;
+		}
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
index aa68392..20a137d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
@@ -20,32 +20,22 @@
 
 package org.openecomp.sdc.ci.tests.utils.cassandra;
 
-import java.io.FileNotFoundException;
+import com.datastax.driver.core.*;
 import com.datastax.driver.core.policies.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.javatuples.Pair;
-import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.KeyspaceMetadata;
-import com.datastax.driver.core.Metadata;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.TableMetadata;
-import com.datastax.driver.core.policies.ConstantReconnectionPolicy;
-import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
-import com.datastax.driver.core.policies.DefaultRetryPolicy;
-import com.datastax.driver.core.policies.LoadBalancingPolicy;
-import com.datastax.driver.core.policies.TokenAwarePolicy;
 import com.datastax.driver.core.querybuilder.QueryBuilder;
 import com.datastax.driver.core.querybuilder.Select;
 import com.datastax.driver.core.querybuilder.Select.Where;
+import org.javatuples.Pair;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 public final class CassandraUtils {
     private static Logger logger = LoggerFactory.getLogger(CassandraUtils.class.getName());
@@ -173,7 +163,7 @@
         }
     }
 
-    public static List<Row> fetchFromTable(String keyspace, String tableName, List<Pair<AuditingFieldsKeysEnum, String>> fields) throws FileNotFoundException {
+    public static List<Row> fetchFromTable(String keyspace, String tableName, List<Pair<AuditingFieldsKey, String>> fields) throws FileNotFoundException {
 
         List<Pair<String, String>> fieldsConverted = new ArrayList<>();
 
@@ -184,7 +174,7 @@
 
         fields.forEach(pair -> {
             Pair<String, String> newPair;
-            if (pair.getValue0() == AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL) {
+            if (pair.getValue0() == AuditingFieldsKey.AUDIT_DISTRIBUTION_RESOURCE_URL) {
                 newPair = new Pair<String, String>("RESOURE_URL", pair.getValue1());
 
             } else {
@@ -208,7 +198,7 @@
             if (session != null) {
                 Select select = QueryBuilder.select().all().from(keyspace, tableName);
                 if (fields != null) {
-                    // Set<Entry<AuditingFieldsKeysEnum, String>> entrySet =
+                    // Set<Entry<AuditingFieldsKey, String>> entrySet =
                     // fields.entrySet();
                     // fields.
                     boolean multiple = (fields.size() > 1) ? true : false;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
index 8381bbd..ebb3b33 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
@@ -20,26 +20,20 @@
 
 package org.openecomp.sdc.ci.tests.utils.cassandra;
 
-import java.io.FileNotFoundException;
-import java.util.Collection;
-import java.util.List;
-
-import org.javatuples.Pair;
-import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.KeyspaceMetadata;
-import com.datastax.driver.core.Metadata;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.TableMetadata;
+import com.datastax.driver.core.*;
 import com.datastax.driver.core.querybuilder.QueryBuilder;
 import com.datastax.driver.core.querybuilder.Select;
 import com.datastax.driver.core.querybuilder.Select.Where;
+import org.javatuples.Pair;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileNotFoundException;
+import java.util.Collection;
+import java.util.List;
 
 public final class CassandraUtils2 {
 	private static Logger logger = LoggerFactory.getLogger(CassandraUtils2.class.getName());
@@ -110,10 +104,10 @@
 	}
 
 	public static List<Row> fetchFromTable(String keyspace, String tableName,
-			List<Pair<AuditingFieldsKeysEnum, String>> fields) throws FileNotFoundException {
+			List<Pair<AuditingFieldsKey, String>> fields) throws FileNotFoundException {
 
-		// List<Pair<AuditingFieldsKeysEnum, String>>
-		// Map<AuditingFieldsKeysEnum, String>
+		// List<Pair<AuditingFieldsKey, String>>
+		// Map<AuditingFieldsKey, String>
 
 		Cluster cluster = null;
 		Session session;
@@ -125,14 +119,14 @@
 			if (session != null) {
 				Select select = QueryBuilder.select().all().from(keyspace, tableName);
 				if (fields != null) {
-					// Set<Entry<AuditingFieldsKeysEnum, String>> entrySet =
+					// Set<Entry<AuditingFieldsKey, String>> entrySet =
 					// fields.entrySet();
 					// fields.
 					boolean multiple = (fields.size() > 1) ? true : false;
 					Where where = null;
 					int size = 0;
 
-					for (Pair<AuditingFieldsKeysEnum, String> pair : fields) {
+					for (Pair<AuditingFieldsKey, String> pair : fields) {
 						++size;
 						if (size == 1) {
 							where = select.where(QueryBuilder.eq(pair.getValue0().getDisplayName(), pair.getValue1()));
@@ -161,9 +155,9 @@
 	}
 	//
 	// public static void main(String[] args) throws FileNotFoundException {
-	// Map<AuditingFieldsKeysEnum, String> map = new HashMap<>();
-	// map.put(AuditingFieldsKeysEnum.AUDIT_ACTION, "Access");
-	// map.put(AuditingFieldsKeysEnum.AUDIT_STATUS, "200");
+	// Map<AuditingFieldsKey, String> map = new HashMap<>();
+	// map.put(AuditingFieldsKey.AUDIT_ACTION, "Access");
+	// map.put(AuditingFieldsKey.AUDIT_STATUS, "200");
 	// // CassandraUtils.truncateTable("sdcartifact", "resources");
 	//// CassandraUtils.truncateAllTables("sdcaudit");
 	// CassandraUtils.fetchFromTable("sdcaudit", "useraccessevent", map );
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
index 36fdf06..8e5079d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
@@ -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.
@@ -20,7 +20,38 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import static org.testng.AssertJUnit.assertTrue;
+import com.aventstack.extentreports.Status;
+import com.google.gson.Gson;
+import fj.data.Either;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.tuple.Pair;
+import org.json.JSONException;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.api.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
+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.lifecycle.LCSbaseTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utils.CsarToscaTester;
+import org.openecomp.sdc.ci.tests.utils.DistributionUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.*;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openecomp.sdc.common.util.GeneralUtility;
+import org.testng.SkipException;
 
 import java.io.File;
 import java.io.IOException;
@@ -34,78 +65,13 @@
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.tuple.Pair;
-import org.json.JSONException;
-import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
-import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.DistributionStatusEnum;
-import org.openecomp.sdc.be.model.GroupDefinition;
-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.GroupDefinition;
-import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.api.ExtentTestActions;
-import org.openecomp.sdc.ci.tests.api.Urls;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject;
-import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-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.utils.CsarToscaTester;
-import org.openecomp.sdc.ci.tests.utils.DistributionUtils;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
-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.common.api.ArtifactGroupTypeEnum;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.testng.SkipException;
-
-import com.aventstack.extentreports.Status;
-import com.google.gson.Gson;
-
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public final class AtomicOperationUtils {
 
 	static final String basicAuthentication = "Basic Y2k6MTIzNDU2";
-	
+
 	private AtomicOperationUtils() {
 		throw new UnsupportedOperationException();
 	}
@@ -113,7 +79,7 @@
 	// *********** RESOURCE ****************
 	/**
 	 * Import a vfc From tosca file
-	 * 
+	 *
 	 * @param filePath
 	 * @param fileName
 	 * @return
@@ -190,7 +156,7 @@
 			throw new AtomicOperationException(e);
 		}
 	}
-	
+
 	public static Either<Resource, RestResponse> createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum resourceType, NormativeTypesEnum normativeTypes, ResourceCategoryEnum resourceCategory, UserRoleEnum userRole, Boolean validateState)
 			throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -247,7 +213,7 @@
 			throw new AtomicOperationException(e);
 		}
 	}
-	
+
 	// *********** SERVICE ****************
 
 	public static Either<Service, RestResponse> createDefaultService(UserRoleEnum userRole, Boolean validateState) throws Exception {
@@ -346,56 +312,61 @@
 
 		Boolean isValidationFailed = false;
 		RestResponse lifeCycleStatesResponse = null;
-		User defaultUser = ElementFactory.getDefaultUser(userRole);
+		User defaultUser;
 
-		LifeCycleStatesEnum curentCompState = LifeCycleStatesEnum.findByCompState(component.getLifecycleState().toString());
+		LifeCycleStatesEnum currentCompState = LifeCycleStatesEnum.findByCompState(component.getLifecycleState().toString());
 
-		if (curentCompState == targetState) {
+		if (currentCompState == targetState) {
 			component = getComponentObject(component, userRole);
 			return Pair.of(component, null);
 		}
-
+		String componentType = component.getComponentType().getValue();
 		ArrayList<String> lifeCycleStatesEnumList = new ArrayList<>();
-		if (curentCompState.equals(LifeCycleStatesEnum.CHECKIN) && targetState.equals(LifeCycleStatesEnum.CHECKOUT)) {
+		if (currentCompState.equals(LifeCycleStatesEnum.CHECKIN) && targetState.equals(LifeCycleStatesEnum.CHECKOUT)) {
 			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
 			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
+//            TODO Andrey added component type condition
 		} else {
-			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
-			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
-			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFICATIONREQUEST.toString());
-			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.STARTCERTIFICATION.toString());
-			lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
+			if (componentType.equals("Resource")) {
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
+			} else {
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFICATIONREQUEST.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.STARTCERTIFICATION.toString());
+				lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
+			}
 		}
 		for (int i = 0; i < lifeCycleStatesEnumList.size(); i++) {
-			if (lifeCycleStatesEnumList.get(i).equals(curentCompState.name())) {
+			if (lifeCycleStatesEnumList.get(i).equals(currentCompState.name())) {
 				int a;
 				a = (i == lifeCycleStatesEnumList.size() - 1) ? 0 : i + 1;
-
 				for (int n = a; n < lifeCycleStatesEnumList.size(); n++) {
-					if (lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.STARTCERTIFICATION.name()) || lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.CERTIFY.name())) {
+					if ((lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.STARTCERTIFICATION.name()) || lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.CERTIFY.name())) && !componentType.equals("Resource")) {
 						defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
-					} else
+					} else {
 						defaultUser = ElementFactory.getDefaultUser(userRole);
-
+					}
 					lifeCycleStatesResponse = LifecycleRestUtils.changeComponentState(component, defaultUser, LifeCycleStatesEnum.findByState(lifeCycleStatesEnumList.get(n)));
 					if (lifeCycleStatesResponse.getErrorCode() != LifecycleRestUtils.STATUS_CODE_SUCCESS)
 						isValidationFailed = true;
-					if (lifeCycleStatesEnumList.get(n).equals(targetState.toString()) || isValidationFailed == true) {
+					if (lifeCycleStatesEnumList.get(n).equals(targetState.toString()) || isValidationFailed) {
 						break;
 					}
 				}
 			}
-
 		}
 		Component componentJavaObject = getComponentObject(component, userRole);
 
-		if (validateState == true && isValidationFailed == true) {
-			assertTrue("change state failed" + lifeCycleStatesResponse.getResponse(), false);
+		if (validateState && isValidationFailed) {
+			assertTrue("change state to [" + targetState.getState() + "] failed" + lifeCycleStatesResponse.getResponse(), false);
 
 			return Pair.of(componentJavaObject, lifeCycleStatesResponse);
 		}
 
-		if (isValidationFailed == true) {
+		if (isValidationFailed) {
 			return Pair.of(componentJavaObject, lifeCycleStatesResponse);
 		}
 
@@ -425,7 +396,7 @@
 
 		return distributionService;
 	}
-	
+
 	public static void toscaValidation(Component component, String vnfFile) throws Exception {
 
 		ISdcCsarHelper fdntCsarHelper;
@@ -444,7 +415,7 @@
 
 		User defaultUser = ElementFactory.getDefaultUser(userRole);
 		ArtifactReqDetails artifactDetails = ElementFactory.getArtifactByType(null, artifactType, deploymentTrue);
-		if (deploymentTrue == false)
+		if (!deploymentTrue)
 			artifactDetails.setArtifactGroupType(ArtifactGroupTypeEnum.INFORMATIONAL.getType());
 		RestResponse uploadArtifactResp = ArtifactRestUtils.uploadArtifact(artifactDetails, component, defaultUser);
 
@@ -462,7 +433,7 @@
 	// *********** CONTAINERS *****************
 	/**
 	 * Adds Component instance to Component
-	 * 
+	 *
 	 * @param compInstParent
 	 * @param compContainer
 	 * @return
@@ -483,7 +454,7 @@
 					throw new SkipException("Open bug DE262001");
 				}
 				else{
-				assertTrue("error - " + createComponentInstance.getErrorCode() + "instead - " + ServiceRestUtils.STATUS_CODE_CREATED, createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_CREATED);
+					assertTrue("error - " + createComponentInstance.getErrorCode() + "instead - " + ServiceRestUtils.STATUS_CODE_CREATED, createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_CREATED);
 				}
 			}
 
@@ -528,86 +499,79 @@
 	public static Resource getResourceObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
 		// User defaultUser = ElementFactory.getDefaultUser(userRole);
 		RestResponse restResponse = ResourceRestUtils.getResource(containerDetails.getUniqueId());
-		Resource container = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
-		return container;
+		return ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
 	}
-	
+
 	public static Resource getResourceObject(String uniqueId) throws Exception {
 		RestResponse restResponse = ResourceRestUtils.getResource(uniqueId);
-		Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
-		return resource;
+		return ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
 	}
-	
+
 	public static Resource getResourceObjectByNameAndVersion(UserRoleEnum sdncModifierDetails, String resourceName, String resourceVersion) throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(sdncModifierDetails);
 		RestResponse resourceResponse = ResourceRestUtils.getResourceByNameAndVersion(defaultUser.getUserId(), resourceName, resourceVersion);
-		Resource container = ResponseParser.convertResourceResponseToJavaObject(resourceResponse.getResponse());
-		return container;
+		return ResponseParser.convertResourceResponseToJavaObject(resourceResponse.getResponse());
 	}
 
 	public static Service getServiceObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(userRole);
 		RestResponse serviceResponse = ServiceRestUtils.getService(containerDetails.getUniqueId(), defaultUser);
-		Service container = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
-		return container;
+		return ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
 	}
-	
+
 	public static Service getServiceObjectByNameAndVersion(UserRoleEnum sdncModifierDetails, String serviceName, String serviceVersion) throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(sdncModifierDetails);
 		RestResponse serviceResponse = ServiceRestUtils.getServiceByNameAndVersion(defaultUser, serviceName, serviceVersion);
-		Service container = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
-		return container;
+		return ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
 	}
-	
+
 	public static Service getServiceObject(String uniqueId) throws Exception {
 		RestResponse serviceResponse = ServiceRestUtils.getService(uniqueId);
-		Service container = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
-		return container;
+		return ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
 	}
 
 	public static Product getProductObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(userRole);
 		RestResponse productRest = ProductRestUtils.getProduct(containerDetails.getUniqueId(), defaultUser.getUserId());
-		Product container = ResponseParser.convertProductResponseToJavaObject(productRest.getResponse());
-		return container;
+		return ResponseParser.convertProductResponseToJavaObject(productRest.getResponse());
 	}
 
 	public static Component getComponentObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
 		User defaultUser = ElementFactory.getDefaultUser(userRole);
 
 		switch (containerDetails.getComponentType()) {
-		case RESOURCE:
-			RestResponse restResponse = ResourceRestUtils.getResource(containerDetails.getUniqueId());
-			containerDetails = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
-			break;
-		case SERVICE:
-			RestResponse serviceResponse = ServiceRestUtils.getService(containerDetails.getUniqueId(), defaultUser);
-			containerDetails = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
-			break;
-		case PRODUCT:
-			RestResponse productRest = ProductRestUtils.getProduct(containerDetails.getUniqueId(), defaultUser.getUserId());
-			containerDetails = ResponseParser.convertProductResponseToJavaObject(productRest.getResponse());
-			break;
-		default:
-			break;
+			case RESOURCE:
+				RestResponse restResponse = ResourceRestUtils.getResource(containerDetails.getUniqueId());
+				containerDetails = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
+				break;
+			case SERVICE:
+				RestResponse serviceResponse = ServiceRestUtils.getService(containerDetails.getUniqueId(), defaultUser);
+				containerDetails = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
+				break;
+			case PRODUCT:
+				RestResponse productRest = ProductRestUtils.getProduct(containerDetails.getUniqueId(), defaultUser.getUserId());
+				containerDetails = ResponseParser.convertProductResponseToJavaObject(productRest.getResponse());
+				break;
+			default:
+				break;
 		}
 		return containerDetails;
 	}
 
-	public static Component convertReposnseToComponentObject(Component containerDetails, RestResponse restresponse) throws Exception {
+	public static Component convertReposnseToComponentObject(Component containerDetails, RestResponse restresponse) {
 
 		switch (containerDetails.getComponentType()) {
-		case RESOURCE:
-			containerDetails = ResponseParser.convertResourceResponseToJavaObject(restresponse.getResponse());
-			break;
-		case SERVICE:
-			containerDetails = ResponseParser.convertServiceResponseToJavaObject(restresponse.getResponse());
-			break;
-		case PRODUCT:
-			containerDetails = ResponseParser.convertProductResponseToJavaObject(restresponse.getResponse());
-			break;
-		default:
-			break;
+			case RESOURCE:
+				containerDetails = ResponseParser.convertResourceResponseToJavaObject(restresponse.getResponse());
+				break;
+			case SERVICE:
+				containerDetails = ResponseParser.convertServiceResponseToJavaObject(restresponse.getResponse());
+				break;
+			case PRODUCT:
+				containerDetails = ResponseParser.convertProductResponseToJavaObject(restresponse.getResponse());
+				break;
+			default:
+				break;
 		}
 		return containerDetails;
 	}
@@ -624,17 +588,17 @@
 		if (associate2ResourceInstancesResponse.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS) {
 
 			switch (containerDetails.getComponentType()) {
-			case RESOURCE:
-				containerDetails = ResponseParser.convertResourceResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
-				break;
-			case SERVICE:
-				containerDetails = ResponseParser.convertServiceResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
-				break;
-			case PRODUCT:
-				containerDetails = ResponseParser.convertProductResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
-				break;
-			default:
-				break;
+				case RESOURCE:
+					containerDetails = ResponseParser.convertResourceResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
+					break;
+				case SERVICE:
+					containerDetails = ResponseParser.convertServiceResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
+					break;
+				case PRODUCT:
+					containerDetails = ResponseParser.convertProductResponseToJavaObject(associate2ResourceInstancesResponse.getResponse());
+					break;
+				default:
+					break;
 			}
 
 			return Either.left(containerDetails);
@@ -736,10 +700,13 @@
 		return Either.right(addPropertyResponse);
 	}
 
-	public static Either<GroupDefinition, RestResponse> updateGroupPropertyOnResource(List<PropertyDataDefinition> propertyObject, Resource resource, String groupId, User user, Boolean validateState) throws Exception {
+	public static Either<GroupDefinition, RestResponse> updateGroupPropertyOnResource(String maxVFModuleInstacesValue, Resource resource, String groupId, User user, Boolean validateState) throws Exception {
 
-		Gson gson = new Gson();
-		RestResponse updateGroupPropertyResponse = PropertyRestUtils.updateGroupProperty(resource, groupId, gson.toJson(propertyObject), user);
+//		Gson gson = new Gson();
+        // Json group property object
+        String propertyObjectJson = "[{\"defaultValue\":null,\"description\":\"The maximum instances of this VF-Module\",\"name\":\"max_vf_module_instances\",\"parentUniqueId\":\"org.openecomp.groups.VfModule.1.0.grouptype.max_vf_module_instances\",\"password\":false,\"required\":false,\"schema\":{\"property\":{}},\"type\":\"integer\",\"uniqueId\":\"org.openecomp.groups.VfModule.1.0.grouptype.max_vf_module_instances.property.3\",\"value\":\"" + maxVFModuleInstacesValue + "\",\"definition\":false,\"getInputValues\":null,\"constraints\":null,\"valueUniqueUid\":null,\"ownerId\":\"org.openecomp.groups.VfModule.1.0.grouptype.max_vf_module_instances\"}]";
+//        GroupProperty property = gson.fromJson(propertyObjectJson, GroupProperty.class);
+		RestResponse updateGroupPropertyResponse = PropertyRestUtils.updateGroupProperty(resource, groupId, propertyObjectJson, user);
 
 		if (validateState) {
 			assertTrue("update group property to resource failed: " + updateGroupPropertyResponse.getResponseMessage(), updateGroupPropertyResponse.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
@@ -770,7 +737,7 @@
 
 	/**
 	 * Builds Resource From rest response
-	 * 
+	 *
 	 * @param resourceResp
 	 * @return
 	 */
@@ -792,10 +759,10 @@
 
 		private static final long serialVersionUID = 1L;
 	}
-	
+
 	/**
 	 * Import resource from CSAR
-	 * 
+	 *
 	 * @param resourceType
 	 * @param userRole
 	 * @param fileName
@@ -803,32 +770,94 @@
 	 * @return Resource
 	 * @throws Exception
 	 */
-	public static Resource importResourceFromCSAR(ResourceTypeEnum resourceType, UserRoleEnum userRole, String fileName, String... filePath) throws Exception {
+	public static Resource importResourceFromCsar(ResourceTypeEnum resourceType, UserRoleEnum userRole, String fileName, String... filePath) throws Exception {
 		// Get the CSARs path
 		String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars" ;
 		if (filePath != null && filePath.length > 0) {
-			realFilePath = filePath.toString();
+			StringBuffer result = new StringBuffer();
+			for(String currStr: filePath){
+				result.append(currStr);
+			}
+//			realFilePath = Arrays.toString(filePath);
+			realFilePath = result.toString();
 		}
-		
+
 		// Create default import resource & user
-		ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
+		return importResourceFromCsarFile(resourceType, userRole, fileName, realFilePath);
+	}
+
+	public static Resource importResourceFromCsarFile(ResourceTypeEnum resourceType, UserRoleEnum userRole, String csarFileName, String csarFilePath) throws Exception{
+		RestResponse createResource = getCreateResourceRestResponse(resourceType, userRole, csarFileName, csarFilePath);
+		BaseRestUtils.checkCreateResponse(createResource);
+		return ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+	}
+
+	public static Resource importCertifiedResourceFromCsar(ResourceTypeEnum resourceType, UserRoleEnum userRole,	String csarFileName, String csarFilePath) throws Exception{
+		RestResponse createResource = getCreateCertifiedResourceRestResponse(resourceType, userRole, csarFileName, csarFilePath);
+		BaseRestUtils.checkSuccess(createResource);
+		return ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+	}
+	public static RestResponse getCreateResourceRestResponse(ResourceTypeEnum resourceType, UserRoleEnum userRole,
+															 String csarFileName, String csarFilePath) throws IOException, Exception {
+
+		ImportReqDetails resourceDetails = buildImportReqDetails(resourceType, csarFileName, csarFilePath);
 		User sdncModifierDetails = ElementFactory.getDefaultUser(userRole);
-		
-		byte[] data = null;
-		Path path = Paths.get(realFilePath + File.separator + fileName);
-		data = Files.readAllBytes(path);
-		String payloadName = fileName;
+		RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+		return createResource;
+	}
+
+	public static RestResponse getCreateCertifiedResourceRestResponse(ResourceTypeEnum resourceType, UserRoleEnum userRole,
+																		   String csarFileName, String csarFilePath) throws IOException, Exception {
+
+		ImportReqDetails resourceDetails = buildImportReqDetails(resourceType, csarFileName, csarFilePath);
+		User sdncModifierDetails = ElementFactory.getDefaultUser(userRole);
+		RestResponse response = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+		BaseRestUtils.checkCreateResponse(response);
+		return LCSbaseTest.certifyResource(resourceDetails, sdncModifierDetails);
+	}
+
+	private static ImportReqDetails buildImportReqDetails(ResourceTypeEnum resourceType, String csarFileName, String csarFilePath) throws IOException {
+		ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
+		Path path = Paths.get(csarFilePath + File.separator + csarFileName);
+		byte[] data = Files.readAllBytes(path);
+		String payloadName = csarFileName;
 		String payloadData = Base64.encodeBase64String(data);
 		resourceDetails.setPayloadData(payloadData);
 		resourceDetails.setCsarUUID(payloadName);
 		resourceDetails.setPayloadName(payloadName);
 		resourceDetails.setResourceType(resourceType.name());
-		
-		RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
-		BaseRestUtils.checkCreateResponse(createResource);
-		return ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);		
-	};
-	
+		return resourceDetails;
+	}
+
+	public static Resource updateResourceFromCsar(Resource resource, UserRoleEnum userRole,	String csarFileName, String csarFilePath) throws Exception{
+		User sdncModifierDetails = ElementFactory.getDefaultUser(userRole);
+
+		byte[] data = null;
+		Path path = Paths.get(csarFilePath + File.separator + csarFileName);
+		data = Files.readAllBytes(path);
+		String payloadName = csarFileName;
+		String payloadData = Base64.encodeBase64String(data);
+		ImportReqDetails resourceDetails = new ImportReqDetails(resource, payloadName, payloadData);
+		resourceDetails.setPayloadData(payloadData);
+		resourceDetails.setCsarUUID(payloadName);
+		resourceDetails.setPayloadName(payloadName);
+
+		String userId = sdncModifierDetails.getUserId();
+		Config config = Utils.getConfig();
+		String url = String.format(Urls.UPDATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resource.getUniqueId());
+
+		Map<String, String> headersMap = ResourceRestUtils.prepareHeadersMap(userId);
+
+		Gson gson = new Gson();
+		String userBodyJson = gson.toJson(resourceDetails);
+		String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
+		headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
+		HttpRequest http = new HttpRequest();
+		RestResponse updateResourceResponse = http.httpSendPut(url, userBodyJson, headersMap);
+		BaseRestUtils.checkSuccess(updateResourceResponse);
+		return ResponseParser.parseToObjectUsingMapper(updateResourceResponse.getResponse(), Resource.class);
+	}
+
 	public static Either<Resource, RestResponse> importResourceByFileName(ResourceTypeEnum resourceType, UserRoleEnum userRole, String fileName, Boolean validateState, String... filePath) throws IOException {
 
 		String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars" ;
@@ -838,7 +867,7 @@
 
 		try {
 			User defaultUser = ElementFactory.getDefaultUser(userRole);
-			ResourceReqDetails defaultResource = ElementFactory.getDefaultResource(defaultUser);			
+			ResourceReqDetails defaultResource = ElementFactory.getDefaultResource(defaultUser);
 			ImportReqDetails defaultImportResource = ElementFactory.getDefaultImportResource(defaultResource);
 			ImportUtils.getImportResourceDetailsByPathAndName(defaultImportResource, realFilePath, fileName);
 			RestResponse resourceResp = ResourceRestUtils.createResource(defaultImportResource, defaultUser);
@@ -856,7 +885,7 @@
 			throw new AtomicOperationException(e);
 		}
 	}
-	
+
 	public static Either<String, RestResponse> getComponenetArtifactPayload(Component component, String artifactType) throws Exception {
 
 		String url;
@@ -894,14 +923,14 @@
 				assertTrue(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS);
 			}
 			return response;
-		
+
 		} catch (Exception e) {
 			throw new AtomicOperationException(e);
 		}
 	}
-	
+
 	public static Either <RestResponse, Map<String, List<DistributionMonitorObject>>> getSortedDistributionStatusMap(Service service, Boolean validateState) {
-		
+
 		try {
 			ServiceDistributionStatus serviceDistributionObject = DistributionUtils.getLatestServiceDistributionObject(service);
 			RestResponse response = getDistributionStatusByDistributionId(serviceDistributionObject.getDistributionID(), true);
@@ -916,10 +945,10 @@
 		} catch (Exception e) {
 			throw new AtomicOperationException(e);
 		}
-		
+
 	}
-	
-	
+
+
 	/**
 	 * @param service
 	 * @param pollingCount
@@ -928,13 +957,13 @@
 	 * @throws Exception
 	 */
 	public static Boolean distributeAndValidateService(Service service, int pollingCount, int pollingInterval) throws Exception {
-        int firstPollingInterval = 30000; //this value define first be polling topic time, should change if DC configuration changed  
+		int firstPollingInterval = 30000; //this value define first be polling topic time, should change if DC configuration changed
 		Boolean statusFlag = true;
 		AtomicOperationUtils.distributeService(service,  true);
 		TimeUnit.MILLISECONDS.sleep(firstPollingInterval);
 		int timeOut = pollingCount * pollingInterval;
 		com.clearspring.analytics.util.Pair<Boolean,Map<String,List<String>>> verifyDistributionStatus = null;
-		
+
 		while (timeOut > 0) {
 			Map<String,List<DistributionMonitorObject>> sortedDistributionStatusMap = AtomicOperationUtils.getSortedDistributionStatusMap(service, true).right().value();
 			verifyDistributionStatus = DistributionUtils.verifyDistributionStatus(sortedDistributionStatusMap);
@@ -945,7 +974,7 @@
 				timeOut = 0;
 			}
 		}
-		
+
 		if((verifyDistributionStatus.right != null && ! verifyDistributionStatus.right.isEmpty())){
 			for(Entry<String, List<String>> entry : verifyDistributionStatus.right.entrySet()){
 				if(ComponentBaseTest.getExtendTest() != null){
@@ -958,9 +987,33 @@
 		}
 		return statusFlag;
 	}
-	
+
 	public static Boolean distributeAndValidateService(Service service) throws Exception {
 		return distributeAndValidateService(service, 10, 10000);
 	}
+	
+	  /**
+     * @param resource to download csar file via API
+     * @return Tosca definition object from main yaml file
+     */
+    public static ToscaDefinition downloadAndGetToscaMainYamlObjectApi(Resource resource, File filesFolder) throws Exception {
+        File vfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+        OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + vfCsarFileName));
+        return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + vfCsarFileName));
+    }
+
+
+    public static ComponentInstance getServiceComponentInstanceByName(Service service, String name, Boolean validateState){
+        List<ComponentInstance> compInstances = service.getComponentInstances();
+        for (ComponentInstance instance: compInstances){
+            String compName = instance.getName();
+            if (compName.equals(name))
+                return instance;
+        }
+        if (validateState) {
+            assertEquals("Component instance name " + name + " not found", name, null);
+        }
+        return null;
+    }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
index cbae462..031d2d8 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
@@ -20,24 +20,13 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
-import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.commons.lang3.StringUtils;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.model.LifecycleStateEnum;
 import org.openecomp.sdc.be.model.Product;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.*;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit;
@@ -46,6 +35,13 @@
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.api.Constants;
 
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
+
 public class Convertor {
 	// ***** resource *****
 	public static ResourceRespJavaObject constructFieldsForRespValidation(ResourceReqDetails resourceDetails,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
index d170124..e303682 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
@@ -24,6 +24,8 @@
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
@@ -287,26 +289,26 @@
 
 	// *** SERVICE ***
 	public static ServiceReqDetails getDefaultService() {
-		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, "al1976");
+		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, "al1976", ServiceInstantiationType.A_LA_CARTE.getValue());
 	}
 
 	public static ServiceReqDetails getDefaultService(String contactId) {
-		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, contactId);
+		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, contactId, ServiceInstantiationType.A_LA_CARTE.getValue());
 	}
 
 	public static ServiceReqDetails getDefaultService(User user) {
-		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, user.getUserId());
+		return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, user.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
 	}
-
-	public static ServiceReqDetails getServiceByCategory(ServiceCategoriesEnum category) {
-		return getDefaultService(CI_SERVICE, category, "al1976");
-	}
-
+	
 	public static ServiceReqDetails getDefaultService(ServiceCategoriesEnum category, User user) {
-		return getDefaultService(CI_SERVICE, category, user.getUserId());
+		return getDefaultService(CI_SERVICE, category, user.getUserId(), ServiceInstantiationType.A_LA_CARTE.getValue());
+	}
+	
+	public static ServiceReqDetails getServiceByCategory(ServiceCategoriesEnum category) {
+		return getDefaultService(CI_SERVICE, category, "al1976", ServiceInstantiationType.A_LA_CARTE.getValue());
 	}
 
-	public static ServiceReqDetails getDefaultService(String serviceName, ServiceCategoriesEnum category, String contactId) {
+	public static ServiceReqDetails getDefaultService(String serviceName, ServiceCategoriesEnum category, String contactId, String instantiationType) {
 		serviceName = (serviceName + generateUUIDforSufix());
 		ArrayList<String> tags = new ArrayList<>();
 		tags.add("serviceTag");
@@ -315,7 +317,7 @@
 		String description = "service Description";
 		String icon = "defaulticon";
 
-		ServiceReqDetails serviceDetails = new ServiceReqDetails(serviceName, category.getValue(), tags, description, contactId, icon);
+		ServiceReqDetails serviceDetails = new ServiceReqDetails(serviceName, category.getValue(), tags, description, contactId, icon, instantiationType);
 
 		return serviceDetails;
 	}
@@ -375,7 +377,7 @@
 
 	public static ComponentInstanceReqDetails getDefaultComponentInstance(String name) {
 		String resourceUid = "resourceId";
-		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, name);
+		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, name, null);
 
 		return resourceInstanceDetails;
 
@@ -383,7 +385,7 @@
 
 	public static ComponentInstanceReqDetails getDefaultComponentInstance(String name, ComponentReqDetails componentReqDetails) {
 		String resourceUid = componentReqDetails.getUniqueId();
-		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, name);
+		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, name, null);
 
 		return resourceInstanceDetails;
 
@@ -392,7 +394,7 @@
 	public static ComponentInstanceReqDetails getComponentResourceInstance(ComponentReqDetails compInstOriginDetails) {
 		String compInstName = (compInstOriginDetails.getName() != null ? compInstOriginDetails.getName() : "resourceInstanceName");
 		String resourceUid = compInstOriginDetails.getUniqueId();
-		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, compInstName);
+		ComponentInstanceReqDetails resourceInstanceDetails = new ComponentInstanceReqDetails(resourceUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, compInstName, null);
 		return resourceInstanceDetails;
 
 	}
@@ -400,7 +402,7 @@
 	public static ComponentInstanceReqDetails getComponentInstance(Component compInstOriginDetails) {
 		String compInstName = (compInstOriginDetails.getName() != null ? compInstOriginDetails.getName() : "componentInstanceName");
 		String compInsUid = compInstOriginDetails.getUniqueId();
-		ComponentInstanceReqDetails componentInstanceDetails = new ComponentInstanceReqDetails(compInsUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, compInstName);
+		ComponentInstanceReqDetails componentInstanceDetails = new ComponentInstanceReqDetails(compInsUid, RESOURCE_INSTANCE_DESCRIPTION, RESOURCE_INSTANCE_POS_X, RESOURCE_INSTANCE_POS_Y, compInstName, compInstOriginDetails.getComponentType() == ComponentTypeEnum.SERVICE ? OriginTypeEnum.ServiceProxy.name() : null);
 		return componentInstanceDetails;
 
 	}
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 7af18dd..7261033 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
@@ -21,29 +21,6 @@
 package org.openecomp.sdc.ci.tests.utils.general;
 
 import com.aventstack.extentreports.Status;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-
 import org.apache.commons.io.FileUtils;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -51,7 +28,6 @@
 import org.openecomp.sdc.common.util.GeneralUtility;
 import org.yaml.snakeyaml.Yaml;
 
-import com.aventstack.extentreports.Status;
 import java.io.*;
 import java.nio.file.Paths;
 import java.util.*;
@@ -342,9 +318,10 @@
 		File dir = new File(directoryPath);
 		try {
 			FileUtils.cleanDirectory(dir);
+		} catch (IllegalArgumentException e) {
+			System.out.println("Failed to clean " + dir);
 		} catch (IOException e) {
-			System.out.println("Failed to delete " + dir);
-			ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir);
+			System.out.println("Failed to clean " + dir);
 		}
 	}
 	
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
index f0ca9dd..226c734 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
@@ -20,7 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import static org.testng.AssertJUnit.assertTrue;
+import fj.data.Either;
+import org.openecomp.sdc.ci.tests.utils.Decoder;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
@@ -31,12 +35,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.openecomp.sdc.ci.tests.utils.Decoder;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class FileUtils {
 	static Logger logger = LoggerFactory.getLogger(Utils.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
index 7e5a7d6..3b1dcda 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
@@ -20,11 +20,11 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
+import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
+
 import java.io.IOException;
 import java.util.List;
 
-import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-
 public class ImportUtils {
 
 	public static ImportReqDetails getImportResourceDetailsByPathAndName(ImportReqDetails importReqDetails,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
index 5f9ec1b..f9ce645 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
@@ -20,23 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
 import com.google.gson.Gson;
 import fj.data.Either;
-
 import org.apache.commons.codec.binary.Base64;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.Resource;
@@ -55,61 +40,22 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
 
-import com.clearspring.analytics.util.Pair;
-import com.google.gson.Gson;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class OnboardingUtillViaApis {
 
-//	protected static Map<String, String> prepareHeadersMap(String userId) {
-//		Map<String, String> headersMap = new HashMap<String, String>();
-//		headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
-//		headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
-//		headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
-//		return headersMap;
-//	}
-
-	public static Pair<String, VendorSoftwareProductObject> createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception {
-
-		VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
+	public static VendorSoftwareProductObject createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception {
 
 		AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user);
-		Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers);
-		VendorSoftwareProductObject map = createVendorSoftwareProduct.right;
-		vendorSoftwareProductObject.setAttContact(map.getAttContact());
-		vendorSoftwareProductObject.setCategory(map.getCategory());
-		vendorSoftwareProductObject.setComponentId(map.getComponentId());
-		vendorSoftwareProductObject.setDescription(map.getDescription());
-		vendorSoftwareProductObject.setSubCategory(map.getSubCategory());
-		vendorSoftwareProductObject.setVendorName(map.getVendorName());
-		vendorSoftwareProductObject.setVspId(map.getVspId());
-		Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject);
-		return pair;
+		return VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers);
 	}
 	
-/*	public static Resource createResourceFromVSP(Pair<String, Map<String, String>> createVendorSoftwareProduct, String vspName) throws Exception {
-		List<String> tags = new ArrayList<>();
-		tags.add(vspName);
-		Map<String, String> map = createVendorSoftwareProduct.right;
-		ResourceReqDetails resourceDetails = new ResourceReqDetails();
-		resourceDetails.setCsarUUID(map.get("vspId"));
-		resourceDetails.setCsarVersion("1.0");
-		resourceDetails.setName(vspName);
-		resourceDetails.setTags(tags);
-		resourceDetails.setDescription(map.get("description"));
-		resourceDetails.setResourceType(map.get("componentType"));
-		resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
-		resourceDetails.setVendorName(map.get("vendorName"));
-		resourceDetails.setVendorRelease("1.0");
-		resourceDetails.setResourceType("VF");
-		resourceDetails.setResourceVendorModelNumber("666");
-		resourceDetails.setContactId(map.get("attContact"));
-		resourceDetails.setIcon("defaulticon");
-		Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
-		
-		return resource; 
-	}*/
 	public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception {
 		Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
 		return resource;
@@ -133,28 +79,6 @@
 		}
 	}
 	
-//	public static void convertPayloadToFile(String payload, File file, boolean isBased64, boolean isSdcFormat) throws IOException{
-//		
-//		Gson gson = new Gson();
-//		byte[] byteArray = null;
-//		Map<String, String> fromJson;
-//		@SuppressWarnings("unchecked")
-//		String string = null;// = fromJson.get("base64Contents").toString();
-//		if(isSdcFormat){
-//			fromJson = gson.fromJson(payload, Map.class);
-//			string = fromJson.get("base64Contents").toString();
-//		}else if (isBased64) {
-//			byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
-//		}else{
-//			byteArray = payload.getBytes(StandardCharsets.UTF_8);
-//		}
-//		File downloadedFile = new File(file.getAbsolutePath());
-//		FileOutputStream fos = new FileOutputStream(downloadedFile);
-//		fos.write(byteArray);
-//		fos.flush();
-//		fos.close();
-//		
-//	}
 
 	public static void convertPayloadToFile(String payload, File file) throws IOException{
 		
@@ -180,49 +104,8 @@
 		fos.flush();
 		fos.close();
 		
-		
-//		ZipOutputStream fos = null;
-//		
-//		
-//		for (Charset charset : Charset.availableCharsets().values()) {
-//			try{
-//		//		System.out.println("How to do it???");
-//				File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar");
-//				fos = new ZipOutputStream(new FileOutputStream(downloadedFile));
-//				byte[] byteArray = payload.getBytes(charset);
-//				fos.write(byteArray);
-//				fos.flush();
-//				
-//			}
-//			catch(Exception e){
-//				fos.close();
-//			}
-//		}
 		System.out.println("");
 		
-//		ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray));
-//		ZipEntry entry = null;
-//		while ((entry = zipStream.getNextEntry()) != null) {
-//
-//		    String entryName = entry.getName();
-//
-//		    FileOutputStream out = new FileOutputStream(file+"/"+entryName);
-//
-//		    byte[] byteBuff = new byte[4096];
-//		    int bytesRead = 0;
-//		    while ((bytesRead = zipStream.read(byteBuff)) != -1)
-//		    {
-//		        out.write(byteBuff, 0, bytesRead);
-//		    }
-//
-//		    out.close();
-//		    zipStream.closeEntry();
-//		}
-//		zipStream.close();
-//		
-		
-		
-		
 		BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1)));
 		String filePath = file.toString();
 		BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)));
@@ -232,7 +115,7 @@
 		bos.close();
 	}
 	
-	public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception {
+	public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws IOException {
 
 		Config config = Utils.getConfig();
 		String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getOnboardingBeHost(), config.getOnboardingBePort(), vspId);
@@ -257,19 +140,15 @@
 
 		List<String> tags = new ArrayList<>();
 		tags.add(vendorSoftwareProductObject.getName());
-//		ResourceReqDetails resourceDetails = new ResourceReqDetails();
 		resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId());
 		resourceDetails.setCsarVersion(vendorSoftwareProductObject.getVersion());
 		resourceDetails.setName(vendorSoftwareProductObject.getName());
 		resourceDetails.setTags(tags);
 		resourceDetails.setDescription(vendorSoftwareProductObject.getDescription());
-//		resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
 		resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName());
-//		resourceDetails.setVendorRelease("1.0");
 		resourceDetails.setResourceType("VF");
 		resourceDetails.setResourceVendorModelNumber("666");
 		resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact());
-//		resourceDetails.setIcon("defaulticon");
 
 		return resourceDetails;
 	}
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 6c3a3c4..4f03767 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
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java
index 7103892..366962e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java
@@ -20,56 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.general;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.nio.file.FileSystems;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.entity.mime.content.FileBody;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONValue;
-import org.openecomp.sdc.be.model.User;
-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 com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
-
 enum SnmpTypeEnum{
     SNMP_POLL ("snmp"),
     SNMP_TRAP ("snmp-trap");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
index 51e4923..eca8921 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
@@ -41,18 +41,18 @@
 
 public class VendorSoftwareProductRestUtils {
 
-    public static Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts)
+    public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts)
             throws Exception {
 
-        Pair<String, VendorSoftwareProductObject> pair = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers);
+        VendorSoftwareProductObject vendorSoftwareProductObject = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers);
         if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){
-            addCvfcArtifacts(cvfcArtifacts, user, pair.right);
+            addCvfcArtifacts(cvfcArtifacts, user, vendorSoftwareProductObject);
         }
-        prepareVspForUse(user, pair.right, true);
-        return pair;
+        prepareVspForUse(user, vendorSoftwareProductObject, true);
+        return vendorSoftwareProductObject;
     }
 
-    public static Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
+    public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
             throws Exception {
 
         Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>();
@@ -83,14 +83,14 @@
     public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts)
             throws Exception {
 
-        Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts);
+        VendorSoftwareProductObject createVendorSoftwareProduct = createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts);
         VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct);
         return vendorSoftwareProductObject;
 
     }
 
 
-    public static Pair<String, VendorSoftwareProductObject> createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception {
+    public static VendorSoftwareProductObject createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception {
         String vspName = handleFilename(heatFileName);
 
         if(ComponentBaseTest.getExtendTest() != null){
@@ -106,8 +106,7 @@
         RestResponse validateUpload = validateUpload(createNewVspPair.right, user);
         assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue());
 
-        Pair<String, VendorSoftwareProductObject> pair = new Pair<>(vspName, createNewVspPair.right);
-        return pair;
+        return createNewVspPair.right;
     }
 
     public static void updateVspWithVfcArtifacts(String filepath, String updatedSnmpPoll, String updatedSnmpTrap, String componentInstanceId, User user, VendorSoftwareProductObject vendorSoftwareProductObject) throws Exception{
@@ -288,6 +287,19 @@
         return response;
     }
 
+//    TODO to check if for onboard API ACTION_ARCHIVE_RESTORE_COMPONENT format was added version parameter
+//    if yes remove this method and use general actionOnComponent method
+    private static RestResponse actionOnComponent(String vspid, String body, String onboardComponent, User user) throws Exception {
+        Config config = Utils.getConfig();
+        String url = String.format(Urls.ACTION_ARCHIVE_RESTORE_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), onboardComponent, vspid);
+        String userId = user.getUserId();
+        Map<String, String> headersMap = OnboardingUtils.prepareHeadersMap(userId);
+
+        HttpRequest http = new HttpRequest();
+        RestResponse response = http.httpSendPut(url, body, headersMap);
+        return response;
+    }
+
     public static Pair<RestResponse, VendorSoftwareProductObject> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception {
 
         Config config = Utils.getConfig();
@@ -317,6 +329,7 @@
 
         vendorSoftwareProductObject.setVspId(ResponseParser.getValueFromJsonResponse(response.getResponse(), "itemId"));
         vendorSoftwareProductObject.setComponentId(ResponseParser.getValueFromJsonResponse(response.getResponse(), "version:id"));
+//		vendorSoftwareProductObject.setVersion(ResponseParser.getValueFromJsonResponse(response.getResponse(), "version:name"));
         vendorSoftwareProductObject.setAttContact(user.getUserId());
 
         return new Pair<>(response, vendorSoftwareProductObject);
@@ -659,17 +672,16 @@
 //	}
 
 
-    public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct) {
+    private static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, VendorSoftwareProductObject createVendorSoftwareProduct) {
         VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
-        VendorSoftwareProductObject map = createVendorSoftwareProduct.right;
-        vendorSoftwareProductObject.setAttContact(map.getAttContact());
-        vendorSoftwareProductObject.setCategory(map.getCategory());
-        vendorSoftwareProductObject.setComponentId(map.getComponentId());
-        vendorSoftwareProductObject.setDescription(map.getDescription());
-        vendorSoftwareProductObject.setSubCategory(map.getSubCategory());
-        vendorSoftwareProductObject.setVendorName(map.getVendorName());
-        vendorSoftwareProductObject.setVspId(map.getVspId());
-        vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
+        vendorSoftwareProductObject.setAttContact(createVendorSoftwareProduct.getAttContact());
+        vendorSoftwareProductObject.setCategory(createVendorSoftwareProduct.getCategory());
+        vendorSoftwareProductObject.setComponentId(createVendorSoftwareProduct.getComponentId());
+        vendorSoftwareProductObject.setDescription(createVendorSoftwareProduct.getDescription());
+        vendorSoftwareProductObject.setSubCategory(createVendorSoftwareProduct.getSubCategory());
+        vendorSoftwareProductObject.setVendorName(createVendorSoftwareProduct.getVendorName());
+        vendorSoftwareProductObject.setVspId(createVendorSoftwareProduct.getVspId());
+        vendorSoftwareProductObject.setName(createVendorSoftwareProduct.getName());
         String[] arrFileNameAndExtension = vnfFile.split("\\.");
         vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage");
         vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]);
@@ -692,5 +704,14 @@
         prepareVspForUse(user,vendorSoftwareProductObject, true);
     }
 
+    public static RestResponse archiveVendorSoftwareProduct(VendorSoftwareProductObject vendorSoftwareProductObject, User user) throws Exception {
+        String messageBody = "{\"action\":\"ARCHIVE\"}";
+        return actionOnComponent(vendorSoftwareProductObject.getVspId(), messageBody, "items", user);
+    }
+
+    public static RestResponse restoreVendorSoftwareProduct(VendorSoftwareProductObject vendorSoftwareProductObject, User user) throws Exception {
+        String messageBody = "{\"action\":\"RESTORE\"}";
+        return actionOnComponent(vendorSoftwareProductObject.getVspId(), messageBody, "items", user);
+    }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
index 448442e..7daf1bd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
@@ -20,23 +20,12 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
@@ -55,7 +44,13 @@
 import org.slf4j.LoggerFactory;
 import org.testng.AssertJUnit;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class ArtifactRestUtils extends BaseRestUtils {
 	private static Logger logger = LoggerFactory.getLogger(ArtifactRestUtils.class.getName());
@@ -344,10 +339,10 @@
 	
 	
 	
-	public static RestResponse downloadResourceInstanceArtifact(String serviceUniqueId,String resourceInstanceId, User user, String artifactUniqeId) throws Exception
+	public static RestResponse downloadResourceInstanceArtifact(String serviceUniqueId,String resourceInstanceId, User user, String artifactUniqueId) throws Exception
 	{
 		Config config = Utils.getConfig();
-		String url = String.format(Urls.DOWNLOAD_COMPONENT_INSTANCE_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUniqueId, resourceInstanceId, artifactUniqeId);
+		String url = String.format(Urls.DOWNLOAD_COMPONENT_INSTANCE_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUniqueId, resourceInstanceId, artifactUniqueId);
 		RestResponse res =  sendGet(url, user.getUserId(), null);
 		return res;
 	}
@@ -906,4 +901,18 @@
 	}
 
 
+	/**
+	 * @param restResponse restResponse object
+	 * @return readable content(converted from base64)
+	 * @throws IOException ioexception
+	 */
+	public static String getDecodedArtifactPayloadFromResponse(RestResponse restResponse) throws IOException {
+		Gson gson = new Gson();
+		Map<String, String> fromJson = gson.fromJson(restResponse.getResponse(), Map.class);
+		String payloadData = fromJson.get("base64Contents").toString();
+		String decodedPaypload = org.openecomp.sdc.ci.tests.utils.Decoder.decode(payloadData);
+		return decodedPaypload;
+	}
+
+
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
index 13cfb8f..ad70c34 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
@@ -20,42 +20,21 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.*;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactAssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.AssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceDetailedAssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceInstanceAssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceAssetStructure;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceDetailedAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.*;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
@@ -66,11 +45,17 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class AssetRestUtils extends BaseRestUtils {
 	static Gson gson = new Gson();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java
index 65ab6c9..8d39bd1 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java
@@ -20,15 +20,15 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.Utils;
-
 public class AutomationUtils extends BaseRestUtils {
 	
 	
@@ -63,24 +63,24 @@
 	
 	public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData, String suiteName) throws IOException {
 		File myFoo = new File(filepath);
-		FileOutputStream fooStream = new FileOutputStream(myFoo, false); // true to append
-		String versions =  ("onboardVersion=\""+ onboardVersion+ "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\""+ envData + "\"\n" + "suiteName=\""+ suiteName+ "\"\n");
-		byte[] myBytes = versions.getBytes();
-		fooStream.write(myBytes);
-		fooStream.close();
+		try (FileOutputStream fooStream = new FileOutputStream(myFoo, false)) {
+			String versions = ("onboardVersion=\"" + onboardVersion + "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n");
+			byte[] myBytes = versions.getBytes();
+			fooStream.write(myBytes);
+		}
 	}
 
 	public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData, String suiteName, String reportStartTime) throws IOException {
 		File myFoo = new File(filepath);
-		FileOutputStream fooStream = new FileOutputStream(myFoo, false); // true to append
-		String versions =  ("onboardVersion=\""+ onboardVersion+ "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\""+ envData + "\"\n" + "suiteName=\""+ suiteName+ "\"\n" + "reportStartTime=\""+ reportStartTime+ "\"\n");
-		byte[] myBytes = versions.getBytes();
-		fooStream.write(myBytes);
-		fooStream.close();
+		try (FileOutputStream fooStream = new FileOutputStream(myFoo, false)) {
+			String versions = ("onboardVersion=\"" + onboardVersion + "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n" + "reportStartTime=\"" + reportStartTime + "\"\n");
+			byte[] myBytes = versions.getBytes();
+			fooStream.write(myBytes);
+		}
 	}
 	
 	public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData)
-			throws FileNotFoundException, IOException {
+			throws IOException {
 		createVersionsInfoFile(filepath, onboardVersion, osVersion, envData, null);
 	}
 	
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
index 4ec0353..56859ff 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.commons.codec.binary.Base64;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -40,6 +33,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class BaseRestUtils extends BaseValidationUtils {
 	public static final String contentTypeHeaderData = "application/json";
 	public static final String acceptHeaderData = "application/json";
@@ -84,7 +84,7 @@
 
 	// ************* PRIVATE METHODS ************************
 
-	protected static Map<String, String> prepareHeadersMap(String userId) {
+	public static Map<String, String> prepareHeadersMap(String userId) {
 		return prepareHeadersMap(userId, acceptHeaderData);
 	}
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java
index b09ba10..304df86 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java
@@ -20,10 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -31,6 +27,10 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 public class CatalogRestUtils extends BaseRestUtils {
 
 	public static RestResponse getAbstractResources() throws IOException {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
index 460518b..3e1413a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
@@ -20,10 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
@@ -35,8 +33,9 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
 public class CategoryRestUtils extends BaseRestUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
index 64b576e..e59c13b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
@@ -20,19 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
@@ -40,7 +30,12 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertTrue;
 
 public class ComponentInstanceRestUtils extends BaseRestUtils {
 //	public static String acceptHeaderDate = "application/json";
@@ -272,5 +267,15 @@
 		return changeResourceInstanceVersion;
 
 	}
+	public static CapReqDef getInstancesCapabilitiesRequirements(Component component, String userId) throws Exception {
+
+		String url = String.format(Urls.GET_INSTANCE_REQUIRMENTS_CAPABILITIES,
+				Utils.getConfig().getCatalogBeHost(), Utils.getConfig().getCatalogBePort(),
+				ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId());
+
+		RestResponse getComponentReqCap = sendGet(url, userId);
+		assertTrue(getComponentReqCap.getErrorCode() == STATUS_CODE_GET_SUCCESS);
+		return ResponseParser.parseToObject(getComponentReqCap.getResponse(), CapReqDef.class);
+	}
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
index dcebe4a..8fcc679 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.model.CapReqDef;
 import org.openecomp.sdc.be.model.User;
@@ -34,6 +32,8 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
+import java.io.IOException;
+
 public class ComponentRestUtils extends BaseRestUtils {
 	public static RestResponse getComponentRequirmentsCapabilities(User sdncModifierDetails,
 			ComponentReqDetails componentReqDetails) throws IOException {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
index 9fdab02..949ab68 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
@@ -20,11 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.openecomp.portalsdk.core.restful.domain.EcompRole;
 import org.openecomp.portalsdk.core.restful.domain.EcompUser;
 import org.openecomp.sdc.ci.tests.api.Urls;
@@ -37,7 +33,10 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 public class EcompUserRestUtils extends BaseRestUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/GroupRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/GroupRestUtils.java
index f55cdbd..e491b3b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/GroupRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/GroupRestUtils.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.User;
@@ -33,7 +30,9 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 public class GroupRestUtils extends BaseRestUtils {
 	static Config config = Config.instance();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
index 40dc060..0edc294 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
@@ -20,22 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-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.io.InputStream;
-import java.io.StringWriter;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.ClientProtocolException;
@@ -64,6 +48,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.*;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+
 public class ImportRestUtils extends BaseRestUtils {
 
 	private static Logger log = LoggerFactory.getLogger(ImportRestUtils.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/InputsRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/InputsRestUtils.java
index de7be07..521da28 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/InputsRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/InputsRestUtils.java
@@ -20,6 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.ComponentInstInputsMap;
@@ -33,8 +34,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-
 /**
  * RestUtils for inputs
  * 
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 9c0b7a8..44e7b56 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
@@ -20,19 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.json.simple.JSONObject;
 import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.DistributionStatusEnum;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.Product;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
@@ -48,6 +39,11 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 public class LifecycleRestUtils extends BaseRestUtils {
 	private static Logger logger = LoggerFactory.getLogger(LifecycleRestUtils.class.getName());
 	public static final String COMMENT = "comment";
@@ -78,10 +74,10 @@
 		return changeLifeCycleOfAsset(serviceUUID, AssetTypeEnum.SERVICES, LifeCycleStatesEnum.CERTIFICATIONREQUEST, sdncModifierDetails, comment);
 	}
 	
-	public static RestResponse certificationRequestResource(String resourceUUID, User sdncModifierDetails) throws IOException {
+	/*public static RestResponse certificationRequestResource(String resourceUUID, User sdncModifierDetails) throws IOException {
 		String comment = "Certification request resource: " + resourceUUID;
 		return changeLifeCycleOfAsset(resourceUUID, AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.CERTIFICATIONREQUEST, sdncModifierDetails, comment);
-	}
+	}*/
 	
 	public static RestResponse startTestingService(String serviceUUID, User sdncModifierDetails) throws IOException {
 		String comment = "Start testing request service: " + serviceUUID;
@@ -277,10 +273,12 @@
 	}
 
 	public static RestResponse certifyResource(ResourceReqDetails resourceDetails) throws Exception {
+
+		User designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
 		RestResponse restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN);
 		// if (restResponseResource.getErrorCode() == 200){
-		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
+/*		restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails,
 				ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
 		// }else
 		// return restResponseResource;
@@ -289,16 +287,16 @@
 			restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, testerDetails,
 					LifeCycleStatesEnum.STARTCERTIFICATION);
 		} else
-			return restResponseResource;
+			return restResponseResource;*/
 		if (restResponseResource.getErrorCode() == 200) {
-			restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, testerDetails,
+			restResponseResource = LifecycleRestUtils.changeResourceState(resourceDetails, designer,
 					LifeCycleStatesEnum.CERTIFY);
 			if (restResponseResource.getErrorCode() == 200) {
 				String newVersion = ResponseParser.getVersionFromResponse(restResponseResource);
 				resourceDetails.setVersion(newVersion);
 				resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
-				resourceDetails.setLastUpdaterUserId(testerDetails.getUserId());
-				resourceDetails.setLastUpdaterFullName(testerDetails.getFullName());
+				resourceDetails.setLastUpdaterUserId(designer.getUserId());
+				resourceDetails.setLastUpdaterFullName(designer.getFullName());
 				String uniqueIdFromRresponse = ResponseParser.getUniqueIdFromResponse(restResponseResource);
 				resourceDetails.setUniqueId(uniqueIdFromRresponse);
 			}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
index 65bc2f5..1a59a31 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
@@ -20,8 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.model.LifecycleStateEnum;
 import org.openecomp.sdc.be.model.Product;
@@ -37,7 +36,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
+import java.io.IOException;
 
 public class ProductRestUtils extends BaseRestUtils {
 	private static Gson gson = new Gson();
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
index d507c2c..d5ae0a4 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
@@ -27,14 +27,11 @@
 import org.openecomp.sdc.ci.tests.config.Config;
 import org.openecomp.sdc.ci.tests.datatypes.PropertyObject;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
-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.HttpRequest;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.common.util.GeneralUtility;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.openecomp.sdc.ci.tests.datatypes.PropertyObject;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -43,322 +40,319 @@
 
 import static org.testng.AssertJUnit.*;
 
-import com.google.gson.Gson;
-
 public class PropertyRestUtils extends BaseRestUtils {
-	private static Logger logger = LoggerFactory.getLogger(PropertyRestUtils.class.getName());
+    private static Logger logger = LoggerFactory.getLogger(PropertyRestUtils.class.getName());
 
-	public static RestResponse createProperty(String resourceId, String body, User user) throws Exception {
-		Config config = Config.instance();
-		String url = String.format(Urls.CREATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
-				resourceId);
+    public static RestResponse createProperty(String resourceId, String body, User user) throws Exception {
+        Config config = Config.instance();
+        String url = String.format(Urls.CREATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
 
-		return sendPost(url, body, user.getUserId(), acceptHeaderData);
-	}
+        return sendPost(url, body, user.getUserId(), acceptHeaderData);
+    }
 
-	public static RestResponse updateProperty(String resourceId, String propertyId, String body, User user)
-			throws Exception {
-		Config config = Config.instance();
+    public static RestResponse updateProperty(String resourceId, String propertyId, String body, User user)
+            throws Exception {
+        Config config = Config.instance();
 
-		String url = String.format(Urls.UPDATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
-				resourceId, propertyId);
-		return sendPut(url, body, user.getUserId(), acceptHeaderData);
-	}
+        String url = String.format(Urls.UPDATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
+                resourceId, propertyId);
+        return sendPut(url, body, user.getUserId(), acceptHeaderData);
+    }
 
-	public static RestResponse updateGroupProperty(Component component, String groupId, String body, User user)
-			throws Exception {
-		Config config = Config.instance();
+    public static RestResponse updateGroupProperty(Component component, String groupId, String body, User user)
+            throws Exception {
+        Config config = Config.instance();
 
-		String url = String.format(Urls.RESOURCE_GROUP_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), component.getUniqueId(), groupId);
-		return sendPut(url, body, user.getUserId(), acceptHeaderData);
-	}
+        String url = String.format(Urls.RESOURCE_GROUP_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), component.getUniqueId(), groupId);
+        return sendPut(url, body, user.getUserId(), acceptHeaderData);
+    }
 
-	public static RestResponse getProperty(String resourceId, String propertyId, User user) throws Exception {
-		Config config = Config.instance();
-		String url = String.format(Urls.GET_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId,
-				propertyId);
-		return sendGet(url, user.getUserId());
-	}
+    public static RestResponse getProperty(String resourceId, String propertyId, User user) throws Exception {
+        Config config = Config.instance();
+        String url = String.format(Urls.GET_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId,
+                propertyId);
+        return sendGet(url, user.getUserId());
+    }
 
-	public static RestResponse deleteProperty(String resourceId, String propertyId, User user) throws Exception {
-		Config config = Config.instance();
-		String url = String.format(Urls.DELETE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
-				resourceId, propertyId);
+    public static RestResponse deleteProperty(String resourceId, String propertyId, User user) throws Exception {
+        Config config = Config.instance();
+        String url = String.format(Urls.DELETE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
+                resourceId, propertyId);
 
-		return sendDelete(url, user.getUserId());
-	}
+        return sendDelete(url, user.getUserId());
+    }
 
-	public static ComponentInstanceProperty getPropFromListByPropNameAndType(List<ComponentInstanceProperty> propList,
-			String propNameToUpdate, String propTypeToUpdate) {
-		for (ComponentInstanceProperty componentInstanceProperty : propList) {
-			if (componentInstanceProperty.getName().equals(propNameToUpdate)
-					&& componentInstanceProperty.getType().equals(propTypeToUpdate)) {
-				return componentInstanceProperty;
-			}
-		}
-		return null;
-	}
+    public static ComponentInstanceProperty getPropFromListByPropNameAndType(List<ComponentInstanceProperty> propList,
+                                                                             String propNameToUpdate, String propTypeToUpdate) {
+        for (ComponentInstanceProperty componentInstanceProperty : propList) {
+            if (componentInstanceProperty.getName().equals(propNameToUpdate)
+                    && componentInstanceProperty.getType().equals(propTypeToUpdate)) {
+                return componentInstanceProperty;
+            }
+        }
+        return null;
+    }
 
-	public static ComponentInstanceProperty getPropFromListByPropNameTypeAndPath(
-			List<ComponentInstanceProperty> propList, String propNameToUpdate, String propTypeToUpdate,
-			List<String> path) {
-		for (ComponentInstanceProperty componentInstanceProperty : propList) {
-			if (componentInstanceProperty.getPath() == null) {
-				return getPropFromListByPropNameAndType(propList, propNameToUpdate, propTypeToUpdate);
-			}
-			if (componentInstanceProperty.getName().equals(propNameToUpdate)
-					&& componentInstanceProperty.getType().equals(propTypeToUpdate)
-					&& path.containsAll(componentInstanceProperty.getPath())) {
-				return componentInstanceProperty;
-			}
-		}
-		return null;
-	}
+    public static ComponentInstanceProperty getPropFromListByPropNameTypeAndPath(
+            List<ComponentInstanceProperty> propList, String propNameToUpdate, String propTypeToUpdate,
+            List<String> path) {
+        for (ComponentInstanceProperty componentInstanceProperty : propList) {
+            if (componentInstanceProperty.getPath() == null) {
+                return getPropFromListByPropNameAndType(propList, propNameToUpdate, propTypeToUpdate);
+            }
+            if (componentInstanceProperty.getName().equals(propNameToUpdate)
+                    && componentInstanceProperty.getType().equals(propTypeToUpdate)
+                    && path.containsAll(componentInstanceProperty.getPath())) {
+                return componentInstanceProperty;
+            }
+        }
+        return null;
+    }
 
-	public static ComponentInstanceProperty getPropFromListByPropIdAndPath(List<ComponentInstanceProperty> propList,
-			String propId, List<String> path) {
+    public static ComponentInstanceProperty getPropFromListByPropIdAndPath(List<ComponentInstanceProperty> propList,
+                                                                           String propId, List<String> path) {
 
-		for (ComponentInstanceProperty componentInstanceProperty : propList) {
-			if (path != null) {
-				if (componentInstanceProperty.getUniqueId().equals(propId)
-						&& componentInstanceProperty.getPath().equals(path)) {
-					return componentInstanceProperty;
-				}
-			} else {
-				if (componentInstanceProperty.getUniqueId().equals(propId)) {
-					return componentInstanceProperty;
-				}
-			}
-		}
-		return null;
-	}
+        for (ComponentInstanceProperty componentInstanceProperty : propList) {
+            if (path != null) {
+                if (componentInstanceProperty.getUniqueId().equals(propId)
+                        && componentInstanceProperty.getPath().equals(path)) {
+                    return componentInstanceProperty;
+                }
+            } else {
+                if (componentInstanceProperty.getUniqueId().equals(propId)) {
+                    return componentInstanceProperty;
+                }
+            }
+        }
+        return null;
+    }
 
-	public static void comparePropertyLists(List<ComponentInstanceProperty> expectedList,
-			List<ComponentInstanceProperty> actualList, Boolean isUpdate) {
+    public static void comparePropertyLists(List<ComponentInstanceProperty> expectedList,
+                                            List<ComponentInstanceProperty> actualList, Boolean isUpdate) {
 
-		assertTrue(
-				"list size are not equals, expected size is: " + expectedList.size() + " ,actual: " + actualList.size(),
-				expectedList.size() == actualList.size());
-		Boolean flag = false;
-		for (ComponentInstanceProperty expectedcompInstProp : expectedList) {
-			for (ComponentInstanceProperty actualcompInstProp : actualList) {
-				flag = comparePropertyObjects(expectedcompInstProp, actualcompInstProp, isUpdate);
-				if (flag) {
-					break;
-				}
-			}
-		}
-		// System.out.println("expected: " + expectedList + ", actual: " +
-		// actualList);
-		logger.debug("expected: {}, actual: {}",expectedList,actualList);
-		assertTrue("actual lists does not contain all uniqeIds", flag);
-	}
+        assertTrue(
+                "list size are not equals, expected size is: " + expectedList.size() + " ,actual: " + actualList.size(),
+                expectedList.size() == actualList.size());
+        Boolean flag = false;
+        for (ComponentInstanceProperty expectedcompInstProp : expectedList) {
+            for (ComponentInstanceProperty actualcompInstProp : actualList) {
+                flag = comparePropertyObjects(expectedcompInstProp, actualcompInstProp, isUpdate);
+                if (flag) {
+                    break;
+                }
+            }
+        }
+        // System.out.println("expected: " + expectedList + ", actual: " +
+        // actualList);
+        logger.debug("expected: {}, actual: {}", expectedList, actualList);
+        assertTrue("actual lists does not contain all uniqeIds", flag);
+    }
 
-	public static Boolean comparePropertyObjects(ComponentInstanceProperty expectedCompInstProp,
-			ComponentInstanceProperty actualCompInstProp, Boolean isUpdate) {
-		String uniqueId = expectedCompInstProp.getUniqueId();
-		String type = expectedCompInstProp.getType();
-		String defaulValue = expectedCompInstProp.getDefaultValue();
-		if (actualCompInstProp.getUniqueId().equals(uniqueId)
-				&& actualCompInstProp.getPath().equals(expectedCompInstProp.getPath())) {
-			assertTrue("expected type is: " + type + " ,actual: " + actualCompInstProp.getType(),
-					actualCompInstProp.getType().equals(type));
-			if (defaulValue == null) {
-				assertTrue(
-						"expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
-						actualCompInstProp.getDefaultValue() == defaulValue);
-			} else {
-				assertTrue(
-						"expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
-						actualCompInstProp.getDefaultValue().equals(defaulValue));
-			}
-			if (isUpdate) {
-				assertTrue(
-						"actual [Value] parameter " + actualCompInstProp.getName()
-								+ "should equal to expected [Value]: " + actualCompInstProp.getValue() + " ,Value: "
-								+ actualCompInstProp.getValue(),
-						actualCompInstProp.getValue().equals(expectedCompInstProp.getValue()));
-				assertNotNull("valueId is null", actualCompInstProp.getValueUniqueUid());
-			} else {
-				if (defaulValue == null) {
-					assertTrue(
-							"actual [Value] parameter " + actualCompInstProp.getName()
-									+ "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
-									+ " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
-							actualCompInstProp.getValue() == expectedCompInstProp.getDefaultValue());
-				} else {
-					assertTrue(
-							"actual [Value] parameter " + actualCompInstProp.getName()
-									+ "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
-									+ " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
-							actualCompInstProp.getValue().equals(expectedCompInstProp.getDefaultValue()));
-				}
-				assertNull("valueId is not null", actualCompInstProp.getValueUniqueUid());
-			}
-			return true;
-		}
-		return false;
-	}
+    public static Boolean comparePropertyObjects(ComponentInstanceProperty expectedCompInstProp,
+                                                 ComponentInstanceProperty actualCompInstProp, Boolean isUpdate) {
+        String uniqueId = expectedCompInstProp.getUniqueId();
+        String type = expectedCompInstProp.getType();
+        String defaulValue = expectedCompInstProp.getDefaultValue();
+        if (actualCompInstProp.getUniqueId().equals(uniqueId)
+                && actualCompInstProp.getPath().equals(expectedCompInstProp.getPath())) {
+            assertTrue("expected type is: " + type + " ,actual: " + actualCompInstProp.getType(),
+                    actualCompInstProp.getType().equals(type));
+            if (defaulValue == null) {
+                assertTrue(
+                        "expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
+                        actualCompInstProp.getDefaultValue() == defaulValue);
+            } else {
+                assertTrue(
+                        "expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
+                        actualCompInstProp.getDefaultValue().equals(defaulValue));
+            }
+            if (isUpdate) {
+                assertTrue(
+                        "actual [Value] parameter " + actualCompInstProp.getName()
+                                + "should equal to expected [Value]: " + actualCompInstProp.getValue() + " ,Value: "
+                                + actualCompInstProp.getValue(),
+                        actualCompInstProp.getValue().equals(expectedCompInstProp.getValue()));
+                assertNotNull("valueId is null", actualCompInstProp.getValueUniqueUid());
+            } else {
+                if (defaulValue == null) {
+                    assertTrue(
+                            "actual [Value] parameter " + actualCompInstProp.getName()
+                                    + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
+                                    + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
+                            actualCompInstProp.getValue() == expectedCompInstProp.getDefaultValue());
+                } else {
+                    assertTrue(
+                            "actual [Value] parameter " + actualCompInstProp.getName()
+                                    + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
+                                    + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
+                            actualCompInstProp.getValue().equals(expectedCompInstProp.getDefaultValue()));
+                }
+                assertNull("valueId is not null", actualCompInstProp.getValueUniqueUid());
+            }
+            return true;
+        }
+        return false;
+    }
 
-	public static List<ComponentInstanceProperty> addResourcePropertiesToList(Resource resource,
-			List<ComponentInstanceProperty> listToFill) {
-		for (PropertyDefinition prop : resource.getProperties()) {
-			listToFill.add(new ComponentInstanceProperty(prop, null, null));
-		}
-		return listToFill;
-	}
+    public static List<ComponentInstanceProperty> addResourcePropertiesToList(Resource resource,
+                                                                              List<ComponentInstanceProperty> listToFill) {
+        for (PropertyDefinition prop : resource.getProperties()) {
+            listToFill.add(new ComponentInstanceProperty(prop, null, null));
+        }
+        return listToFill;
+    }
 
-	public static List<ComponentInstanceProperty> addComponentInstPropertiesToList(Component component,
-			List<ComponentInstanceProperty> listToFill, String componentId) {
+    public static List<ComponentInstanceProperty> addComponentInstPropertiesToList(Component component,
+                                                                                   List<ComponentInstanceProperty> listToFill, String componentId) {
 
-		if (componentId != null) {
-			List<ComponentInstanceProperty> list = component.getComponentInstancesProperties().get(componentId);
-			for (ComponentInstanceProperty prop : list) {
-				ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null, null);
-				componentInstanceProperty.setPath(prop.getPath());
-				componentInstanceProperty.setValueUniqueUid(prop.getValueUniqueUid());
-				componentInstanceProperty.setValue(prop.getValue());
-				listToFill.add(componentInstanceProperty);
-			}
-		} else {
-			Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = component
-					.getComponentInstancesProperties();
-			for (Map.Entry<String, List<ComponentInstanceProperty>> componentInstanceProperties : componentInstancesProperties
-					.entrySet()) {
-				for (ComponentInstanceProperty prop : componentInstanceProperties.getValue()) {
-					ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null,
-							null);
-					componentInstanceProperty.setPath(prop.getPath());
-					componentInstanceProperty.setValueUniqueUid(prop.getValueUniqueUid());
-					componentInstanceProperty.setValue(prop.getValue());
-					listToFill.add(componentInstanceProperty);
-				}
-			}
-		}
+        if (componentId != null) {
+            List<ComponentInstanceProperty> list = component.getComponentInstancesProperties().get(componentId);
+            for (ComponentInstanceProperty prop : list) {
+                ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null, null);
+                componentInstanceProperty.setPath(prop.getPath());
+                componentInstanceProperty.setValueUniqueUid(prop.getValueUniqueUid());
+                componentInstanceProperty.setValue(prop.getValue());
+                listToFill.add(componentInstanceProperty);
+            }
+        } else {
+            Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = component
+                    .getComponentInstancesProperties();
+            for (Map.Entry<String, List<ComponentInstanceProperty>> componentInstanceProperties : componentInstancesProperties
+                    .entrySet()) {
+                for (ComponentInstanceProperty prop : componentInstanceProperties.getValue()) {
+                    ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null,
+                            null);
+                    componentInstanceProperty.setPath(prop.getPath());
+                    componentInstanceProperty.setValueUniqueUid(prop.getValueUniqueUid());
+                    componentInstanceProperty.setValue(prop.getValue());
+                    listToFill.add(componentInstanceProperty);
+                }
+            }
+        }
 
-		if (component.getComponentType().getValue().equals("Resource")) {
-			for (PropertyDefinition prop : ((Resource) component).getProperties()) {
-				listToFill.add(new ComponentInstanceProperty(prop, null, null));
-			}
-		}
-		return listToFill;
-	}
+        if (component.getComponentType().getValue().equals("Resource")) {
+            for (PropertyDefinition prop : ((Resource) component).getProperties()) {
+                listToFill.add(new ComponentInstanceProperty(prop, null, null));
+            }
+        }
+        return listToFill;
+    }
 
-	public static ComponentInstanceProperty getCompPropInstListByInstIdAndPropName(Component component,
-			ComponentInstance componentInstanceDetails, String name, String type) {
-		List<ComponentInstanceProperty> propList = component.getComponentInstancesProperties()
-				.get(componentInstanceDetails.getUniqueId());
-		if (propList != null) {
-			return getPropFromListByPropNameAndType(propList, name, type);
-		}
-		return null;
-	}
+    public static ComponentInstanceProperty getCompPropInstListByInstIdAndPropName(Component component,
+                                                                                   ComponentInstance componentInstanceDetails, String name, String type) {
+        List<ComponentInstanceProperty> propList = component.getComponentInstancesProperties()
+                .get(componentInstanceDetails.getUniqueId());
+        if (propList != null) {
+            return getPropFromListByPropNameAndType(propList, name, type);
+        }
+        return null;
+    }
 
-	private static void updatePropertyListWithPathParameter(Resource resource, List<String> path,
-			List<ComponentInstanceProperty> expectedPropertyList) {
-		List<PropertyDefinition> propertyList = resource.getProperties();
-		for (PropertyDefinition propertyDefinition : propertyList) {
-			ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameAndType(
-					expectedPropertyList, propertyDefinition.getName(), propertyDefinition.getType());
-			ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
-			propDetailsToAdd.setPath(path);
-			expectedPropertyList.remove(propDetailsToRemove);
-			expectedPropertyList.add(propDetailsToAdd);
-		}
-	}
+    private static void updatePropertyListWithPathParameter(Resource resource, List<String> path,
+                                                            List<ComponentInstanceProperty> expectedPropertyList) {
+        List<PropertyDefinition> propertyList = resource.getProperties();
+        for (PropertyDefinition propertyDefinition : propertyList) {
+            ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameAndType(
+                    expectedPropertyList, propertyDefinition.getName(), propertyDefinition.getType());
+            ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
+            propDetailsToAdd.setPath(path);
+            expectedPropertyList.remove(propDetailsToRemove);
+            expectedPropertyList.add(propDetailsToAdd);
+        }
+    }
 
-	private static void updatePropertyListWithPathParameterOnCompInst(Service service, List<String> path,
-			List<ComponentInstanceProperty> expectedPropertyList) {
-		List<ComponentInstanceProperty> servicePropertyList = new ArrayList<>();
-		servicePropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, servicePropertyList,
-				path.get(0));
+    private static void updatePropertyListWithPathParameterOnCompInst(Service service, List<String> path,
+                                                                      List<ComponentInstanceProperty> expectedPropertyList) {
+        List<ComponentInstanceProperty> servicePropertyList = new ArrayList<>();
+        servicePropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, servicePropertyList,
+                path.get(0));
 
-		for (ComponentInstanceProperty serviceCompInstProperty : servicePropertyList) {
-			ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameTypeAndPath(
-					expectedPropertyList, serviceCompInstProperty.getName(), serviceCompInstProperty.getType(),
-					serviceCompInstProperty.getPath());
-			ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
-			List<String> tempPathList = new ArrayList<String>();
-			for (String tempPath : path) {
-				tempPathList.add(tempPath);
-			}
-			// path parameter can not contain the same service unique ID twice
-			if (propDetailsToAdd.getPath() != null
-					&& !propDetailsToAdd.getPath().get(0).contains(service.getUniqueId())) {
-				if (!propDetailsToAdd.getPath().containsAll(tempPathList)) {
-					tempPathList.addAll(propDetailsToAdd.getPath());
-				}
-			}
-			propDetailsToAdd.setPath(tempPathList);
-			expectedPropertyList.remove(propDetailsToRemove);
-			expectedPropertyList.add(propDetailsToAdd);
-		}
-	}
+        for (ComponentInstanceProperty serviceCompInstProperty : servicePropertyList) {
+            ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameTypeAndPath(
+                    expectedPropertyList, serviceCompInstProperty.getName(), serviceCompInstProperty.getType(),
+                    serviceCompInstProperty.getPath());
+            ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
+            List<String> tempPathList = new ArrayList<String>();
+            for (String tempPath : path) {
+                tempPathList.add(tempPath);
+            }
+            // path parameter can not contain the same service unique ID twice
+            if (propDetailsToAdd.getPath() != null
+                    && !propDetailsToAdd.getPath().get(0).contains(service.getUniqueId())) {
+                if (!propDetailsToAdd.getPath().containsAll(tempPathList)) {
+                    tempPathList.addAll(propDetailsToAdd.getPath());
+                }
+            }
+            propDetailsToAdd.setPath(tempPathList);
+            expectedPropertyList.remove(propDetailsToRemove);
+            expectedPropertyList.add(propDetailsToAdd);
+        }
+    }
 
-	public static void updatePropertyListWithPathOnResource(ComponentInstance componentInstDetails, Resource resource,
-			List<ComponentInstanceProperty> list, Component container) {
-		List<String> path = new ArrayList<>();
-		if (container != null) {
-			List<ComponentInstance> componentInstances = container.getComponentInstances();
-			for (ComponentInstance componentInstance : componentInstances) {
-				if (componentInstance.getNormalizedName().equals(componentInstDetails.getNormalizedName())) {
-					path.add(componentInstance.getUniqueId());
-					break;
-				}
-			}
+    public static void updatePropertyListWithPathOnResource(ComponentInstance componentInstDetails, Resource resource,
+                                                            List<ComponentInstanceProperty> list, Component container) {
+        List<String> path = new ArrayList<>();
+        if (container != null) {
+            List<ComponentInstance> componentInstances = container.getComponentInstances();
+            for (ComponentInstance componentInstance : componentInstances) {
+                if (componentInstance.getNormalizedName().equals(componentInstDetails.getNormalizedName())) {
+                    path.add(componentInstance.getUniqueId());
+                    break;
+                }
+            }
 
-		} else {
-			path.add(componentInstDetails.getUniqueId());
-		}
-		updatePropertyListWithPathParameter(resource, path, list);
-	}
+        } else {
+            path.add(componentInstDetails.getUniqueId());
+        }
+        updatePropertyListWithPathParameter(resource, path, list);
+    }
 
-	public static void updatePropertyListWithPathOnComponentInstance(ComponentInstance componentInstDetails,
-			Service service, List<ComponentInstanceProperty> list) {
-		List<String> path = new ArrayList<>();
-		path.add(componentInstDetails.getUniqueId());
-		updatePropertyListWithPathParameterOnCompInst(service, path, list);
-	}
+    public static void updatePropertyListWithPathOnComponentInstance(ComponentInstance componentInstDetails,
+                                                                     Service service, List<ComponentInstanceProperty> list) {
+        List<String> path = new ArrayList<>();
+        path.add(componentInstDetails.getUniqueId());
+        updatePropertyListWithPathParameterOnCompInst(service, path, list);
+    }
 
-	public static RestResponse declareProporties(Component componentObject, Map<String, List<ComponentInstanceInput>> componentInstancesInputs, User sdncModifierDetails)
-			throws Exception {
-		Config config = Config.instance();
-		String url = String.format(Urls.DECLARE_PROPERTIES, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentObject.getComponentType()), componentObject.getUniqueId());
-		String userId = sdncModifierDetails.getUserId();
-		Map<String, String> headersMap = prepareHeadersMap(userId);
-		Map<String, Object> jsonBuilder = new HashMap<>();
-		jsonBuilder.put("componentInstanceInputsMap", componentInstancesInputs);
-		Gson gson = new Gson();
-		String userBodyJson = gson.toJson(jsonBuilder);
-		String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
-		headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
-		HttpRequest http = new HttpRequest();
-		// System.out.println(url);
-		// System.out.println(userBodyJson);
-		RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap);
-		if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) {
+    public static RestResponse declareProporties(Component componentObject, Map<String, List<ComponentInstanceInput>> componentInstancesInputs, User sdncModifierDetails)
+            throws Exception {
+        Config config = Config.instance();
+        String url = String.format(Urls.DECLARE_PROPERTIES, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentObject.getComponentType()), componentObject.getUniqueId());
+        String userId = sdncModifierDetails.getUserId();
+        Map<String, String> headersMap = prepareHeadersMap(userId);
+        Map<String, Object> jsonBuilder = new HashMap<>();
+        jsonBuilder.put("componentInstanceInputsMap", componentInstancesInputs);
+        Gson gson = new Gson();
+        String userBodyJson = gson.toJson(jsonBuilder);
+        String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
+        headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
+        HttpRequest http = new HttpRequest();
+        // System.out.println(url);
+        // System.out.println(userBodyJson);
+        RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap);
+        if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) {
 
-		}
-		return declareProportiesResponse;
-	}
+        }
+        return declareProportiesResponse;
+    }
 
-	public static RestResponse updateInput(Component componentObject, PropertyObject componentInput, User sdncModifierDetails)
-			throws Exception {
-		Config config = Config.instance();
-		String url = String.format(Urls.UPDATE_INPUT, config.getCatalogBeHost(), config.getCatalogBePort(), componentObject.getUniqueId());
-		String userId = sdncModifierDetails.getUserId();
-		Map<String, String> headersMap = prepareHeadersMap(userId);
-		Gson gson = new Gson();
-		String userBodyJson = gson.toJson(componentInput);
-		String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
-		headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
-		HttpRequest http = new HttpRequest();
-		// System.out.println(url);
-		// System.out.println(userBodyJson);
-		RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap);
-		if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) {
+    public static RestResponse updateInput(Component componentObject, PropertyObject componentInput, User sdncModifierDetails)
+            throws Exception {
+        Config config = Config.instance();
+        String url = String.format(Urls.UPDATE_INPUT, config.getCatalogBeHost(), config.getCatalogBePort(), componentObject.getUniqueId());
+        String userId = sdncModifierDetails.getUserId();
+        Map<String, String> headersMap = prepareHeadersMap(userId);
+        Gson gson = new Gson();
+        String userBodyJson = gson.toJson(componentInput);
+        String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
+        headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
+        HttpRequest http = new HttpRequest();
+        // System.out.println(url);
+        // System.out.println(userBodyJson);
+        RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap);
+        if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) {
 
-		}
-		return declareProportiesResponse;
-	}
+        }
+        return declareProportiesResponse;
+    }
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
index 599ce00..656ece5 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
@@ -20,26 +20,16 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
 import org.apache.http.client.ClientProtocolException;
 import org.json.JSONException;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.RequirementDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.be.resources.data.RelationshipInstData;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
@@ -56,10 +46,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
 
 public class ResourceRestUtils extends BaseRestUtils {
 	private static Logger logger = LoggerFactory.getLogger(ResourceRestUtils.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
index 76d2ede..f09b14c 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
@@ -20,8 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.ci.tests.api.Urls;
 import org.openecomp.sdc.ci.tests.config.Config;
@@ -32,7 +31,7 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.common.util.GeneralUtility;
 
-import com.google.gson.Gson;
+import java.util.Map;
 
 public class ResourceRestUtilsExternalAPI extends BaseRestUtils {
 	
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
index cbfc84d..ec21214 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
@@ -20,48 +20,66 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
+//import com.fasterxml.jackson.databind.DeserializationFeature;
+//import com.fasterxml.jackson.databind.ObjectMapper;
+//import com.fasterxml.jackson.databind.module.SimpleModule;
+//import com.google.gson.*;
+//import org.apache.commons.codec.binary.Base64;
+//import org.apache.log4j.Logger;
+//import org.codehaus.jackson.JsonNode;
+//
+//import org.json.JSONArray;
+//import org.json.JSONException;
+//import org.json.simple.JSONObject;
+//import org.json.simple.JSONValue;
+//import org.openecomp.sdc.be.model.*;
+//import org.openecomp.sdc.be.model.category.CategoryDefinition;
+//import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserializer;;
+//import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+//import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
+//import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
+//import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
+//import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+//import org.openecomp.sdc.ci.tests.tosca.datatypes.VfModuleDefinition;
+//import org.openecomp.sdc.ci.tests.utils.Utils;
+//import org.yaml.snakeyaml.Yaml;
+//
+//import java.io.ByteArrayInputStream;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.text.ParseException;
+//import java.util.*;
+
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.exc.InvalidFormatException;
 import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import com.google.gson.*;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.Product;
-import org.openecomp.sdc.be.model.PropertyConstraint;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.*;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserializer;
+import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
 import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
 import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
 import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.VfModuleDefinition;
 import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.yaml.snakeyaml.Yaml;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+
+//import org.codehaus.jackson.JsonNode;
 
 public class ResponseParser {
 
@@ -180,7 +198,7 @@
 
 	private static ObjectMapper newObjectMapper() {
 		SimpleModule module = new SimpleModule("customDeserializationModule");
-		module.addDeserializer(PropertyConstraint.class, new PropertyConstraintJacksonDeserializer());
+		module.addDeserializer(PropertyConstraint.class, new PropertyOperation.PropertyConstraintJacksonDeserializer());
 		return new ObjectMapper()
 			.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
 			.registerModule(module);
@@ -294,7 +312,7 @@
 		return artifactReqDetails;
 	}
 
-	public static Service convertServiceResponseToJavaObject(String response) {
+	/*public static Service convertServiceResponseToJavaObject(String response) {
 
 		ObjectMapper mapper = newObjectMapper();
 		Service service = null;
@@ -306,8 +324,27 @@
 		}
 
 		return service;
+	}*/
+	public static Service convertServiceResponseToJavaObject(String response) {
+
+		ObjectMapper mapper = newObjectMapper();
+		Service service = null;
+		try {
+			service = mapper.readValue(response, Service.class);
+			logger.debug(service.toString());
+			//Temporary catch until bug with distribution status fixed
+		} catch (InvalidFormatException e) {
+			System.out.println("broken service with invalid distribution status : " + response);
+			logger.debug("broken service with invalid distribution status : " + response);
+			return service;
+	} catch(IOException e){
+
+		e.printStackTrace();
 	}
 
+		return service;
+}
+
 	public static Product convertProductResponseToJavaObject(String response) {
 
 		ObjectMapper mapper = newObjectMapper();
@@ -446,6 +483,68 @@
 		}
 	}
 
+//	/*public static Map<String, List<Component>> convertCatalogResponseToJavaObject(String response) {
+//
+//		// Map<String, ArrayList<Component>> map = new HashMap<String,
+//		// ArrayList<Component>>();
+//		Map<String, List<Component>> map = new HashMap<>();
+//
+//		JsonElement jElement = new JsonParser().parse(response);
+//		JsonObject jObject = jElement.getAsJsonObject();
+//		JsonArray jArrReousrces = jObject.getAsJsonArray("resources");
+//		JsonArray jArrServices = jObject.getAsJsonArray("services");
+//		//Product removed
+////		JsonArray jArrProducts = jObject.getAsJsonArray("products");
+//		//Product removed
+//		if (jArrReousrces != null && jArrServices != null /*&& jArrProducts != null*/){
+//
+//
+//		//////// RESOURCE/////////////////////////////
+//		ArrayList<Component> restResponseArray = new ArrayList<>();
+//		Component component = null;
+//		for (int i = 0; i < jArrReousrces.size(); i++) {
+//			String resourceString = (String) jArrReousrces.get(i).toString();
+//			component = ResponseParser.convertResourceResponseToJavaObject(resourceString);
+//			restResponseArray.add(component);
+//		}
+//
+//		map.put("resources", restResponseArray);
+//
+//		///////// SERVICE/////////////////////////////
+//
+//		restResponseArray = new ArrayList<>();
+//		component = null;
+//		for (int i = 0; i < jArrServices.size(); i++) {
+//			String resourceString = (String) jArrServices.get(i).toString();
+//			component = ResponseParser.convertServiceResponseToJavaObject(resourceString);
+//			restResponseArray.add(component);
+//		}
+//
+//		map.put("services", restResponseArray);
+////Product removed
+//		///////// PRODUCT/////////////////////////////
+////		restResponseArray = new ArrayList<>();
+////		component = null;
+////		for (int i = 0; i < jArrProducts.size(); i++) {
+////			String resourceString = (String) jArrProducts.get(i).toString();
+////			component = ResponseParser.convertProductResponseToJavaObject(resourceString);
+////			restResponseArray.add(component);
+////		}
+////
+////		map.put("products", restResponseArray);
+////
+//    	}
+//		else {
+//			map.put("resources", new ArrayList<>());
+//			map.put("services", new ArrayList<>());
+//			//Product removed
+////			map.put("products", new ArrayList<>());
+//		}
+//
+//		return map;
+//
+//	}*/
+
 	public static Map<String, List<Component>> convertCatalogResponseToJavaObject(String response) {
 
 		// Map<String, ArrayList<Component>> map = new HashMap<String,
@@ -456,57 +555,63 @@
 		JsonObject jObject = jElement.getAsJsonObject();
 		JsonArray jArrReousrces = jObject.getAsJsonArray("resources");
 		JsonArray jArrServices = jObject.getAsJsonArray("services");
-		JsonArray jArrProducts = jObject.getAsJsonArray("products");
-		
+		//Product removed
+//		JsonArray jArrProducts = jObject.getAsJsonArray("products");
+		//Product removed
+
+		if (jArrReousrces != null && jArrServices != null /*&& jArrProducts != null*/){
 
 
-
-		//////// RESOURCE/////////////////////////////
-		ArrayList<Component> restResponseArray = new ArrayList<>();
-		Component component = null;
-			if (jArrReousrces != null) {
-				for (int i = 0; i < jArrReousrces.size(); i++) {
+			//////// RESOURCE/////////////////////////////
+			ArrayList<Component> restResponseArray = new ArrayList<>();
+			Component component = null;
+			for (int i = 0; i < jArrReousrces.size(); i++) {
 				String resourceString = (String) jArrReousrces.get(i).toString();
 				component = ResponseParser.convertResourceResponseToJavaObject(resourceString);
 				restResponseArray.add(component);
-				}
+			}
 
+			map.put("resources", restResponseArray);
 
-	 		} map.put("resources", restResponseArray);
+			///////// SERVICE/////////////////////////////
 
-
-   		///////// SERVICE/////////////////////////////
-		restResponseArray = new ArrayList<>();
-		component = null;
-			if (jArrServices != null ) {
-				for (int i = 0; i < jArrServices.size(); i++) {
+			restResponseArray = new ArrayList<>();
+			component = null;
+			for (int i = 0; i < jArrServices.size(); i++) {
 				String resourceString = (String) jArrServices.get(i).toString();
 				component = ResponseParser.convertServiceResponseToJavaObject(resourceString);
 				restResponseArray.add(component);
-				}
+			}
+
+			map.put("services", restResponseArray);
+//Product removed
+
+			///////// PRODUCT/////////////////////////////
+//		restResponseArray = new ArrayList<>();
+//		component = null;
+//		for (int i = 0; i < jArrProducts.size(); i++) {
+//			String resourceString = (String) jArrProducts.get(i).toString();
+//			component = ResponseParser.convertProductResponseToJavaObject(resourceString);
+//			restResponseArray.add(component);
+//		}
+//
 
 
-			} map.put("services", restResponseArray);
+//		map.put("products", restResponseArray);
+//
 
-
-		///////// PRODUCT/////////////////////////////
-		restResponseArray = new ArrayList<>();
-		component = null;
-			if ( jArrProducts != null){
-				for (int i = 0; i < jArrProducts.size(); i++) {
-				String resourceString = (String) jArrProducts.get(i).toString();
-				component = ResponseParser.convertProductResponseToJavaObject(resourceString);
-				restResponseArray.add(component);
-				}
-
-			} map.put("products", restResponseArray);
-
+		}
+		else {
+			map.put("resources", new ArrayList<>());
+			map.put("services", new ArrayList<>());
+			//Product removed
+//			map.put("products", new ArrayList<>());
+		}
 
 		return map;
 
 	}
 	
-	
 	public static Map<Long, ServiceDistributionStatus> convertServiceDistributionStatusToObject(String response) throws ParseException {
 
 		Map<Long, ServiceDistributionStatus> serviceDistributionStatusMap = new HashMap<>();
@@ -555,5 +660,24 @@
 		
 		return null;
 	}
-	
+
+	public static Map<String, VfModuleDefinition> convertVfModuleJsonResponseToJavaObject(String response) {
+
+		Yaml yaml = new Yaml();
+		InputStream inputStream = null;
+		inputStream = new ByteArrayInputStream(response.getBytes());
+		List<?> list = (List<?> )yaml.load(inputStream);
+		ObjectMapper mapper = new ObjectMapper();
+
+		VfModuleDefinition moduleDefinition;
+		Map<String, VfModuleDefinition> vfModulesMap = new HashMap<>();
+		for (Object obj : list) {
+//			TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			moduleDefinition = mapper.convertValue(obj, VfModuleDefinition.class);
+			vfModulesMap.put(moduleDefinition.vfModuleModelName, moduleDefinition);
+		}
+		return  vfModulesMap;
+	}
+
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
index 1d8aef6..88666cc 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
@@ -41,7 +38,9 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 public class ServiceRestUtils extends BaseRestUtils {
 	private static Logger logger = LoggerFactory.getLogger(ServiceRestUtils.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
index 5031391..1a5136e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
@@ -20,10 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.google.gson.Gson;
 import org.apache.commons.lang.StringUtils;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.ci.tests.api.Urls;
@@ -36,7 +33,9 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 public class UserRestUtils extends BaseRestUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
index 61d3400..9bfcfcf 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
@@ -43,7 +43,6 @@
 
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertTrue;
 
 public class ArtifactValidationUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
index 5f5afb2..03d364a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
@@ -20,18 +20,8 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.datastax.driver.core.ColumnDefinitions;
+import com.datastax.driver.core.Row;
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
@@ -53,15 +43,7 @@
 import org.openecomp.sdc.ci.tests.datatypes.enums.AuditJsonKeysEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ComponentType;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedAuthenticationAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedDistDownloadAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedEcomConsumerAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedExternalAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedGetUserListAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedUserCRUDAudit;
+import org.openecomp.sdc.ci.tests.datatypes.expected.*;
 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.run.StartTest;
@@ -72,10 +54,14 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils.EcompConsumerAuditJsonKeysEnum;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.openecomp.sdc.common.api.Constants;
-import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
 
-import com.datastax.driver.core.ColumnDefinitions;
-import com.datastax.driver.core.Row;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class AuditValidationUtils {
 	protected static Logger logger = Logger.getLogger(AuditValidationUtils.class.getName());
@@ -164,7 +150,7 @@
 		validateAtifactDataField(actualAuditRecords, AuditJsonKeysEnum.ARTIFACT_DATA.getAuditJsonKeyName(), resourceAuditJavaObject.getArtifactData(), checkAllFields);
 	}
 
-	public static void validateExternalAudit(ExpectedExternalAudit externalAuditObject, String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+	public static void validateExternalAudit(ExpectedExternalAudit externalAuditObject, String action, Map<AuditingFieldsKey, String> body) throws Exception {
 
 		Map<String, Object> actualAuditRecord = parseAuditResourceByAction(action, body);
 
@@ -415,7 +401,7 @@
 		validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(), expectedDistDownloadAudit.getResourceUrl());
 	}
 	
-	public static void validateAuditExternalSearchAPI(ExpectedExternalAudit expectedDistDownloadAudit, String action, Map<AuditingFieldsKeysEnum, String> body)
+	public static void validateAuditExternalSearchAPI(ExpectedExternalAudit expectedDistDownloadAudit, String action, Map<AuditingFieldsKey, String> body)
 			throws Exception {
 
 		Map<String, Object> map2 = parseAuditResourceByAction(action, body);
@@ -427,7 +413,7 @@
 		validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(), expectedDistDownloadAudit.getRESOURCE_URL());
 	}
 	
-	public static void validateAuditExternalCreateResource(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+	public static void validateAuditExternalCreateResource(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKey, String> body) throws Exception {
 	Map<String, Object>	map2 = parseAuditResourceByAction(action, body);
 
 		validateField(map2, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
@@ -446,7 +432,7 @@
 		validateField(map2, AuditJsonKeysEnum.DESCRIPTION.getAuditJsonKeyName(), expectedExternalAudit.getDesc());
 	}
 	
-	public static void validateAuditExternalChangeAssetLifeCycle(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+	public static void validateAuditExternalChangeAssetLifeCycle(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKey, String> body) throws Exception {
 		Map<String, Object> map2 = parseAuditResourceByAction(action, body);
 
 		validateField(map2, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
@@ -605,7 +591,7 @@
 	//
 	// }
 
-	public static Map<String, Object> parseAuditResourceByAction(String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+	public static Map<String, Object> parseAuditResourceByAction(String action, Map<AuditingFieldsKey, String> body) throws Exception {
 
 		Map auditingMessage = null;
 		auditingMessage = retrieveAuditMessagesByPattern(action, body, false);
@@ -614,7 +600,7 @@
 	}
 
 	public static List<Map<String, Object>> parseAuditResourceByActionToList(String action,
-			Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+			Map<AuditingFieldsKey, String> body) throws Exception {
 
 		Map auditingMessage = null;
 
@@ -673,20 +659,20 @@
 		return restResponse.getResponse();
 	}
 
-	public static Map<String, String> retrieveAuditMessagesByPattern(String action, Map<AuditingFieldsKeysEnum, String> body, Boolean retryFlag)
+	public static Map<String, String> retrieveAuditMessagesByPattern(String action, Map<AuditingFieldsKey, String> body, Boolean retryFlag)
 			throws IOException {
 
 		// get cassandra table name by action
-		String esType = AuditingActionEnum.getActionByName(action).getAuditingEsType();
+		String esType = AuditingActionEnum.fromName(action).getAuditingEsType();
 		Map<String, String> resultsMap = new HashMap<String, String>();
 
-		List<Pair<AuditingFieldsKeysEnum, String>> myFields = new ArrayList<Pair<AuditingFieldsKeysEnum, String>>();
-		Pair<AuditingFieldsKeysEnum, String> myPair = new Pair<AuditingFieldsKeysEnum, String>(
-				AuditingFieldsKeysEnum.AUDIT_ACTION, action);
+		List<Pair<AuditingFieldsKey, String>> myFields = new ArrayList<Pair<AuditingFieldsKey, String>>();
+		Pair<AuditingFieldsKey, String> myPair = new Pair<AuditingFieldsKey, String>(
+				AuditingFieldsKey.AUDIT_ACTION, action);
 		myFields.add(0, myPair);
 		if (body != null && !body.isEmpty()) {
-			for (Map.Entry<AuditingFieldsKeysEnum, String> mapElement : body.entrySet()) {
-				myFields.add(new Pair<AuditingFieldsKeysEnum, String>(mapElement.getKey(), mapElement.getValue()));
+			for (Map.Entry<AuditingFieldsKey, String> mapElement : body.entrySet()) {
+				myFields.add(new Pair<AuditingFieldsKey, String>(mapElement.getKey(), mapElement.getValue()));
 			}
 		}
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
index eb3ee33..b29fab4 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
@@ -20,11 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.FileNotFoundException;
-import java.util.Arrays;
-
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -32,6 +27,11 @@
 import org.openecomp.sdc.exception.ResponseFormat;
 import org.testng.Assert;
 
+import java.io.FileNotFoundException;
+import java.util.Arrays;
+
+import static org.testng.AssertJUnit.assertEquals;
+
 public class BaseValidationUtils {
 
 	public static final int STATUS_CODE_SUCCESS = 200;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
index cd2297f..71a19ea 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
@@ -20,10 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
 import org.json.JSONObject;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
 import org.openecomp.sdc.be.model.category.GroupingDefinition;
@@ -31,6 +27,8 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
 
+import static org.testng.AssertJUnit.*;
+
 public class CategoryValidationUtils {
 
 	public static void verifyCategoryExistInGetResponse(RestResponse getAllCategoryRest,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
index 12a5ab8..d85e093 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
@@ -20,17 +20,17 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
 import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
 import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
 import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
+
 public class CsarValidationUtils {
 
 	public static void validateCsarVfArtifact(String csarUUID, Resource resource) throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java
index 46948d8..b6b809a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java
@@ -20,7 +20,10 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertNotNull;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.utils.DistributionUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
 
 import java.io.IOException;
 import java.text.ParseException;
@@ -29,10 +32,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.ci.tests.utils.DistributionUtils;
-import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
-import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import static org.testng.AssertJUnit.assertNotNull;
 
 public class DistributionValidationUtils {
 
@@ -46,10 +46,10 @@
 		}
 		for (String distributionStatusList : distributionStatusEnumList){
 			for (Entry<String, String> url : expectedArtifactsMapOfDistributedService.entrySet()){
-				Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		        body.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, distributionID);
-		        body.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, url.getValue());
-		        body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, distributionStatusList);
+				Map <AuditingFieldsKey, String> body = new HashMap<>();
+		        body.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ID, distributionID);
+		        body.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_RESOURCE_URL, url.getValue());
+		        body.put(AuditingFieldsKey.AUDIT_STATUS, distributionStatusList);
 		        Map<String, String> actualAuditRecord = new HashMap<String, String>();
 				actualAuditRecord = AuditValidationUtils.retrieveAuditMessagesByPattern(action, body, true);
 				while (timer != 0) {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
index ccddc30..4c55339 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
@@ -20,15 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.openecomp.sdc.ci.tests.config.Config;
@@ -39,6 +30,15 @@
 import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertEquals;
+
 public class ErrorValidationUtils {
 	static Logger logger = LoggerFactory.getLogger(ErrorValidationUtils.class.getName());
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java
index ba5114c..18c9f9f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java
@@ -20,15 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
 import org.apache.log4j.Logger;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
@@ -43,6 +34,13 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.testng.AssertJUnit.*;
+
 public class ProductValidationUtils {
 
 	static Logger logger = Logger.getLogger(ProductValidationUtils.class.getName());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
index 07f2ef8..de6d32b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
@@ -20,17 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.gson.Gson;
 import org.openecomp.sdc.be.model.ArtifactDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Operation;
@@ -42,7 +32,10 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 
-import com.google.gson.Gson;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class ResourceValidationUtils {
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
index 2f8a0df..6c9b839 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
@@ -20,13 +20,6 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.openecomp.sdc.be.model.DistributionStatusEnum;
 import org.openecomp.sdc.be.model.LifecycleStateEnum;
 import org.openecomp.sdc.be.model.Service;
@@ -36,6 +29,13 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+
 public class ServiceValidationUtils {
 
 	public static void validateServiceResponseMetaData(ServiceReqDetails serviceDetails, Service service, User user,
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
index a75434e..58fd4f0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
@@ -20,11 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.validation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
+import com.google.gson.*;
 import org.apache.commons.lang.StringUtils;
 import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
 import org.openecomp.sdc.be.model.User;
@@ -36,11 +32,10 @@
 import org.openecomp.sdc.ci.tests.utils.DbUtils;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class UserValidationUtils {
 	public static void compareExpectedAndActualUsers(User expected, User actual) {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
index 91effad..2cea226 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
@@ -47,8 +47,9 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-public class AssetLifeCycle extends ComponentBaseTest {
+import java.io.FileNotFoundException;
 
+public class AssetLifeCycle extends ComponentBaseTest {
 	private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
 	protected static final String UPLOAD_ARTIFACT_PAYLOAD = "UHVUVFktVXNlci1LZXktRmlsZS0yOiBzc2gtcnNhDQpFbmNyeXB0aW9uOiBhZXMyNTYtY2JjDQpDb21tZW5wOA0K";
 	protected static final String UPLOAD_ARTIFACT_NAME = "TLV_prv.ppk";
@@ -67,34 +68,33 @@
 	protected User sdncUserDetails;
 	protected ServiceReqDetails serviceDetails;
 	
-	public static final int STATUS_CODE_SUCCESS = 200;
-	public static final int STATUS_CODE_CREATED = 201;
-	public static final int STATUS_CODE_DELETE = 204;
-	public static final int STATUS_CODE_NOT_FOUND = 404;
-	public static final int STATUS_CODE_SUCCESS_NO_CONTENT = 204;
-	public static final int STATUS_CODE_SUCCESS_DELETE = 204;
-	public static final int STATUS_CODE_INVALID_CONTENT = 400;
-	public static final int STATUS_CODE_MISSING_DATA = 400;
-	public static final int STATUS_CODE_MISSING_INFORMATION = 403;
-	public static final int STATUS_CODE_RESTRICTED_ACCESS = 403;
-	public static final int STATUS_CODE_ALREADY_EXISTS = 409;
-	public static final int STATUS_CODE_RESTRICTED_OPERATION = 409;
-	public static final int STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT = 400;
-	public static final int STATUS_CODE_MISSING_COMPONENT_NAME = 400;
-	public static final int STATUS_CODE_UNSUPPORTED_ERROR = 400;
-	public static final int STATUS_CODE_IMPORT_SUCCESS = 201;
-	public static final int STATUS_CODE_UPDATE_SUCCESS = 200;
-	public static final int RESTRICTED_OPERATION = 409;
-	public static final int STATUS_CODE_GET_SUCCESS = 200;
-	public static final int COMPONENT_IN_CHECKOUT_STATE = 403;
-	public static final int COMPONENT_ALREADY_CHECKED_IN = 409;
-	public static final int COMPONENT_NOT_READY_FOR_CERTIFICATION = 403;
-	public static final int COMPONENT_SENT_FOR_CERTIFICATION = 403;
-	public static final int COMPONENT_IN_CERT_IN_PROGRESS_STATE = 403;
-	public static final int COMPONENT_ALREADY_CERTIFIED = 403; 
+	public static final int STATUS_CODE_SUCCESS = getResponseCodeByAction(ActionStatus.OK);
+	public static final int STATUS_CODE_CREATED = getResponseCodeByAction(ActionStatus.CREATED);
+	public static final int STATUS_CODE_NOT_FOUND = getResponseCodeByAction(ActionStatus.RESOURCE_NOT_FOUND);
+	public static final int STATUS_CODE_INVALID_CONTENT = getResponseCodeByAction(ActionStatus.INVALID_CONTENT);
+	public static final int STATUS_CODE_MISSING_INFORMATION = getResponseCodeByAction(ActionStatus.MISSING_INFORMATION);
+	public static final int STATUS_CODE_ALREADY_EXISTS = getResponseCodeByAction(ActionStatus.RESOURCE_ALREADY_EXISTS);
+	public static final Integer RESTRICTED_OPERATION = getResponseCodeByAction(ActionStatus.RESTRICTED_OPERATION);
+	public static final int COMPONENT_IN_CHECKOUT_STATE = getResponseCodeByAction(ActionStatus.COMPONENT_IN_CHECKOUT_STATE);
+	public static final int COMPONENT_ALREADY_CHECKED_IN = getResponseCodeByAction(ActionStatus.COMPONENT_ALREADY_CHECKED_IN);
+	public static final int COMPONENT_NOT_READY_FOR_CERTIFICATION = getResponseCodeByAction(ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION);
+	public static final int COMPONENT_SENT_FOR_CERTIFICATION = getResponseCodeByAction(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION);
+	public static final int COMPONENT_IN_CERT_IN_PROGRESS_STATE = getResponseCodeByAction(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE);
+	public static final int COMPONENT_ALREADY_CERTIFIED = getResponseCodeByAction(ActionStatus.COMPONENT_ALREADY_CERTIFIED);
 	
 	
-	
+
+	public static int getResponseCodeByAction(ActionStatus actionStatus ){
+		ErrorInfo errorInfo;
+		try {
+			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(actionStatus.name());
+			return errorInfo.getCode();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}
+		return 100500;
+	}
+
 	@Rule 
 	public static TestName name = new TestName();
 
@@ -196,10 +196,10 @@
 			{AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.CHECKOUT},
 			
 			{AssetTypeEnum.SERVICES, LifeCycleStatesEnum.CERTIFICATIONREQUEST},
-			{AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.CERTIFICATIONREQUEST},
+			/*{AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.CERTIFICATIONREQUEST},*/
 			
 			{AssetTypeEnum.SERVICES, LifeCycleStatesEnum.STARTCERTIFICATION},
-			{AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.STARTCERTIFICATION},
+			/*{AssetTypeEnum.RESOURCES, LifeCycleStatesEnum.STARTCERTIFICATION},*/
 			};
 	}
 	
@@ -230,10 +230,10 @@
 				restResponse = LifecycleRestUtils.checkInResource(assetUUID, defaultUser);
 			} else if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKOUT)) {
 				restResponse = LifecycleRestUtils.checkOutResource(assetUUID, defaultUser);
-			} else if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
+			/*} else if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
 				restResponse = LifecycleRestUtils.certificationRequestResource(assetUUID, defaultUser);
 			} else if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.STARTCERTIFICATION)) {
-				restResponse = LifecycleRestUtils.startTestingResource(assetUUID, defaultUser);
+				restResponse = LifecycleRestUtils.startTestingResource(assetUUID, defaultUser);*/
 			}
 			
 			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
@@ -241,16 +241,6 @@
 		}
 		Assert.assertEquals(restResponse.getErrorCode(), (Integer)STATUS_CODE_NOT_FOUND, "Asset found.");
 		
-	/*	// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", assetTypeEnum.getValue().toLowerCase(), assetUUID, lifeCycleStatesEnum.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultInvalidChangeAssetLifeCycleExternalAPI(assetUUID, defaultUser, lifeCycleStatesEnum, assetTypeEnum);	
-		
-		List<String> variables = asList(assetUUID);
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -272,21 +262,9 @@
 	@Test(dataProvider="invalidUserCheckinForCheckedOutService")
 	public void invalidUserCheckinForCheckedOutService(User defaultUser) throws Exception {
 		Component resourceDetails = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
-
 		RestResponse restResponse = LifecycleRestUtils.checkInService(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckinForCheckedInService") 
@@ -309,22 +287,9 @@
 		Either<Service, RestResponse> createdComponent = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
 		resourceDetails = createdComponent.left().value();
 		resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
-		
 		RestResponse restResponse = LifecycleRestUtils.checkInService(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckoutForCheckedOutService") 
@@ -346,19 +311,8 @@
 
 		Component resourceDetails = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
 		RestResponse restResponse = LifecycleRestUtils.checkOutService(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-	/*	// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckoutForCheckedInService") 
@@ -379,22 +333,9 @@
 	public void invalidUserCheckoutForCheckedInService(User defaultUser) throws Exception {
 		Component resourceDetails = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
 		resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
-		
 		RestResponse restResponse = LifecycleRestUtils.checkOutService(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-	/*	// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckinForCheckedOutResource") 
@@ -416,19 +357,8 @@
 
 		Component resourceDetails = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true).left().value();
 		RestResponse restResponse = LifecycleRestUtils.checkInResource(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckinForCheckedInResource") 
@@ -453,20 +383,7 @@
 		resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
 		
 		RestResponse restResponse = LifecycleRestUtils.checkInResource(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
-		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 	}
 	
 	@DataProvider(name="invalidUserCheckoutForCheckedOutResource") 
@@ -488,19 +405,8 @@
 
 		Component resourceDetails = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true).left().value();
 		RestResponse restResponse = LifecycleRestUtils.checkOutResource(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	@DataProvider(name="invalidUserCheckoutForCheckedInResource") 
@@ -524,20 +430,8 @@
 		resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
 		
 		RestResponse restResponse = LifecycleRestUtils.checkOutResource(resourceDetails.getUUID(), defaultUser);
-		Assert.assertEquals(restResponse.getErrorCode(), (Integer)RESTRICTED_OPERATION, "Expected for restricted operation.");
+		Assert.assertEquals(restResponse.getErrorCode(), RESTRICTED_OPERATION, "Expected for restricted operation.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("409");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList("");
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -589,91 +483,50 @@
 		
 		
 		Either<Service, RestResponse> createdComponent = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
-		Component resourceDetails = createdComponent.left().value();
+		Component service = createdComponent.left().value();
 		
-		resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, UserRoleEnum.DESIGNER, initState, true).getLeft();
+		service = AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, initState, true).getLeft();
 		
 		RestResponse restResponse = null;
 		
 		if(targetState.equals(LifeCycleStatesEnum.CHECKOUT)) {
-			restResponse = LifecycleRestUtils.checkOutService(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.checkOutService(service.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.CHECKIN)) {
-			restResponse = LifecycleRestUtils.checkInService(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.checkInService(service.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
-			restResponse = LifecycleRestUtils.certificationRequestService(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.certificationRequestService(service.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.STARTCERTIFICATION)) {
-			restResponse = LifecycleRestUtils.startTestingService(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.startTestingService(service.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.CERTIFY)) {
-			restResponse = LifecycleRestUtils.certifyService(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.certifyService(service.getUUID(), user);
 		}
 		
 		Assert.assertEquals(restResponse.getErrorCode(), (Integer)errorCode, "Expected that response code will be equal.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, user, targetState, AssetTypeEnum.SERVICES);	
-		if(initState.equals(LifeCycleStatesEnum.CERTIFY)) {
-			expectedResourceAuditJavaObject.setCurrVersion("1.0");
-			expectedResourceAuditJavaObject.setPrevVersion("1.0");
-		}
-		expectedResourceAuditJavaObject.setPrevState(preState.toString());
-		expectedResourceAuditJavaObject.setCurrState(currState.toString());
-		expectedResourceAuditJavaObject.setStatus(status);
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(actionStatus.name());
-		List<String> variables = null;
-		if(ActionStatus.RESTRICTED_OPERATION.equals(actionStatus)) {
-			variables = asList("");
-		} else if(ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION.equals(actionStatus)) {
-			variables = asList(resourceDetails.getName(), AssetTypeEnum.SERVICES.getCorrespondingComponent().toLowerCase());
-		} else {
-			if(operationUser == null) {
-				variables = asList(resourceDetails.getName(), AssetTypeEnum.SERVICES.getCorrespondingComponent().toLowerCase(), user.getFirstName(), user.getLastName(), user.getUserId());
-			} else {
-				variables = asList(resourceDetails.getName(), AssetTypeEnum.SERVICES.getCorrespondingComponent().toLowerCase(), operationUser.getFirstName(), operationUser.getLastName(), operationUser.getUserId());
-			}
-			
-		}
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
 	@DataProvider(name="invalidStatesForResource") 
 	public static Object[][] dataProviderInvalidStatesForResource() {
 		return new Object[][] {
 			{LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CHECKED_IN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "409", ActionStatus.COMPONENT_ALREADY_CHECKED_IN, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
-			{LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
+		/*	{LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},*/
 			{LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
 			
 			{LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.CHECKOUT, COMPONENT_IN_CHECKOUT_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_IN_CHECKOUT_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
-			{LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
+		/*	{LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},*/
 			{LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
 			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_SENT_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, "403", ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
+			/*{LifeCycleStatesEnum.CERTIFICATIONREQUEST, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_SENT_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, "403", ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
 			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, LifeCycleStatesEnum.CERTIFY, RESTRICTED_OPERATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, "409", ActionStatus.RESTRICTED_OPERATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
 			
 			{LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CHECKIN, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
 			{LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CHECKOUT, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
 			{LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
-			{LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
+			{LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},*/
 
 			{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
-			{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
-			{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
+			/*{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
+			{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},*/
 			{LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
 		};
 	}
@@ -683,6 +536,7 @@
 	public void invalidStatesForResource(LifeCycleStatesEnum initState, LifeCycleStatesEnum targetState, int errorCode,
 			LifecycleStateEnum preState, LifecycleStateEnum currState, String status,
 			ActionStatus actionStatus, User user, User operationUser) throws Exception {
+
 		getExtendTest().log(Status.INFO, String.format("initState: %s, targetState: %s, errorCode: %s,"
 				+ " preState: %s, currState: %s, status: %s, actionStatus: %s, user: %s, operationUser: %s", initState, targetState, errorCode, preState,
 				currState, status, actionStatus, user, operationUser));
@@ -702,44 +556,16 @@
 			restResponse = LifecycleRestUtils.checkOutResource(resourceDetails.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.CHECKIN)) {
 			restResponse = LifecycleRestUtils.checkInResource(resourceDetails.getUUID(), user);
-		} else if(targetState.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
+		/*} else if(targetState.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
 			restResponse = LifecycleRestUtils.certificationRequestResource(resourceDetails.getUUID(), user);
 		} else if(targetState.equals(LifeCycleStatesEnum.STARTCERTIFICATION)) {
-			restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), user);
+			restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), user);*/
 		} else if(targetState.equals(LifeCycleStatesEnum.CERTIFY)) {
 			restResponse = LifecycleRestUtils.certifyResource(resourceDetails.getUUID(), user);
 		}
 		
 		Assert.assertEquals(restResponse.getErrorCode(), (Integer)errorCode, "Expected that response code will be equal.");
 		
-		/*// auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, user, targetState, AssetTypeEnum.RESOURCES);	
-		if(initState.equals(LifeCycleStatesEnum.CERTIFY)) {
-			expectedResourceAuditJavaObject.setCurrVersion("1.0");
-			expectedResourceAuditJavaObject.setPrevVersion("1.0");
-		}
-		expectedResourceAuditJavaObject.setPrevState(preState.toString());
-		expectedResourceAuditJavaObject.setCurrState(currState.toString());
-		expectedResourceAuditJavaObject.setStatus(status);
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(actionStatus.name());
-		List<String> variables = null;
-		if(ActionStatus.RESTRICTED_OPERATION.equals(actionStatus)) {
-			variables = asList("");
-		} else if(ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION.equals(actionStatus)) {
-			variables = asList(resourceDetails.getName(), AssetTypeEnum.RESOURCES.getCorrespondingComponent().toLowerCase());
-		} else {
-			if(operationUser == null) {
-				variables = asList(resourceDetails.getName(), AssetTypeEnum.RESOURCES.getCorrespondingComponent().toLowerCase(), user.getFirstName(), user.getLastName(), user.getUserId());
-			} else {
-				variables = asList(resourceDetails.getName(), AssetTypeEnum.RESOURCES.getCorrespondingComponent().toLowerCase(), operationUser.getFirstName(), operationUser.getLastName(), operationUser.getUserId());
-			}
-			
-		}
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	
@@ -749,7 +575,7 @@
 	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 	
-	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
+/*	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
 	@Test
 	public void BasicFlowForResourceSubmitForTestingStartTesting() throws Exception {
 		Either<Resource, RestResponse> createdComponent = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
@@ -758,29 +584,7 @@
 		
 		// Certification request
 		restResponse = LifecycleRestUtils.certificationRequestResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
-		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.CERTIFICATIONREQUEST.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CERTIFICATIONREQUEST, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.READY_FOR_CERTIFICATION.toString());
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
-		// Start testing
-		restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
-		
-	/*	// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.STARTCERTIFICATION.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.READY_FOR_CERTIFICATION.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.toString());
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-	}
+	}*/
 	
 	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
 	@Test
@@ -792,30 +596,12 @@
 		// Certification request
 		restResponse = LifecycleRestUtils.certificationRequestService(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.SERVICES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.CERTIFICATIONREQUEST.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CERTIFICATIONREQUEST, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.READY_FOR_CERTIFICATION.toString());
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
 		// Start testing
 		restResponse = LifecycleRestUtils.startTestingService(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
 		
-	/*	// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.SERVICES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.STARTCERTIFICATION.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.READY_FOR_CERTIFICATION.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.toString());
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
-	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
+	/*// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
 	@Test
 	public void specialCaseInvalidFlowForVfcmtSubmitForTesting() throws Exception {
 		Either<Resource, RestResponse> createdComponent = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFCMT, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
@@ -824,23 +610,7 @@
 		
 		// Certification request
 		restResponse = LifecycleRestUtils.certificationRequestResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
-		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.CERTIFICATIONREQUEST.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, defaultUser, LifeCycleStatesEnum.CERTIFICATIONREQUEST, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("400");
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID.name());
-		List<String> variables = asList(LifeCycleStatesEnum.CERTIFICATIONREQUEST.getState());
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-	}
+	}*/
 	
 	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
 	@Test
@@ -852,21 +622,6 @@
 		// Certification request
 		restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
 		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.STARTCERTIFICATION.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setStatus("400");
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID.name());
-		List<String> variables = asList(LifeCycleStatesEnum.STARTCERTIFICATION.getState());
-		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	
@@ -885,26 +640,14 @@
 		Component resourceDetails = createdComponent.left().value();
 		RestResponse restResponse = LifecycleRestUtils.checkInResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		
-		// Certification request
+		/*// Certification request
 		restResponse = LifecycleRestUtils.certificationRequestResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		
 		// Start testing
-		restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
+		restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));*/
 		
 		// Certify
-		restResponse = LifecycleRestUtils.certifyResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
-		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.CERTIFY.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("1.0");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
+		restResponse = LifecycleRestUtils.certifyResource(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 	}
 		
 	// US824692 - Story [BE]: External API for asset lifecycle - submit for test / start testing
@@ -923,16 +666,6 @@
 		// Certify
 		restResponse = LifecycleRestUtils.certifyService(resourceDetails.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER));
 		
-		/*// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.SERVICES.getValue().toLowerCase(), resourceDetails.getUUID(), LifeCycleStatesEnum.CERTIFY.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY, AssetTypeEnum.SERVICES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("1.0");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
 	}
 	
 	
@@ -991,14 +724,6 @@
 		Assert.assertEquals(parsedCreatedResponse.getUuid(), initComponentVersion.getUUID(), "Expect that UUID will not change.");
 		Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
 		
-	/*	// Auditing verification
-		AuditingActionEnum action = AuditingActionEnum.CHANGE_LIFECYCLE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, initComponentVersion.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), initComponentVersion.getUUID(), LifeCycleStatesEnum.CHECKIN.getState()));
-		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(initComponentVersion, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.RESOURCES);	
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
 		// 7. Then checkout the VFCMT via external API.
 		RestResponse checkOutRestResponse = LifecycleRestUtils.checkOutResource(initComponentVersion.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		BaseRestUtils.checkCreateResponse(checkOutRestResponse);
@@ -1007,16 +732,6 @@
 		Assert.assertEquals(parsedCreatedResponse.getUuid(), initComponentVersion.getUUID(), "Expect that UUID will not change.");
 		Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
 		
-		/*// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, initComponentVersion.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), initComponentVersion.getUUID(), LifeCycleStatesEnum.CHECKOUT.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(initComponentVersion, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("0.2");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
 		// 8. The minor version must be incremented, the invariantUUID, and UUID must stay the same, the uniqueId should be changed, the artifacts from first version exists on the new version.
 		Component newComponentVersion = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, parsedCreatedResponse.getName(), String.format("%.1f", Double.parseDouble(parsedCreatedResponse.getVersion())));
 		Assert.assertEquals(newComponentVersion.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
@@ -1036,17 +751,6 @@
 		Assert.assertEquals(parsedCreatedResponse.getUuid(), initComponentVersion.getUUID(), "Expect that UUID will not change.");
 		Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
 		
-		/*// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, initComponentVersion.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), initComponentVersion.getUUID(), LifeCycleStatesEnum.CHECKIN.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(initComponentVersion, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("0.2");
-		expectedResourceAuditJavaObject.setPrevVersion("0.2");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-
 		// 11. Certify via external API.
 		RestResponse certifyRestResponse = LifecycleRestUtils.certifyResource(initComponentVersion.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		BaseRestUtils.checkCreateResponse(certifyRestResponse);
@@ -1055,17 +759,6 @@
 		Assert.assertEquals(parsedCreatedResponse.getUuid(), initComponentVersion.getUUID(), "Expect that UUID will not change.");
 		Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
 		
-		/*// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, initComponentVersion.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), initComponentVersion.getUUID(), LifeCycleStatesEnum.CERTIFY.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(initComponentVersion, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CERTIFY, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("1.0");
-		expectedResourceAuditJavaObject.setPrevVersion("0.2");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
 		// 12. Check out via external API.
 		checkOutRestResponse = LifecycleRestUtils.checkOutResource(initComponentVersion.getUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
 		BaseRestUtils.checkCreateResponse(checkOutRestResponse);
@@ -1074,31 +767,6 @@
 		Assert.assertNotEquals(parsedCreatedResponse.getUuid(), initComponentVersion.getUUID(), "Expect that UUID will change.");
 		Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), initComponentVersion.getInvariantUUID(), "Expected that invariantUUID will not change.");
 		
-		/*// Auditing verification
-		body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, initComponentVersion.getName());
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, String.format("/sdc/v1/catalog/%s/%s/lifecycleState/%s", AssetTypeEnum.RESOURCES.getValue().toLowerCase(), initComponentVersion.getUUID(), LifeCycleStatesEnum.CHECKOUT.getState()));
-		expectedResourceAuditJavaObject = ElementFactory.getDefaultChangeAssetLifeCycleExternalAPI(initComponentVersion, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKOUT, AssetTypeEnum.RESOURCES);	
-		expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFIED.toString());
-		expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
-		expectedResourceAuditJavaObject.setCurrVersion("1.1");
-		expectedResourceAuditJavaObject.setPrevVersion("1.0");
-		AuditValidationUtils.validateAuditExternalChangeAssetLifeCycle(expectedResourceAuditJavaObject, action.getName(), body);*/
-		
-		
 	}
 	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
index 318316e..3b7d2db 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
@@ -42,10 +42,7 @@
 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.openecomp.sdc.common.util.ValidationUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.SkipException;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -57,1862 +54,1421 @@
 
 public class CRUDExternalAPI extends ComponentBaseTest {
 
-	private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
-	protected static final String UPLOAD_ARTIFACT_PAYLOAD = "UHVUVFktVXNlci1LZXktRmlsZS0yOiBzc2gtcnNhDQpFbmNyeXB0aW9uOiBhZXMyNTYtY2JjDQpDb21tZW5wOA0K";
-	protected static final String UPLOAD_ARTIFACT_NAME = "TLV_prv.ppk";
+    /*private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
+    protected static final String UPLOAD_ARTIFACT_PAYLOAD = "UHVUVFktVXNlci1LZXktRmlsZS0yOiBzc2gtcnNhDQpFbmNyeXB0aW9uOiBhZXMyNTYtY2JjDQpDb21tZW5wOA0K";
+    protected static final String UPLOAD_ARTIFACT_NAME = "TLV_prv.ppk";*/
 
-	protected Config config = Config.instance();
+    protected Config config = Config.instance();
 
-	protected String serviceVersion;
-	protected ResourceReqDetails resourceDetails;
-	protected User sdncUserDetails;
-	protected ServiceReqDetails serviceDetails;
-	
-	@Rule 
-	public static TestName name = new TestName();
+    protected String serviceVersion;
+    protected ResourceReqDetails resourceDetails;
+    protected User sdncUserDetails;
+    protected ServiceReqDetails serviceDetails;
 
-	public CRUDExternalAPI() {
-		super(name, CRUDExternalAPI.class.getName());
-	}
-	
-	@DataProvider(name="uploadArtifactOnVfcVlCpViaExternalAPI" , parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnVfcVlCpViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			};
-	}
-	
-	// External API
-	// Upload artifact on VFC, VL, CP via external API - happy flow
-	@Test(dataProvider="uploadArtifactOnVfcVlCpViaExternalAPI")
-	public void uploadArtifactOnVfcVlCpViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s, resourceTypeEnum: %s", chosenLifeCycleState, artifactType, resourceTypeEnum));
-		uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
-	}
-	
-	@DataProvider(name="uploadArtifactOnVFViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()}
-			};
-	}
-	
-	// External API
-	// Upload artifact on VF via external API - happy flow
-	@Test(dataProvider="uploadArtifactOnVFViaExternalAPI")
-	public void uploadArtifactOnVFViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, null);
-	}
-	
-	
-	@DataProvider(name="uploadArtifactOnServiceViaExternalAPI" , parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()}
-			};
-	}
-	
-	
-	@Test(dataProvider="uploadArtifactOnServiceViaExternalAPI")
-	public void uploadArtifactOnServiceViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, chosenLifeCycleState, artifactType, null);
-	}
-	
-	
-/*	@DataProvider(name="uploadArtifactOnServiceViaExternalAPIIncludingDistribution", parallel=true)
-	public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPIIncludingDistribution() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			};
-	}
-	
-	@Test(dataProvider="uploadArtifactOnServiceViaExternalAPIIncludingDistribution")
-	public void uploadArtifactOnServiceViaExternalAPIIncludingDistribution(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
-		if(true){
-			throw new SkipException("Automated TC need repair.");			
-		}
-		
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, chosenLifeCycleState, artifactType, null);
-		
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-		
-		if(config.getIsDistributionClientRunning()){
-			List<String> distributionStatusList = Arrays.asList(DistributionNotificationStatusEnum.DOWNLOAD_OK.toString(), DistributionNotificationStatusEnum.DEPLOY_OK.toString(), DistributionNotificationStatusEnum.NOTIFIED.toString());
-			DistributionValidationUtils.validateDistributedArtifactsByAudit((Service)component, distributionStatusList);
-		}
-	}*/
-	
-	
-	// Happy flow - get chosen life cycle state, artifact type and asset type
-	// Create asset, upload artifact via external API + check audit & response code
-	// Download artifact via external API + check audit & response code
-	protected Component uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		Component component = null;
-		RestResponse restResponse;
-		int numberOfArtifact = 0;
-		
-		// get artifact data
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, false);
-		
-		// create component/s & upload artifact via external api
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
-			component = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, resourceTypeEnum);
-			restResponse = uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
-			component = getNewerVersionOfComponent(component, chosenLifeCycleState);
-			numberOfArtifact = (component.getComponentInstances().get(0).getDeploymentArtifacts() == null ? 0 : component.getComponentInstances().get(0).getDeploymentArtifacts().size());
-		} else {
-			component = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, resourceTypeEnum);
-			restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
-			component = updateComponentDetailsByLifeCycleState(chosenLifeCycleState, component);
-			numberOfArtifact = component.getDeploymentArtifacts().size();
-		}
-		
-		ArtifactDefinition responseArtifact = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
-		// Get list of deployment artifact + download them via external API
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifacts will be increase by one.");
-		
-		// Download the uploaded artifact via external API
-		downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
-		return component;
-	}
+    @Rule
+    public static TestName name = new TestName();
 
-	/**
-	 * according lifecycle state of component get updated component details
-	 * @param chosenLifeCycleState
-	 * @param component
-	 * @return
-	 * @throws Exception
-	 */
-	public Component updateComponentDetailsByLifeCycleState(LifeCycleStatesEnum chosenLifeCycleState, Component component) throws Exception {
-		if(LifeCycleStatesEnum.CHECKOUT.equals(chosenLifeCycleState)){
-			component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
-		}else{		
-			component = getNewerVersionOfComponent(component, chosenLifeCycleState);	
-		}
-		return component;
-	}
-	
-	// Upload artifact via external API + Check auditing for upload operation + Check response of external API
-	public RestResponse uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, component.getComponentInstances().get(0));
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-		expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
-		expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts");
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);*/
-		
-		return restResponse;
-	}
-	
-	
-	protected Component getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum lifeCycleStatesEnum, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		Component component;
-		if(resourceTypeEnum == ResourceTypeEnum.VF) {
-			component = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
-			
-			Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, null);
-			AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
-			
-			// Add artifact to service if asked for certification request - must be at least one artifact for the flow
+    public CRUDExternalAPI() {
+        super(name, CRUDExternalAPI.class.getName());
+    }
+
+    @DataProvider(name = "uploadArtifactOnVfcVlCpViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnVfcVlCpViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+    // External API
+    // Upload artifact on VFC, VL, CP via external API - happy flow
+    @Test(dataProvider = "uploadArtifactOnVfcVlCpViaExternalAPI")
+    public void uploadArtifactOnVfcVlCpViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s, resourceTypeEnum: %s", chosenLifeCycleState, artifactType, resourceTypeEnum));
+        uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
+    }
+
+    @DataProvider(name = "uploadArtifactOnVFViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+        };
+    }
+
+    // External API
+    // Upload artifact on VF via external API - happy flow
+    @Test(dataProvider = "uploadArtifactOnVFViaExternalAPI")
+    public void uploadArtifactOnVFViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, null);
+    }
+
+
+    @DataProvider(name = "uploadArtifactOnServiceViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()}
+        };
+    }
+
+
+    @Test(dataProvider = "uploadArtifactOnServiceViaExternalAPI")
+    public void uploadArtifactOnServiceViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, chosenLifeCycleState, artifactType, null);
+    }
+
+    // Happy flow - get chosen life cycle state, artifact type and asset type
+    // Create asset, upload artifact via external API + check audit & response code
+    // Download artifact via external API + check audit & response code
+    protected Component uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        Component component = null;
+        RestResponse restResponse;
+        int numberOfArtifact = 0;
+
+        // get artifact data
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, false);
+
+        // create component/s & upload artifact via external api
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            component = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, resourceTypeEnum);
+            restResponse = uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+            component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+            numberOfArtifact = (component.getComponentInstances().get(0).getDeploymentArtifacts() == null ? 0 : component.getComponentInstances().get(0).getDeploymentArtifacts().size());
+        } else {
+            component = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, resourceTypeEnum);
+            restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+            component = updateComponentDetailsByLifeCycleState(chosenLifeCycleState, component);
+            numberOfArtifact = component.getDeploymentArtifacts().size();
+        }
+
+        ArtifactDefinition responseArtifact = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
+        // Get list of deployment artifact + download them via external API
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifacts will be increase by one.");
+
+        // Download the uploaded artifact via external API
+        downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
+        return component;
+    }
+
+    /**
+     * according lifecycle state of component get updated component details
+     *
+     * @param chosenLifeCycleState
+     * @param component
+     * @return
+     * @throws Exception
+     */
+    public Component updateComponentDetailsByLifeCycleState(LifeCycleStatesEnum chosenLifeCycleState, Component component) throws Exception {
+        if (LifeCycleStatesEnum.CHECKOUT.equals(chosenLifeCycleState)) {
+            component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
+        } else {
+            component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+        }
+        return component;
+    }
+
+    // Upload artifact via external API + Check auditing for upload operation + Check response of external API
+    public RestResponse uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, component.getComponentInstances().get(0));
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+        return restResponse;
+    }
+
+
+    protected Component getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum lifeCycleStatesEnum, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        Component component;
+        if (resourceTypeEnum == ResourceTypeEnum.VF) {
+            component = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+
+            Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, null);
+            AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+
+            // Add artifact to service if asked for certification request - must be at least one artifact for the flow
 //			if((LifeCycleStatesEnum.CERTIFICATIONREQUEST == lifeCycleStatesEnum) || (LifeCycleStatesEnum.STARTCERTIFICATION == lifeCycleStatesEnum)) {
 //			}
-			AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, component, UserRoleEnum.DESIGNER, true, true).left().value();
-			component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
-		} else {
-			component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
-			Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, resourceTypeEnum);
-			AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
-			component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
-		}
-		
-		
-		return component;
-	}
-	
-	
-	
-	
-	// Upload artifact via external API + Check auditing for upload operation + Check response of external API
-	protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails);
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);*/
-		
-		return restResponse;
-	}
-	
-	
-	
-	// Check Component version (increase by one if not in checkout)
-	// Input: component, componentLifeCycleState
-	// for any LifeCycleState != checkout
-	// find component of version +0.1
-	// check that this version different for input version
-	// check that this component uniqueID different from input uniqueID
-	// Return: that version
-	protected synchronized Component getNewerVersionOfComponent(Component component, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
-		Component resourceDetails = null;
-		
-		if((!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKOUT)) && (!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.STARTCERTIFICATION))) {
-			
-			
-			String resourceVersion = component.getVersion();
-			String resourceUniqueID = component.getUniqueId();
-			
-			if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
-				resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
-			} else {
-				resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
-			}
-			
-			String resourceNewVersion = resourceDetails.getVersion();
-			String resourceNewUniqueID = resourceDetails.getUniqueId();
-			
-			System.out.println(resourceNewVersion);
-			System.out.println("Service UUID: " + resourceDetails.getUUID());
-			System.out.println("Service UniqueID: " + resourceDetails.getUniqueId());
-			
-			// Checking that new version exist + different from old one by unique id
-			Assert.assertNotEquals(resourceVersion, resourceNewVersion, "Expected for different resource version.");
-			Assert.assertNotEquals(resourceUniqueID, resourceNewUniqueID, "Expected that resource will have new unique ID.");
-		} else {
-			if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
-				resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-			} else {
-				resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-			}
-		}
-		return resourceDetails;
-	}
-	
-	
-	
-	
-	
-	// download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
-	protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component component, ArtifactDefinition artifactDefinition, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, ComponentTypeEnum componentTypeEnum) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
-			restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(component.getUUID(), component.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
-		} else {
-			restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(component.getUUID(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
-		}
-		
-		Integer responseCode = restResponse.getErrorCode();
-		Integer expectedCode = 200;
-		Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
-		
-		
-		// For known artifact/payload - verify payload of downloaded artifact
-		if (artifactReqDetails != null) {
-			String response = restResponse.getResponse();
-			String payloadData = artifactReqDetails.getPayload();
-			String decodedPaypload = org.openecomp.sdc.ci.tests.utils.Decoder.decode(payloadData);
-			Assert.assertEquals(response, decodedPaypload, "Response artifact payload not correct.");
-		}
-		
-		//TODO - including body - resourceDetails.getName()
-//		// Verify audit
-//		String auditAction = "DownloadArtifact";
-//		
-//		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-//		body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-//		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-//		
-//		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
-//		expectedResourceAuditJavaObject.setAction(auditAction);
-//		expectedResourceAuditJavaObject.setResourceType(resourceDetails.getComponentType().getValue());
-//		expectedResourceAuditJavaObject.setStatus("200");
-//		expectedResourceAuditJavaObject.setDesc("OK");
-//		expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
-//		
-//		if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
-//			expectedResourceAuditJavaObject.setResourceName(resourceDetails.getComponentInstances().get(0).getName());
-//			String resource_url = String.format("/sdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s", resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID());
-//			expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-//				
-//			AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
-//		} else {
-//			expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName());
-//			String resource_url = String.format("/sdc/v1/catalog/services/%s/artifacts/%s", resourceDetails.getUUID(), artifactDefinition.getArtifactUUID());
-//			expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-//		}
-//		
-//		AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
-		
-		return restResponse;
-		
-	}
-	
-	// download deployment via external api + check response code for success (200) + verify audit
-	protected void downloadResourceDeploymentArtifactExternalAPI(Component component, ArtifactDefinition artifactDefinition, User sdncModifierDetails) throws Exception {
-		downloadResourceDeploymentArtifactExternalAPI(component, artifactDefinition, sdncModifierDetails, null, component.getComponentType());
-	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	@DataProvider(name="uploadArtifactOnRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType()},
-			
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType()},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType()}
-			
-			};
-	}
-	
-	
-	
-	
-	
-	@Test(dataProvider="uploadArtifactOnRIViaExternalAPI")
-	public void uploadArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, null);
-	}
-	
-	
-	
-	@DataProvider(name="uploadArtifactOnVfcVlCpRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnVfcVlCpRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+            AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, component, UserRoleEnum.DESIGNER, true, true).left().value();
+            component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
+        } else {
+            component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+            Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, resourceTypeEnum);
+            AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+            component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
+        }
+        return component;
+    }
+
+    // Upload artifact via external API + Check auditing for upload operation + Check response of external API
+    protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails);
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+        return restResponse;
+    }
+
+    // Check Component version (increase by one if not in checkout)
+    // Input: component, componentLifeCycleState
+    // for any LifeCycleState != checkout
+    // find component of version +0.1
+    // check that this version different for input version
+    // check that this component uniqueID different from input uniqueID
+    // Return: that version
+    protected synchronized Component getNewerVersionOfComponent(Component component, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+        Component resourceDetails = null;
+
+        if ((!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKOUT)) && (!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.STARTCERTIFICATION))) {
 
 
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+            String resourceVersion = component.getVersion();
+            String resourceUniqueID = component.getUniqueId();
 
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+            if (component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+                resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
+            } else {
+                resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
+            }
+
+            String resourceNewVersion = resourceDetails.getVersion();
+            String resourceNewUniqueID = resourceDetails.getUniqueId();
+
+            System.out.println(resourceNewVersion);
+            System.out.println("Service UUID: " + resourceDetails.getUUID());
+            System.out.println("Service UniqueID: " + resourceDetails.getUniqueId());
+
+            // Checking that new version exist + different from old one by unique id
+            Assert.assertNotEquals(resourceVersion, resourceNewVersion, "Expected for different resource version.");
+            Assert.assertNotEquals(resourceUniqueID, resourceNewUniqueID, "Expected that resource will have new unique ID.");
+        } else {
+            if (component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+                resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+            } else {
+                resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+            }
+        }
+        return resourceDetails;
+    }
 
 
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+    // download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
+    protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component component, ArtifactDefinition artifactDefinition, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, ComponentTypeEnum componentTypeEnum) throws Exception {
+        RestResponse restResponse;
 
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+        if (componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+            restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(component.getUUID(), component.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
+        } else {
+            restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(component.getUUID(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
+        }
 
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        Integer responseCode = restResponse.getErrorCode();
+        Integer expectedCode = 200;
+        Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
 
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+        // For known artifact/payload - verify payload of downloaded artifact
+        if (artifactReqDetails != null) {
+            String response = restResponse.getResponse();
+            String payloadData = artifactReqDetails.getPayload();
+            String decodedPaypload = org.openecomp.sdc.ci.tests.utils.Decoder.decode(payloadData);
+            Assert.assertEquals(response, decodedPaypload, "Response artifact payload not correct.");
+        }
+        return restResponse;
+    }
 
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+    // download deployment via external api + check response code for success (200) + verify audit
+    protected void downloadResourceDeploymentArtifactExternalAPI(Component component, ArtifactDefinition artifactDefinition, User sdncModifierDetails) throws Exception {
+        downloadResourceDeploymentArtifactExternalAPI(component, artifactDefinition, sdncModifierDetails, null, component.getComponentType());
+    }
 
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			
-			};
-	}
-	
-	
-	
-	
-	
-	@Test(dataProvider="uploadArtifactOnVfcVlCpRIViaExternalAPI")
-	public void uploadArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
-	}
-	
-	
-	
-	
-	@DataProvider(name="uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
-		return new Object[][] {
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
-//	322151		{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
-//	322151			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
-//	322151			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
-			};
-	}
-	
-	
-	
-	
-	// InvalidArtifact + check audit & response code function
-	@Test(dataProvider="uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
-	public void uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
-			ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
-		Component resourceDetails;
-		ComponentInstance componentResourceInstanceDetails = null;
-		ArtifactReqDetails artifactReqDetails;
-		
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum)	 {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
-			
-			resourceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
-			resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, null);
-			componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
-		} else {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
-			resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, null);
-		}
-		
-		
-		switch (uploadArtifactTestType) {
-		case "uploadArtifactWithInvalidTypeToLong":
-			uploadArtifactWithInvalidTypeToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidTypeEmpty":
-			uploadArtifactWithInvalidTypeEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidCheckSum":
-			uploadArtifactWithInvalidCheckSum(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidNameToLong":
-			uploadArtifactWithInvalidNameToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidNameEmpty":
-			uploadArtifactWithInvalidNameEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidLabelToLong":
-			uploadArtifactWithInvalidLabelToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidLabelEmpty":
-			uploadArtifactWithInvalidLabelEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidDescriptionToLong":
-			uploadArtifactWithInvalidDescriptionToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithInvalidDescriptionEmpty":
-			uploadArtifactWithInvalidDescriptionEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		case "uploadArtifactWithSameLabel":
-		default:
-			uploadArtifactWithSameLabel(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-			break;
-		}	
-	}
-	
-	// Upload artifact with invalid type via external API - to long type
-	protected void uploadArtifactWithInvalidTypeToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		artifactReqDetails.setArtifactType("dsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfds");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
-		List<String> variables = asList(artifactReqDetails.getArtifactType());
-		
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	// Upload artifact with invalid type via external API - empty type
-	protected void uploadArtifactWithInvalidTypeEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		artifactReqDetails.setArtifactType("");
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
-		List<String> variables = asList(artifactReqDetails.getArtifactType());
-		
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	// Upload artifact with invalid checksum via external API
-	protected void uploadArtifactWithInvalidCheckSum(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
-		List<String> variables = asList();
-		uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-						artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables);
-	}
-	
-	
-	// Upload artifact with valid type & invalid name via external API - name to long
-	protected void uploadArtifactWithInvalidNameToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-		List<String> variables = asList("artifact name", "255");
-		artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-						artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	
-	// Upload artifact with valid type & invalid name via external API - name is empty
-	protected void uploadArtifactWithInvalidNameEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
-		List<String> variables = asList();
-		
-		artifactReqDetails.setArtifactName("");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	
-	// Upload artifact with valid type & invalid label via external API - label to long
-	protected void uploadArtifactWithInvalidLabelToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-		List<String> variables = asList("artifact label", "255");
-		artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-		
-		
-	// Upload artifact with valid type & invalid label via external API - label is empty
-	protected void uploadArtifactWithInvalidLabelEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
-		List<String> variables = asList("artifact label");
-		artifactReqDetails.setArtifactLabel("");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	
-	// Upload artifact with invalid description via external API - to long description
-	protected void uploadArtifactWithInvalidDescriptionToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-			
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-		List<String> variables = asList("artifact description", "256");
-		artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-			
-			
-	// Upload artifact with invalid description via external API - empty description
-	protected void uploadArtifactWithInvalidDescriptionEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-			
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
-		List<String> variables = asList("artifact description");
-		artifactReqDetails.setDescription("");
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
 
-	
-	
-	// Upload artifact with same label via external API
-	protected void uploadArtifactWithSameLabel(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails) throws Exception {
-		
-		RestResponse restResponse = null;
-		if(componentResourceInstanceDetails != null) {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-		} else {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
+    @DataProvider(name = "uploadArtifactOnRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType()},
 
-		}
-		
-		ArtifactDefinition artifactDefinition = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_EXIST.name());
-		
-		List<String> variables = asList(artifactDefinition.getArtifactDisplayName());
-		ArtifactReqDetails artifactReqDetailsSameLabel = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_EVENT.toString(), true, false);
-		artifactReqDetailsSameLabel.setArtifactLabel(artifactReqDetails.getArtifactLabel());
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetailsSameLabel, componentResourceInstanceDetails, errorInfo, variables, null, false);
-	}
-	
-	protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean includeResourceNameInAudit) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentResourceInstanceDetails != null) {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, artifactReqDetails, componentResourceInstanceDetails);
-		} else {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails);
 
-		}
-		
-		// validate response code
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-				
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
-				
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-//		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
-		
-		responseArtifact.setUpdaterFullName("");
-		responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, component.getUUID(), errorInfo, variables);
-		expectedExternalAudit.setRESOURCE_NAME(component.getName());
-		expectedExternalAudit.setRESOURCE_TYPE(component.getComponentType().getValue());
-		expectedExternalAudit.setARTIFACT_DATA(null);
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-		if(componentResourceInstanceDetails != null) {
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getComponentInstances().get(0).getNormalizedName());
-			expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + component.getComponentInstances().get(0).getNormalizedName() + "/artifacts");
-			expectedExternalAudit.setRESOURCE_NAME(component.getComponentInstances().get(0).getNormalizedName());
-		} else {
-			if(includeResourceNameInAudit) {
-				body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-			} else {
-				if((lifeCycleStatesEnum == LifeCycleStatesEnum.CHECKIN) || (lifeCycleStatesEnum == LifeCycleStatesEnum.STARTCERTIFICATION)) {
-				expectedExternalAudit.setRESOURCE_NAME("");
-				body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "");
-				} else {
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-				}
-			}
-		}
-		
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);*/
-		
-		return restResponse;
-	
-	}
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType()},
+        };
+    }
 
-	
-	protected RestResponse uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
-			ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentResourceInstanceDetails != null) {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
-		} else {
-			restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
 
-		}
-		
-		// validate response code
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
-		
-		// Check auditing for upload operation
-//		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.DEPLOYMENT_ARTIFACT_NAME_ALREADY_EXISTS.name());
-//		 = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-//		List<String> variables = asList("artifact name", "255");
-		
-		/*ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-				
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
-				
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-//		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
-		
-		responseArtifact.setUpdaterFullName("");
-		responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, component.getUUID(), errorInfo, variables);
-		expectedExternalAudit.setRESOURCE_NAME(component.getName());
-		expectedExternalAudit.setRESOURCE_TYPE(component.getComponentType().getValue());
-		expectedExternalAudit.setARTIFACT_DATA(null);
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-		if(componentResourceInstanceDetails != null) {
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getComponentInstances().get(0).getNormalizedName());
-			expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + component.getComponentInstances().get(0).getNormalizedName() + "/artifacts");
-			expectedExternalAudit.setRESOURCE_NAME(component.getComponentInstances().get(0).getNormalizedName());
-		} else {
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-		}
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);*/
-		
-		return restResponse;
-	
-	}
-	
-	
-	@DataProvider(name="uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset", parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
-		return new Object[][] {
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
-			
-			/*due to those roles are not exists in the system		{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},*/
-			};
-	}
-		
-	
-	// External API
-	// Upload artifact by diffrent user then creator of asset - Fail
-	@Test(dataProvider="uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
-	public void uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum));
-		Component resourceDetails;
-		ComponentInstance componentResourceInstanceDetails = null;
-		ArtifactReqDetails artifactReqDetails;
-		
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum)	 {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
-			
-			resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(lifeCycleStatesEnum, null);
-			componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
-		} else {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
-			
-			resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, lifeCycleStatesEnum, null);
-		}
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList();
-		
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(userRoleEnum),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, lifeCycleStatesEnum, true);
-		
-//		if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKIN)) {
-//			performeClean();
-//		}
-	}
-	
+    @Test(dataProvider = "uploadArtifactOnRIViaExternalAPI")
+    public void uploadArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, null);
+    }
 
-	@DataProvider(name="uploadArtifactOnAssetWhichNotExist", parallel=false) 
-	public static Object[][] dataProviderUploadArtifactOnAssetWhichNotExist() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE},
-			{ComponentTypeEnum.RESOURCE},
-			{ComponentTypeEnum.RESOURCE_INSTANCE},
-			};
-	}
-		
 
-	// External API
-	// Upload artifact on VF via external API - happy flow
-	@Test(dataProvider="uploadArtifactOnAssetWhichNotExist")
-	public void uploadArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
-		Component resourceDetails;
-		ComponentInstance componentResourceInstanceDetails = null;
-		ArtifactReqDetails artifactReqDetails;
-		
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum)	 {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
-			
-			resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum.CHECKIN, null);
-			componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
-			
-			resourceDetails.setUUID("12345");
-			componentResourceInstanceDetails.setNormalizedName("12345");
-		} else {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.getType(), true, false);
-			
-			resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, null);
-			
-			resourceDetails.setUUID("12345");
-		}
-		
-		String componentTypeError = ActionStatus.RESOURCE_NOT_FOUND.name();
-		if (ComponentTypeEnum.SERVICE == componentTypeEnum){
-			componentTypeError = ActionStatus.SERVICE_NOT_FOUND.name();
-		}
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(componentTypeError);
-		List<String> variables = asList(resourceDetails.getUUID());
-		
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
-		
-//		performeClean();
-		
-	}
-	
-	
-	@DataProvider(name="uploadArtifactOnAssetWhichInInvalidStateForUploading", parallel=true) 
-	public static Object[][] dataProviderUploadArtifactOnAssetWhichInInvalidStateForUploading() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE},
-			{ComponentTypeEnum.RESOURCE},
-			{ComponentTypeEnum.RESOURCE_INSTANCE},
-			};
-	}
-	
-	
-	@Test(dataProvider="uploadArtifactOnAssetWhichInInvalidStateForUploading")
-	public void uploadArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
-		Component resourceDetails;
-		ComponentInstance componentResourceInstanceDetails = null;
-		ArtifactReqDetails artifactReqDetails;
-		
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum)	 {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
-			
-			resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum.STARTCERTIFICATION, null);
-			componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
-		} else {
-			artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+    @DataProvider(name = "uploadArtifactOnVfcVlCpRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnVfcVlCpRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
 
-			resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, null);
-		}
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
-		List<String> variables = asList(resourceDetails.getName(), resourceDetails.getComponentType().toString().toLowerCase(), resourceDetails.getLastUpdaterFullName().split(" ")[0],
-				resourceDetails.getLastUpdaterFullName().split(" ")[1], resourceDetails.getLastUpdaterUserId());
-		
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.STARTCERTIFICATION, true);
-	}
-	
-	
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	//					Update External API											  //
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
 
-	@DataProvider(name="updateArtifactForServiceViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactForServiceViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.OTHER.getType()}
-			};
-	}
-	
-	
-	// Update artifact for Service - Success
-	@Test(dataProvider="updateArtifactForServiceViaExternalAPI")
-	public void updateArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum, artifactType);
-		
-		// for certify version check that previous version exist, and that it artifact can be download + checksum
-		if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
-			// Download the uploaded artifact via external API
-			downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.SERVICE);
-		}
-	}
-	
-	@DataProvider(name="updateArtifactForVFViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactForVFViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()}
-			};
-	}
-	
-	
-	// Update artifact for VF - Success
-	@Test(dataProvider="updateArtifactForVFViaExternalAPI")
-	public void updateArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
-		
-		// for certify version check that previous version exist, and that it artifact can be download + checksum
-		if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
-			// Download the uploaded artifact via external API
-			downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
-		}
-	}
-	
-	@DataProvider(name="updateArtifactForVfcVlCpViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactForVfcVlCpViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			};
-	}
-	
-	
-	// Update artifact for VFC/VL/CP - Success
-	@Test(dataProvider="updateArtifactForVfcVlCpViaExternalAPI")
-	public void updateArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
-		
-		// for certify version check that previous version exist, and that it artifact can be download + checksum
-		if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
-			// Download the uploaded artifact via external API
-			downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
-		}
-	}
-	
-	@DataProvider(name="updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI", parallel=true)
-	public static Object[][] dataProviderUpdateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
-		return new Object[][] {
-			{ResourceTypeEnum.VFC},
-			{ResourceTypeEnum.VL},
-			{ResourceTypeEnum.CP}
-			};
-	}
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
 
-	// Verify that it cannot update VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
-	@Test(dataProvider="updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
-	public void updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
-		
-		Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", ArtifactTypeEnum.SNMP_TRAP.getType(), true, false);
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
-		resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
-		Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
-		AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
-		component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
-		Map<String, ArtifactDefinition> deploymentArtifacts;
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
-		String artifactUUID = null;
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci") && StringUtils.isNotEmpty(deploymentArtifacts.get(key).getArtifactUUID())) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		List<String> variables = asList(artifactUUID);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), errorInfo, variables, UserRoleEnum.DESIGNER);
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
 
-	}
-	
-	@DataProvider(name="updateArtifactOnRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactOnRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VF}
-			
-			};
-	}
-	
-	@Test(dataProvider="updateArtifactOnRIViaExternalAPI")
-	public void updateArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
-		
-		// for certify version check that previous version exist, and that it artifact can be download + checksum
-		if(chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
-			// Download the uploaded artifact via external API
-			downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
-		}
-	}
-	
-	@DataProvider(name="updateArtifactOnVfcVlCpRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactOnVfcVlCpRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			
-			};
-	}
-	
-	@Test(dataProvider="updateArtifactOnVfcVlCpRIViaExternalAPI")
-	public void updateArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
-		
-		
-		// for certify version check that previous version exist, and that it artifact can be download + checksum
-		if(chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
-			// Download the uploaded artifact via external API
-			downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
-		}
-	}
-	
-	@DataProvider(name="updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset", parallel=true)
-	public static Object[][] dataProviderUpdateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
-		return new Object[][] {
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			/*due to those roles are not exists in the system		{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},*/
-			};
-	}
-		
-	// External API
-	// Update artifact by diffrent user then creator of asset - Fail
-	@Test(dataProvider="updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
-	public void updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		if(true){
-			throw new SkipException("Open bug 321612");
-		}
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList();
-		updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, lifeCycleStatesEnum, artifactType, errorInfo, variables, userRoleEnum);
-	}
-	
-	
-	@DataProvider(name="updateArtifactOnAssetWhichNotExist", parallel=true) 
-	public static Object[][] dataProviderUpdateArtifactOnAssetWhichNotExist() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType(), null},
-			{ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType(), null},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
-			};
-	}
-		
-	// External API
-	// Upload artifact on VF via external API - happy flow
-	@Test(dataProvider="updateArtifactOnAssetWhichNotExist")
-	public void updateArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
-		
-		// get updated artifact data
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
-		String artifactUUID = deploymentArtifacts.get(artifactReqDetails.getArtifactLabel()).getArtifactUUID();
-					
-		// Invalid artifactUUID
-		String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
-		List<String> variables = asList(invalidArtifactUUID);
-		
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null, true);
 
-		}
-		
-		// Invalid componentUUID
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+
+    @Test(dataProvider = "uploadArtifactOnVfcVlCpRIViaExternalAPI")
+    public void uploadArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
+    }
+
+
+    @DataProvider(name = "uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI", parallel = false)
+    public static Object[][] dataProviderUploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
+        return new Object[][]{
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+        };
+    }
+
+
+    // InvalidArtifact + check audit & response code function
+    @Test(dataProvider = "uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+    public void uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
+                                                                                                       ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
+        Component resourceDetails;
+        ComponentInstance componentResourceInstanceDetails = null;
+        ArtifactReqDetails artifactReqDetails;
+
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+            resourceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+            resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, null);
+            componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+        } else {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+            resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, null);
+        }
+
+
+        switch (uploadArtifactTestType) {
+            case "uploadArtifactWithInvalidTypeToLong":
+                uploadArtifactWithInvalidTypeToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidTypeEmpty":
+                uploadArtifactWithInvalidTypeEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidCheckSum":
+                uploadArtifactWithInvalidCheckSum(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidNameToLong":
+                uploadArtifactWithInvalidNameToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidNameEmpty":
+                uploadArtifactWithInvalidNameEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidLabelToLong":
+                uploadArtifactWithInvalidLabelToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidLabelEmpty":
+                uploadArtifactWithInvalidLabelEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidDescriptionToLong":
+                uploadArtifactWithInvalidDescriptionToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithInvalidDescriptionEmpty":
+                uploadArtifactWithInvalidDescriptionEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+            case "uploadArtifactWithSameLabel":
+            default:
+                uploadArtifactWithSameLabel(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+                break;
+        }
+    }
+
+    // Upload artifact with invalid type via external API - to long type
+    protected void uploadArtifactWithInvalidTypeToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                       ComponentInstance componentResourceInstanceDetails) throws Exception {
+        artifactReqDetails.setArtifactType("dsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfds");
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
+        List<String> variables = asList(artifactReqDetails.getArtifactType());
+
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with invalid type via external API - empty type
+    protected void uploadArtifactWithInvalidTypeEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                      ComponentInstance componentResourceInstanceDetails) throws Exception {
+        artifactReqDetails.setArtifactType("");
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
+        List<String> variables = asList(artifactReqDetails.getArtifactType());
+
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with invalid checksum via external API
+    protected void uploadArtifactWithInvalidCheckSum(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                     ComponentInstance componentResourceInstanceDetails) throws Exception {
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
+        List<String> variables = asList();
+        uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables);
+    }
+
+    // Upload artifact with valid type & invalid name via external API - name to long
+    protected void uploadArtifactWithInvalidNameToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                       ComponentInstance componentResourceInstanceDetails) throws Exception {
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+        List<String> variables = asList("artifact name", "255");
+        artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with valid type & invalid name via external API - name is empty
+    protected void uploadArtifactWithInvalidNameEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                      ComponentInstance componentResourceInstanceDetails) throws Exception {
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
+        List<String> variables = asList();
+
+        artifactReqDetails.setArtifactName("");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+
+    // Upload artifact with valid type & invalid label via external API - label to long
+    protected void uploadArtifactWithInvalidLabelToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                        ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+        List<String> variables = asList("artifact label", "255");
+        artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with valid type & invalid label via external API - label is empty
+    protected void uploadArtifactWithInvalidLabelEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                       ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+        List<String> variables = asList("artifact label");
+        artifactReqDetails.setArtifactLabel("");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with invalid description via external API - to long description
+    protected void uploadArtifactWithInvalidDescriptionToLong(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                              ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+        List<String> variables = asList("artifact description", "256");
+        artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+
+    // Upload artifact with invalid description via external API - empty description
+    protected void uploadArtifactWithInvalidDescriptionEmpty(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                             ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+        List<String> variables = asList("artifact description");
+        artifactReqDetails.setDescription("");
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    // Upload artifact with same label via external API
+    protected void uploadArtifactWithSameLabel(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                               ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+        RestResponse restResponse = null;
+        if (componentResourceInstanceDetails != null) {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+        } else {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
+
+        }
+
+        ArtifactDefinition artifactDefinition = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_EXIST.name());
+
+        List<String> variables = asList(artifactDefinition.getArtifactDisplayName());
+        ArtifactReqDetails artifactReqDetailsSameLabel = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_EVENT.toString(), true, false);
+        artifactReqDetailsSameLabel.setArtifactLabel(artifactReqDetails.getArtifactLabel());
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetailsSameLabel, componentResourceInstanceDetails, errorInfo, variables, null, false);
+    }
+
+    protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                                                          ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean includeResourceNameInAudit) throws Exception {
+        RestResponse restResponse;
+        if (componentResourceInstanceDetails != null) {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, artifactReqDetails, componentResourceInstanceDetails);
+        } else {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails);
+
+        }
+        // validate response code
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
+        return restResponse;
+    }
+
+
+    protected RestResponse uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+                                                                                                             ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables) throws Exception {
+        RestResponse restResponse;
+        if (componentResourceInstanceDetails != null) {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+        } else {
+            restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
+
+        }
+        // validate response code
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
+        return restResponse;
+
+    }
+
+    @DataProvider(name = "uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
+        return new Object[][]{
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+        };
+    }
+
+    // External API
+    // Upload artifact by diffrent user then creator of asset - Fail
+    @Test(dataProvider = "uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+    public void uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum));
+        Component resourceDetails;
+        ComponentInstance componentResourceInstanceDetails = null;
+        ArtifactReqDetails artifactReqDetails;
+
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+            resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(lifeCycleStatesEnum, null);
+            componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+        } else {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+
+            resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, lifeCycleStatesEnum, null);
+        }
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        List<String> variables = asList();
+
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(userRoleEnum),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, lifeCycleStatesEnum, true);
+
+    }
+
+    @DataProvider(name = "uploadArtifactOnAssetWhichNotExist", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnAssetWhichNotExist() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE},
+                {ComponentTypeEnum.RESOURCE},
+                {ComponentTypeEnum.RESOURCE_INSTANCE},
+        };
+    }
+
+    // External API
+    // Upload artifact on VF via external API - happy flow
+    @Test(dataProvider = "uploadArtifactOnAssetWhichNotExist")
+    public void uploadArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
+        Component resourceDetails;
+        ComponentInstance componentResourceInstanceDetails = null;
+        ArtifactReqDetails artifactReqDetails;
+
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+            resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum.CHECKIN, null);
+            componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+
+            resourceDetails.setUUID("12345");
+            componentResourceInstanceDetails.setNormalizedName("12345");
+        } else {
+            artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.getType(), true, false);
+
+            resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, null);
+
+            resourceDetails.setUUID("12345");
+        }
+
+        String componentTypeError = ActionStatus.RESOURCE_NOT_FOUND.name();
+        if (ComponentTypeEnum.SERVICE == componentTypeEnum) {
+            componentTypeError = ActionStatus.SERVICE_NOT_FOUND.name();
+        }
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(componentTypeError);
+        List<String> variables = asList(resourceDetails.getUUID());
+
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
+    }
+
+    @DataProvider(name = "uploadArtifactOnAssetWhichInInvalidStateForUploading", parallel = true)
+    public static Object[][] dataProviderUploadArtifactOnAssetWhichInInvalidStateForUploading() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE},
+        };
+    }
+
+    @Test(dataProvider = "uploadArtifactOnAssetWhichInInvalidStateForUploading")
+    public void uploadArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
+        ComponentInstance componentResourceInstanceDetails = null;
+
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+        Component resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, null);
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+        List<String> variables = asList(resourceDetails.getName(), resourceDetails.getComponentType().toString().toLowerCase(), resourceDetails.getLastUpdaterFullName().split(" ")[0],
+                resourceDetails.getLastUpdaterFullName().split(" ")[1], resourceDetails.getLastUpdaterUserId());
+
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.STARTCERTIFICATION, true);
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    //					Update External API											  //
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+
+    @DataProvider(name = "updateArtifactForServiceViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactForServiceViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.OTHER.getType()}
+        };
+    }
+
+    // Update artifact for Service - Success
+    @Test(dataProvider = "updateArtifactForServiceViaExternalAPI")
+    public void updateArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum, artifactType);
+
+        // for certify version check that previous version exist, and that it artifact can be download + checksum
+        if (lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+            // Download the uploaded artifact via external API
+            downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.SERVICE);
+        }
+    }
+
+    @DataProvider(name = "updateArtifactForVFViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactForVFViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+        };
+    }
+
+    // Update artifact for VF - Success
+    @Test(dataProvider = "updateArtifactForVFViaExternalAPI")
+    public void updateArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
+
+        // for certify version check that previous version exist, and that it artifact can be download + checksum
+        if (lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+            // Download the uploaded artifact via external API
+            downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
+        }
+    }
+
+    @DataProvider(name = "updateArtifactForVfcVlCpViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactForVfcVlCpViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+    // Update artifact for VFC/VL/CP - Success
+    @Test(dataProvider = "updateArtifactForVfcVlCpViaExternalAPI")
+    public void updateArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
+
+        // for certify version check that previous version exist, and that it artifact can be download + checksum
+        if (lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+            // Download the uploaded artifact via external API
+            downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
+        }
+    }
+
+    @DataProvider(name = "updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
+        return new Object[][]{
+                {ResourceTypeEnum.VFC},
+                {ResourceTypeEnum.VL},
+                {ResourceTypeEnum.CP}
+        };
+    }
+
+    // Verify that it cannot update VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
+    @Test(dataProvider = "updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+    public void updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
+
+        Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", ArtifactTypeEnum.SNMP_TRAP.getType(), true, false);
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+        resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+        Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+        AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+        component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
+        Map<String, ArtifactDefinition> deploymentArtifacts;
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
+        String artifactUUID = null;
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci") && StringUtils.isNotEmpty(deploymentArtifacts.get(key).getArtifactUUID())) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
+        List<String> variables = asList(artifactUUID);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), errorInfo, variables, UserRoleEnum.DESIGNER);
+
+    }
+
+    @DataProvider(name = "updateArtifactOnRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactOnRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
+
+        };
+    }
+
+    @Test(dataProvider = "updateArtifactOnRIViaExternalAPI")
+    public void updateArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
+
+        // for certify version check that previous version exist, and that it artifact can be download + checksum
+        if (chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
+            // Download the uploaded artifact via external API
+            downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
+        }
+    }
+
+    @DataProvider(name = "updateArtifactOnVfcVlCpRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactOnVfcVlCpRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+    @Test(dataProvider = "updateArtifactOnVfcVlCpRIViaExternalAPI")
+    public void updateArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
+
+
+        // for certify version check that previous version exist, and that it artifact can be download + checksum
+        if (chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
+            // Download the uploaded artifact via external API
+            downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
+        }
+    }
+
+    @DataProvider(name = "updateArtifactOnVFViaExternalAPIByDifferentUserThenCreatorOfAsset", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactOnVFViaExternalAPIByDifferentUserThenCreatorOfAsset() {
+        return new Object[][]{
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+        };
+    }
+
+    // External API
+    // Update artifact by different user then creator of asset - Fail
+    @Test(dataProvider = "updateArtifactOnVFViaExternalAPIByDifferentUserThenCreatorOfAsset")
+    public void updateArtifactOnVFViaExternalAPIByDifferentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        List<String> variables = asList();
+        updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, lifeCycleStatesEnum, artifactType, errorInfo, variables, userRoleEnum);
+    }
+
+    @DataProvider(name = "updateArtifactOnAssetWhichNotExist", parallel = true)
+    public static Object[][] dataProviderUpdateArtifactOnAssetWhichNotExist() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType(), null},
+                {ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType(), null},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
+        };
+    }
+
+    // External API
+    // Upload artifact on VF via external API - happy flow
+    @Test(dataProvider = "updateArtifactOnAssetWhichNotExist")
+    public void updateArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
+
+        // get updated artifact data
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
+        String artifactUUID = deploymentArtifacts.get(artifactReqDetails.getArtifactLabel()).getArtifactUUID();
+
+        // Invalid artifactUUID
+        String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+        List<String> variables = asList(invalidArtifactUUID);
+
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null, true);
+
+        }
+
+        // Invalid componentUUID
 //		errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
 //		variables = asList("null");
-		
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
-			
-			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
-			
-			variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, true);
-		} else {
-			component.setUUID("invalidComponentUUID");
-			
-			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
-			variables = asList("null");
-			
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
-		}
-		
-		performClean();
-	}
-	
-	
-	@DataProvider(name="updateArtifactOnAssetWhichInInvalidStateForUploading", parallel=true) 
-	public static Object[][] dataProviderUpdateProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			};
-	}
-	
-	@Test(dataProvider="updateArtifactOnAssetWhichInInvalidStateForUploading")
-	public void updateArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
-		List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
-		ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
-		updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, LifeCycleStatesEnum.STARTCERTIFICATION, artifactType, errorInfo, variables, UserRoleEnum.DESIGNER);
-		
-	}
-	
-	
-	
-	
-	
-	@DataProvider(name="updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderUpdateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
 
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
-			};
-	}
-	
-	
-	// InvalidArtifact + check audit & response code function
-	@Test(dataProvider="updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
-	public void updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
-			ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
-		Component component;
-		ComponentInstance componentInstance = null;
-		String artifactType;
-		
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum)	 {
-			artifactType = ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString();
-			component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
-			componentInstance = component.getComponentInstances().get(0);
-		} else {
-			artifactType = ArtifactTypeEnum.OTHER.toString();
-			component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
-		}
-		
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
-		
-		switch (uploadArtifactTestType) {
-		case "updateArtifactWithInvalidCheckSum":
-			updateArtifactWithInvalidCheckSum(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidNameToLong":
-			updateArtifactWithInvalidNameToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidNameEmpty":
-			updateArtifactWithInvalidNameEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidLabelToLong":
-			updateArtifactWithInvalidLabelToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidLabelEmpty":
-			updateArtifactWithInvalidLabelEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidDescriptionToLong":
-			updateArtifactWithInvalidDescriptionToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		case "updateArtifactWithInvalidDescriptionEmpty":
-		default:
-			updateArtifactWithInvalidDescriptionEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
-			break;
-		}
-		
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
+
+            errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
+
+            variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, true);
+        } else {
+            component.setUUID("invalidComponentUUID");
+
+            errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+            variables = asList("null");
+
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
+        }
+        performClean();
+    }
+
+    @DataProvider(name = "updateArtifactOnAssetWhichInInvalidStateForUploading", parallel = true)
+    public static Object[][] dataProviderUpdateProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType()},
+        };
+    }
+
+    @Test(dataProvider = "updateArtifactOnAssetWhichInInvalidStateForUploading")
+    public void updateArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+        List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
+                ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
+        updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, LifeCycleStatesEnum.STARTCERTIFICATION, artifactType, errorInfo, variables, UserRoleEnum.DESIGNER);
+
+    }
+
+    @DataProvider(name = "updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderUpdateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+        };
+    }
+
+    // InvalidArtifact + check audit & response code function
+    @Test(dataProvider = "updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+    public void updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
+                                                                                                       ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
+        Component component;
+        ComponentInstance componentInstance = null;
+        String artifactType;
+
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            artifactType = ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString();
+            component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+            componentInstance = component.getComponentInstances().get(0);
+        } else {
+            artifactType = ArtifactTypeEnum.OTHER.toString();
+            component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+        }
+
+        component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+
+        switch (uploadArtifactTestType) {
+            case "updateArtifactWithInvalidCheckSum":
+                updateArtifactWithInvalidCheckSum(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidNameToLong":
+                updateArtifactWithInvalidNameToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidNameEmpty":
+                updateArtifactWithInvalidNameEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidLabelToLong":
+                updateArtifactWithInvalidLabelToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidLabelEmpty":
+                updateArtifactWithInvalidLabelEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidDescriptionToLong":
+                updateArtifactWithInvalidDescriptionToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+            case "updateArtifactWithInvalidDescriptionEmpty":
+            default:
+                updateArtifactWithInvalidDescriptionEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+                break;
+        }
+
 ///////////////////////////////////////////////////////////////////////////////		
 //		// TODO: there is defect when checking invalid type
 ////		// Upload artifact with invalid type via external API
@@ -1925,1285 +1481,962 @@
 ////		restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
 ////		artifactReqDetails.setArtifactType(artifactType);
 ///////////////////////////////////////////////////////////////////////////////			
-	}
-	
-	// TODO
-	// Update artifact with invalid checksum via external API
-	protected void updateArtifactWithInvalidCheckSum(Component component, User sdncModifierDetails, String artifactType, ComponentInstance componentInstance) throws Exception {
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
-		List<String> variables = asList();
-//		uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-//						artifactReqDetails, componentResourceInstanceDetails, errorInfo, variables);
-	}
-	
-	
-	// Update artifact with valid type & invalid name via external API - name to long
-	protected void updateArtifactWithInvalidNameToLong(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-		List<String> variables = asList("artifact name", "255");
-		artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
-		
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+    }
 
-		}
-	}
-	
-	
-	// Update artifact with valid type & invalid name via external API - name is empty
-	protected void updateArtifactWithInvalidNameEmpty(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
-		List<String> variables = asList();
-		artifactReqDetails.setArtifactName("");
-		
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+    // TODO
+    // Update artifact with invalid checksum via external API
+    protected void updateArtifactWithInvalidCheckSum(Component component, User sdncModifierDetails, String artifactType, ComponentInstance componentInstance) throws Exception {
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
+        List<String> variables = asList();
+    }
 
-		}
-	}
-	
-	
-	// Update artifact with valid type & invalid label via external API - label to long - 
+
+    // Update artifact with valid type & invalid name via external API - name to long
+    protected void updateArtifactWithInvalidNameToLong(Component component, User sdncModifierDetails, String artifactType,
+                                                       ComponentInstance componentInstance) throws Exception {
+
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+        List<String> variables = asList("artifact name", "255");
+        artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+
+        }
+    }
+
+    // Update artifact with valid type & invalid name via external API - name is empty
+    protected void updateArtifactWithInvalidNameEmpty(Component component, User sdncModifierDetails, String artifactType,
+                                                      ComponentInstance componentInstance) throws Exception {
+
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
+        List<String> variables = asList();
+        artifactReqDetails.setArtifactName("");
+
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+
+        }
+    }
+
+    // Update artifact with valid type & invalid label via external API - label to long -
 //	according to the newest AID doc artifactLabel, artifactType, artifactGroupType parameters should be ignored 
-	protected void updateArtifactWithInvalidLabelToLong(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-		
-//		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED.name());
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
-//		List<String> variables = asList();
-		artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+    protected void updateArtifactWithInvalidLabelToLong(Component component, User sdncModifierDetails, String artifactType,
+                                                        ComponentInstance componentInstance) throws Exception {
 
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, null, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, null, null, true);
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
 
-		}
-	}
-		
-		
-	// Update artifact with valid type & invalid label via external API - label is empty
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
+        artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, null, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, null, null, true);
+
+        }
+    }
+
+    // Update artifact with valid type & invalid label via external API - label is empty
 //		according to the newest AID doc artifactLabel, artifactType, artifactGroupType parameters should be ignored 
-	protected void updateArtifactWithInvalidLabelEmpty(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
-		artifactReqDetails.setArtifactLabel("");
-		
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, null, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, null, null, true);
+    protected void updateArtifactWithInvalidLabelEmpty(Component component, User sdncModifierDetails, String artifactType,
+                                                       ComponentInstance componentInstance) throws Exception {
 
-		}
-	}
-	
-	
-	// Update artifact with invalid description via external API - to long description
-	protected void updateArtifactWithInvalidDescriptionToLong(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-			
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
-		List<String> variables = asList("artifact description", ValidationUtils.ARTIFACT_DESCRIPTION_MAX_LENGTH.toString());
-		artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
-		
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
 
-		}
-	}
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
+        artifactReqDetails.setArtifactLabel("");
 
-	public String getFirstArtifactUuidFromComponent(Component component) {
-		String artifactUUID = null;
-		Map<String, ArtifactDefinition> deploymentArtifacts;
-		if(component.getComponentInstances() != null) {
-			deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
-		} else {
-			deploymentArtifacts = component.getDeploymentArtifacts();
-		}
-					
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		return artifactUUID;
-	}
-			
-			
-	// Update artifact with invalid description via external API - empty description
-	protected void updateArtifactWithInvalidDescriptionEmpty(Component component, User sdncModifierDetails, String artifactType,
-			ComponentInstance componentInstance) throws Exception {
-		
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = getFirstArtifactUuidFromComponent(component);
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
-		List<String> variables = asList("artifact description");
-		artifactReqDetails.setDescription("");
-		
-		if(componentInstance != null) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, null, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, null, null, true);
 
-		}
-	}
-	
-	
-	// Unhappy flow - get chosen life cycle state, artifact type and asset type
-	// update artifact via external API + check audit & response code
-	// Download artifact via external API + check audit & response code
-	// Check artifact version, uuid & checksusm
-	protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ErrorInfo errorInfo, List<String> variables, UserRoleEnum userRoleEnum) throws Exception {
-		String componentVersionBeforeUpdate = null;
-				
-		// get updated artifact data
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
-		componentVersionBeforeUpdate = component.getVersion();
-		
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
-		
-		String artifactName = artifactReqDetails.getArtifactLabel();
-		String artifactUUID = deploymentArtifacts.get(artifactName).getArtifactUUID();
-		String artifactVersionBeforeUpdate = deploymentArtifacts.get(artifactName).getArtifactVersion();
-		int numberOfArtifact = deploymentArtifacts.size();
+        }
+    }
 
-		ArtifactReqDetails updateArtifactReqDetails = ElementFactory.getArtifactByType(ArtifactTypeEnum.SNMP_POLL.name(), ArtifactTypeEnum.SNMP_POLL.name(), true, true);
-		updateArtifactReqDetails.setPayload("dGVzdA==");
+    // Update artifact with invalid description via external API - to long description
+    protected void updateArtifactWithInvalidDescriptionToLong(Component component, User sdncModifierDetails, String artifactType,
+                                                              ComponentInstance componentInstance) throws Exception {
 
-		// create component/s & upload artifact via external api
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
-					component.getComponentInstances().get(0), updateArtifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState, true);
-		} else {
-			updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
-					null, updateArtifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState, true);
-		}
-		
-		if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
-			component = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-		} else {
-			component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-		}
-			
-		// Get list of deployment artifact + download them via external API
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
-			deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
-		} else {
-			deploymentArtifacts = component.getDeploymentArtifacts();
-		}
-		Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
-		Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
-		if (errorInfo.getCode().equals(200)) {
-			Assert.assertNotEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate))), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Artifact version should be changed.");
-			Assert.assertNotEquals(artifactUUID, deploymentArtifacts.get(artifactName).getArtifactUUID(), "Artifact UUID should be changed.");
-		}else{
-			Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate))), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Artifact version should not be changed.");
-			Assert.assertEquals(artifactUUID, deploymentArtifacts.get(artifactName).getArtifactUUID(), "Artifact UUID should not be changed.");
-		}
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+        List<String> variables = asList("artifact description", ValidationUtils.ARTIFACT_DESCRIPTION_MAX_LENGTH.toString());
+        artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+
+        }
+    }
+
+    public String getFirstArtifactUuidFromComponent(Component component) {
+        String artifactUUID = null;
+        Map<String, ArtifactDefinition> deploymentArtifacts;
+        if (component.getComponentInstances() != null) {
+            deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+        } else {
+            deploymentArtifacts = component.getDeploymentArtifacts();
+        }
+
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
+        return artifactUUID;
+    }
+
+    // Update artifact with invalid description via external API - empty description
+    protected void updateArtifactWithInvalidDescriptionEmpty(Component component, User sdncModifierDetails, String artifactType,
+                                                             ComponentInstance componentInstance) throws Exception {
+
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = getFirstArtifactUuidFromComponent(component);
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+        List<String> variables = asList("artifact description");
+        artifactReqDetails.setDescription("");
+
+        if (componentInstance != null) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactReqDetails, artifactUUID, errorInfo, variables, null, true);
+        }
+    }
+
+    // Unhappy flow - get chosen life cycle state, artifact type and asset type
+    // update artifact via external API + check audit & response code
+    // Download artifact via external API + check audit & response code
+    // Check artifact version, uuid & checksusm
+    protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ErrorInfo errorInfo, List<String> variables, UserRoleEnum userRoleEnum) throws Exception {
+        String componentVersionBeforeUpdate = null;
+
+        // get updated artifact data
+        component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+        componentVersionBeforeUpdate = component.getVersion();
+
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
+
+        String artifactName = artifactReqDetails.getArtifactLabel();
+        String artifactUUID = deploymentArtifacts.get(artifactName).getArtifactUUID();
+        String artifactVersionBeforeUpdate = deploymentArtifacts.get(artifactName).getArtifactVersion();
+        int numberOfArtifact = deploymentArtifacts.size();
+
+        ArtifactReqDetails updateArtifactReqDetails = ElementFactory.getArtifactByType(ArtifactTypeEnum.SNMP_POLL.name(), ArtifactTypeEnum.SNMP_POLL.name(), true, true);
+        updateArtifactReqDetails.setPayload("dGVzdA==");
+
+        // create component/s & upload artifact via external api
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+                    component.getComponentInstances().get(0), updateArtifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState, true);
+        } else {
+            updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+                    null, updateArtifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState, true);
+        }
+
+        if (component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+            component = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+        } else {
+            component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+        }
+
+        // Get list of deployment artifact + download them via external API
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+        } else {
+            deploymentArtifacts = component.getDeploymentArtifacts();
+        }
+        Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
+        Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
+        if (errorInfo.getCode().equals(200)) {
+            Assert.assertNotEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate))), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Artifact version should be changed.");
+            Assert.assertNotEquals(artifactUUID, deploymentArtifacts.get(artifactName).getArtifactUUID(), "Artifact UUID should be changed.");
+        } else {
+            Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate))), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Artifact version should not be changed.");
+            Assert.assertEquals(artifactUUID, deploymentArtifacts.get(artifactName).getArtifactUUID(), "Artifact UUID should not be changed.");
+        }
+        return component;
+    }
+
+    protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails,
+                                                                                          ComponentInstance componentInstance, ArtifactReqDetails artifactReqDetails, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean resourceNameInAudit) throws Exception {
+        RestResponse restResponse;
+
+        if (componentInstance != null) {
+            restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, artifactReqDetails, componentInstance, artifactUUID);
+        } else {
+            restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails, artifactUUID);
+
+        }
+        // validate response code
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
+        component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
+        return restResponse;
+    }
 
 
-		return component;
-	}
-	
-	protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails,
-			ComponentInstance componentInstance, ArtifactReqDetails artifactReqDetails, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean resourceNameInAudit) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentInstance != null) {
-			restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, artifactReqDetails, componentInstance, artifactUUID);
-		} else {
-			restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(component, sdncModifierDetails, artifactReqDetails, artifactUUID);
+    // This function get component, user & if updatedPayload or not
+    // It will create default payload / updated payload of artifact
+    // And download artifact of component which starts with ci
+    protected RestResponse downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(Component component, String artifactType, User sdncModifierDetails, ComponentTypeEnum componentTypeEnum) throws IOException, Exception {
+        // Download the uploaded artifact via external API
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("abcd", artifactType, true, false);
+        String artifactName = null;
+        for (String key : component.getDeploymentArtifacts().keySet()) {
+            if (key.startsWith("ci")) {
+                artifactName = key;
+                break;
+            }
+        }
+        return downloadResourceDeploymentArtifactExternalAPI(component, component.getDeploymentArtifacts().get(artifactName), sdncModifierDetails, artifactReqDetails, componentTypeEnum);
+    }
 
-		}
-		// validate response code
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
-		component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
-		
-	/*	//TODO
-		// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-				
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
-				
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-//		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
-		
-		responseArtifact.setUpdaterFullName("");
-		responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, component.getUUID(), errorInfo, variables);
-		expectedExternalAudit.setRESOURCE_NAME(component.getName());
-		expectedExternalAudit.setRESOURCE_TYPE(component.getComponentType().getValue());
-		expectedExternalAudit.setARTIFACT_DATA("");
-		if(errorInfo.getCode()==200){
-			expectedExternalAudit.setCURR_ARTIFACT_UUID(responseArtifact.getArtifactUUID());
-			expectedExternalAudit.setARTIFACT_DATA(AuditValidationUtils.buildArtifactDataAudit(responseArtifact));
-		}else{
-			expectedExternalAudit.setCURR_ARTIFACT_UUID(artifactUUID);
-		}
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-		if(componentInstance != null) {
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getComponentInstances().get(0).getNormalizedName());
-			expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + component.getComponentInstances().get(0).getNormalizedName() + "/artifacts/" + artifactUUID);
-			expectedExternalAudit.setRESOURCE_NAME(component.getComponentInstances().get(0).getNormalizedName());
-		} else {
-			expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL() + "/" + artifactUUID);
-			if((lifeCycleStatesEnum == LifeCycleStatesEnum.CHECKIN) || (lifeCycleStatesEnum == LifeCycleStatesEnum.STARTCERTIFICATION)) {
-				if(resourceNameInAudit) {
-					expectedExternalAudit.setRESOURCE_NAME(component.getName());
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-				} else {
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
-//					body.put(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID, artifactUUID);
-					expectedExternalAudit.setRESOURCE_NAME("");
-				}			
-			} else {
-				body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-			}
-		}
-		
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);*/
-		return restResponse;
-	}
-	
-	
-	// This function get component, user & if updatedPayload or not
-	// It will create default payload / updated payload of artifact
-	// And download artifact of component which starts with ci
-	protected RestResponse downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(Component component, String artifactType, User sdncModifierDetails, ComponentTypeEnum componentTypeEnum) throws IOException, Exception {
-		// Download the uploaded artifact via external API
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("abcd", artifactType, true, false);
-		String artifactName = null;
-		for (String key : component.getDeploymentArtifacts().keySet()) {
-			if (key.startsWith("ci")) {
-				artifactName = key;
-				break;
-			}
-		}
-		return downloadResourceDeploymentArtifactExternalAPI(component, component.getDeploymentArtifacts().get(artifactName), sdncModifierDetails, artifactReqDetails, componentTypeEnum);
-	}
-	
-	// Get deployment artifact of RI
-	protected Map<String, ArtifactDefinition> getDeploymentArtifactsOfAsset(Component component, ComponentTypeEnum componentTypeEnum) {
-		Map<String, ArtifactDefinition> deploymentArtifacts = null;
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
-			for(ComponentInstance componentInstance: component.getComponentInstances()) {
-				if(componentInstance.getNormalizedName().startsWith("ci")) {
-					deploymentArtifacts = componentInstance.getDeploymentArtifacts();
-					break;
-				}
-			}
-		} else {
-			deploymentArtifacts = component.getDeploymentArtifacts();
-		}
-		return deploymentArtifacts;
-	}
-	
-	// get deploymentArtifact of asset and artifactType -> generate new artifact that can be updated on the asset
-	protected ArtifactReqDetails getUpdatedArtifact(Map<String, ArtifactDefinition> deploymentArtifacts, String artifactType) throws IOException, Exception {
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
-				artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
-				artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
-				break;
-			}
-		}
-		
-		return artifactReqDetails;
-	}
-	
-	// Happy flow - get chosen life cycle state, artifact type and asset type
-	// update artifact via external API + check audit & response code
-	// Download artifact via external API + check audit & response code
-	// Check artifact version, uuid & checksusm
-	protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
-		RestResponse restResponse = null;
-		int numberOfArtifact = 0;
-		String artifactVersionBeforeUpdate = null;
-		String artifactName = null;
-		String componentVersionBeforeUpdate = null;
-			
-		// get updated artifact data
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
-		String artifactUUID = null;
-		Map<String, ArtifactDefinition> deploymentArtifacts;
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactName = key;
-				artifactVersionBeforeUpdate = deploymentArtifacts.get(key).getArtifactVersion();
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
-				artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
-				artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
-				break;
-			}
-		}
-		
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
-		componentVersionBeforeUpdate = component.getVersion();
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		numberOfArtifact = deploymentArtifacts.size();
-		
-		// create component/s & upload artifact via external api
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
- 			restResponse = updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
-		} else {
-			restResponse = updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
-		}
-			
-		ArtifactDefinition responseArtifact = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
-		component = getNewerVersionOfComponent(component, chosenLifeCycleState);
-			
-		// Get list of deployment artifact + download them via external API
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
-		Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate) + 1)), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Expected that aftifact version will increase by one.");
-		
-		if(chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
-			Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
-		} else {
-			Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeUpdate) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
-		}
-		
-		// Download the uploaded artifact via external API
-		downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
-		
-		return component;
-	}
-	
-	
-	// Update artifact via external API + Check auditing for upload operation + Check response of external API
-	protected RestResponse updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, component.getComponentInstances().get(0), artifactUUID);
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-	/*	// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-//		expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
-		expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
-		expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts/" + artifactUUID);
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);*/
-		
-		return restResponse;
-	}
-	
-	
-	// Update artifact via external API + Check auditing for upload operation + Check response of external API
-	protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID);
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-	/*	// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-		expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);*/
-		
-		return restResponse;
-	}
-	
-	
-	
-	
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	//					Delete External API											  //
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	////////////////////////////////////////////////////////////////////////////////////
-	@DataProvider(name="deleteArtifactForServiceViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactForServiceViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.OTHER.getType()}
-			};
-	}
-	
-	// Delete artifact for Service - Success
-	@Test(dataProvider="deleteArtifactForServiceViaExternalAPI")
-	public void deleteArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
-		deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum);
-	}
-	
-	@DataProvider(name="deleteArtifactForVFViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactForVFViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_JSON.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_POLICY.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_EVENT.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.APPC_CONFIG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_DOC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_TOSCA.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()},
-			};
-	}
-	
-	
-	// Delete artifact for VF - Success
-	@Test(dataProvider="deleteArtifactForVFViaExternalAPI")
-	public void deleteArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
-		deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
-	}
-	
-	@DataProvider(name="deleteArtifactForVfcVlCpViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactForVfcVlCpViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			};
-	}
-	
-	
-	// Delete artifact for VFC, VL, CP - Success
-	@Test(dataProvider="deleteArtifactForVfcVlCpViaExternalAPI")
-	public void deleteArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
-	}
-	
-	@DataProvider(name="deleteArtifactOnRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOnRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VF},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VF}
-			
-			};
-	}
-	
-	
-	
-	
-	
-	@Test(dataProvider="deleteArtifactOnRIViaExternalAPI")
-	public void deleteArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
-	}
-	
-	
-	@DataProvider(name="deleteArtifactOnVfcVlCpRIViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOnVfcVlCpRIViaExternalAPI() {
-		return new Object[][] {
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP,},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
-			
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
-			{LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP}
-			
-			};
-	}
-	
-	
-	
-	
-	
-	@Test(dataProvider="deleteArtifactOnVfcVlCpRIViaExternalAPI")
-	public void deleteArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
-		deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
-	}
-	
-	
-	@DataProvider(name="deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
-		return new Object[][] {
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-//			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			/*due to those roles are not exists in the system		{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			{ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},*/
-			};
-	}
-		
+    // Get deployment artifact of RI
+    protected Map<String, ArtifactDefinition> getDeploymentArtifactsOfAsset(Component component, ComponentTypeEnum componentTypeEnum) {
+        Map<String, ArtifactDefinition> deploymentArtifacts = null;
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            for (ComponentInstance componentInstance : component.getComponentInstances()) {
+                if (componentInstance.getNormalizedName().startsWith("ci")) {
+                    deploymentArtifacts = componentInstance.getDeploymentArtifacts();
+                    break;
+                }
+            }
+        } else {
+            deploymentArtifacts = component.getDeploymentArtifacts();
+        }
+        return deploymentArtifacts;
+    }
 
-	// External API
-	// Delete artifact by different user then creator of asset - Fail
-	@Test(dataProvider="deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
-	public void deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum %s, lifeCycleStatesEnum %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, lifeCycleStatesEnum, artifactType, null);
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		
-		String artifactUUID = null;
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
-		List<String> variables = asList();
-		
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
-					component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, lifeCycleStatesEnum, true);
-		} else {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
-					null, artifactUUID, errorInfo, variables, lifeCycleStatesEnum, true);
-		}
-			
-		//TODO
+    // get deploymentArtifact of asset and artifactType -> generate new artifact that can be updated on the asset
+    protected ArtifactReqDetails getUpdatedArtifact(Map<String, ArtifactDefinition> deploymentArtifacts, String artifactType) throws IOException, Exception {
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
+                artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
+                artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
+                break;
+            }
+        }
+        return artifactReqDetails;
+    }
+
+    // Happy flow - get chosen life cycle state, artifact type and asset type
+    // update artifact via external API + check audit & response code
+    // Download artifact via external API + check audit & response code
+    // Check artifact version, uuid & checksusm
+    protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+        RestResponse restResponse = null;
+        int numberOfArtifact = 0;
+        String artifactVersionBeforeUpdate = null;
+        String artifactName = null;
+        String componentVersionBeforeUpdate = null;
+
+        // get updated artifact data
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+        String artifactUUID = null;
+        Map<String, ArtifactDefinition> deploymentArtifacts;
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactName = key;
+                artifactVersionBeforeUpdate = deploymentArtifacts.get(key).getArtifactVersion();
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
+                artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
+                artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
+                break;
+            }
+        }
+
+        component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+        componentVersionBeforeUpdate = component.getVersion();
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        numberOfArtifact = deploymentArtifacts.size();
+
+        // create component/s & upload artifact via external api
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            restResponse = updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
+        } else {
+            restResponse = updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
+        }
+
+        ArtifactDefinition responseArtifact = ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
+        component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+
+        // Get list of deployment artifact + download them via external API
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
+        Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate) + 1)), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Expected that aftifact version will increase by one.");
+
+        if (chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
+            Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
+        } else {
+            Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeUpdate) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
+        }
+
+        // Download the uploaded artifact via external API
+        downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
+
+        return component;
+    }
+
+
+    // Update artifact via external API + Check auditing for upload operation + Check response of external API
+    protected RestResponse updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, component.getComponentInstances().get(0), artifactUUID);
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+        return restResponse;
+    }
+
+
+    // Update artifact via external API + Check auditing for upload operation + Check response of external API
+    protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID);
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+        return restResponse;
+    }
+
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    //					Delete External API											  //
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    @DataProvider(name = "deleteArtifactForServiceViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactForServiceViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ArtifactTypeEnum.OTHER.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CERTIFY, ArtifactTypeEnum.OTHER.getType()}
+        };
+    }
+
+    // Delete artifact for Service - Success
+    @Test(dataProvider = "deleteArtifactForServiceViaExternalAPI")
+    public void deleteArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+        deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum);
+    }
+
+    @DataProvider(name = "deleteArtifactForVFViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactForVFViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_JSON.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_POLICY.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_EVENT.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.APPC_CONFIG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_DOC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_TOSCA.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType()},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+        };
+    }
+
+    // Delete artifact for VF - Success
+    @Test(dataProvider = "deleteArtifactForVFViaExternalAPI")
+    public void deleteArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+        deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
+    }
+
+    @DataProvider(name = "deleteArtifactForVfcVlCpViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactForVfcVlCpViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.YANG_XML.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VNF_CATALOG.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VF_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.MODEL_QUERY_SPEC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+    // Delete artifact for VFC, VL, CP - Success
+    @Test(dataProvider = "deleteArtifactForVfcVlCpViaExternalAPI")
+    public void deleteArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
+    }
+
+    @DataProvider(name = "deleteArtifactOnRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOnRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), null},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), null},
+
+        };
+    }
+
+
+    @Test(dataProvider = "deleteArtifactOnRIViaExternalAPI")
+    public void deleteArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
+    }
+
+    @DataProvider(name = "deleteArtifactOnVfcVlCpRIViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOnVfcVlCpRIViaExternalAPI() {
+        return new Object[][]{
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP,},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VFC},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VFC},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.VL},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.VL},
+
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_POLL.getType(), ResourceTypeEnum.CP},
+                {LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.SNMP_TRAP.getType(), ResourceTypeEnum.CP},
+        };
+    }
+
+    @Test(dataProvider = "deleteArtifactOnVfcVlCpRIViaExternalAPI")
+    public void deleteArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+        deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
+    }
+
+    @DataProvider(name = "deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
+        return new Object[][]{
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+                {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
+        };
+    }
+
+    // External API
+    // Delete artifact by different user then creator of asset - Fail
+    @Test(dataProvider = "deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+    public void deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, userRoleEnum %s, lifeCycleStatesEnum %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, lifeCycleStatesEnum, artifactType, null);
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+        String artifactUUID = null;
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+        List<String> variables = asList();
+
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+                    component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, lifeCycleStatesEnum, true);
+        } else {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+                    null, artifactUUID, errorInfo, variables, lifeCycleStatesEnum, true);
+        }
+
+        //TODO
 //		downloadResourceDeploymentArtifactExternalAPI(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, componentTypeEnum);
-	}
-	
-	
-	@DataProvider(name="deleteArtifactOnAssetWhichNotExist", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOnAssetWhichNotExist() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType(), null},
-			{ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType(), null},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
-			};
-	}
-		
+    }
 
-	// External API
-	// Upload artifact on VF via external API - happy flow
-	@Test(dataProvider="deleteArtifactOnAssetWhichNotExist")
-	public void deleteArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
-		
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		
-		String artifactUUID = null;
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		
-		// Invalid artifactUUID
-		String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
-		List<String> variables = asList(invalidArtifactUUID);
-		
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), invalidArtifactUUID, errorInfo, variables, null, true);
-		} else {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, invalidArtifactUUID, errorInfo, variables, null, true);
 
-		}
-		
-		
-		// Invalid componentUUID	
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
-			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
-			variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, true);
-		} else {
-			component.setUUID("invalidComponentUUID");
-			if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE)) {
-				errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
-			} else {
-				errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.SERVICE_NOT_FOUND.name());
-			}
-			variables = asList("invalidComponentUUID");
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
-		}
-		
-		
-//		performeClean();
-		
-	}
-	
-	@DataProvider(name="deleteArtifactOnAssetWhichInInvalidStateForUploading", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
-		return new Object[][] {
-			{ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType()},
-			{ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},
-			};
-	}
-	
-	
-	@Test(dataProvider="deleteArtifactOnAssetWhichInInvalidStateForUploading")
-	public void deleteArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
-		getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
-		Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
-		
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		String artifactUUID = null;
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		
-		
-		// Invalid artifactUUID
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
-		List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
-				ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
-		
-		if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null, true);
-		} else {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-					null, artifactUUID, errorInfo, variables, null, true);
+    @DataProvider(name = "deleteArtifactOnAssetWhichNotExist", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOnAssetWhichNotExist() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType(), null},
+                {ComponentTypeEnum.RESOURCE, ArtifactTypeEnum.OTHER.getType(), null},
+                {ComponentTypeEnum.RESOURCE_INSTANCE, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(), ResourceTypeEnum.VF},
+        };
+    }
 
-		}
-		
-	}
-	
-	
-	@DataProvider(name="deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI", parallel=true) 
-	public static Object[][] dataProviderDeleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
-		return new Object[][] {
-			{ResourceTypeEnum.VFC},
-			{ResourceTypeEnum.VL},
-			{ResourceTypeEnum.CP}
-			};
-	}
-	
-	
-	// Verify that it cannot delete VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
-	@Test(dataProvider="deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
-	public void deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
+    // External API
+    // Upload artifact on VF via external API - happy flow
+    @Test(dataProvider = "deleteArtifactOnAssetWhichNotExist")
+    public void deleteArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
 
-		getExtendTest().log(Status.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
-		
-		Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
-		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", ArtifactTypeEnum.SNMP_TRAP.getType(), true, false);
-		uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
-		resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
-		Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
-		AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
-		component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
-		
-		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
-		Map<String, ArtifactDefinition> deploymentArtifacts;
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
-		String artifactUUID = null;
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")) {
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				break;
-			}
-		}
-		List<String> variables = asList(artifactUUID);
-		deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
-				component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null, true);
-	}
-	
-	protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails,
-			ComponentInstance componentInstance, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean resourceNameInAudit) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentInstance != null) {
-			restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, componentInstance, artifactUUID);
-		} else {
-			restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(component, sdncModifierDetails, artifactUUID);
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
 
-		}
-		
-		// validate response code
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-				
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
-				
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-//		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
-		
-		responseArtifact.setUpdaterFullName("");
-		responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, component.getUUID(), errorInfo, variables);
-		expectedExternalAudit.setRESOURCE_NAME(component.getName());
-		expectedExternalAudit.setRESOURCE_TYPE(component.getComponentType().getValue());
-		expectedExternalAudit.setARTIFACT_DATA(null);
-		expectedExternalAudit.setCURR_ARTIFACT_UUID(artifactUUID);
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-		if(componentInstance != null) {
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getComponentInstances().get(0).getNormalizedName());
-			expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + component.getComponentInstances().get(0).getNormalizedName() + "/artifacts/" + artifactUUID);
-			expectedExternalAudit.setRESOURCE_NAME(component.getComponentInstances().get(0).getNormalizedName());
-		} else {
-			expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL() + "/" + artifactUUID);
-			if((errorInfo.getMessageId().equals(ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name()).getMessageId())) || 
-					errorInfo.getMessageId().equals(ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name()).getMessageId()) ||
-					(lifeCycleStatesEnum == LifeCycleStatesEnum.STARTCERTIFICATION)) {
-				if(resourceNameInAudit) {
-					expectedExternalAudit.setRESOURCE_NAME(component.getName());
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-				} else {
-					expectedExternalAudit.setRESOURCE_NAME("");
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
-				}
-			} else {
-				if(resourceNameInAudit) {
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-				} else {
-					expectedExternalAudit.setRESOURCE_NAME("");
-					body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
-				}
-			}
-		}
-		
-//		getExtendTest().log(LogStatus.INFO, "Audit Action: " + AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName());
-//		body.forEach((k,v)->getExtendTest().log(LogStatus.INFO,"key : " + k + " value : " + v));
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);*/
-		
-		return restResponse;
-	
-	}
-	
-	
-	// Happy flow - get chosen life cycle state, artifact type and asset type
-	// delete artifact via external API + check audit & response code
-	protected Component deleteArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState) throws Exception {
-		String artifactName = null;
-		component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
-		if(!LifeCycleStatesEnum.CHECKOUT.equals(chosenLifeCycleState)){
-			component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
-		}else{		
-			component = getNewerVersionOfComponent(component, chosenLifeCycleState);	
-		}
-		// get updated artifact data
-		String artifactUUID = null;
-		int moduleTypeArtifact = 0;
-		Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		
-		for (String key : deploymentArtifacts.keySet()) {
-			if (key.startsWith("ci")  && StringUtils.isNotEmpty(deploymentArtifacts.get(key).getArtifactUUID())) {
-				artifactName = key;
-				artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
-				
-				if (deploymentArtifacts.get(key).getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA)){
-					moduleTypeArtifact = 1; 
-				}
-				break;
-			}
-		}
-		
-		String componentVersionBeforeDelete = component.getVersion();
-		int numberOfArtifact = deploymentArtifacts.size();
-				
-		// create component/s & upload artifact via external api
-		if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
-			deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
-		} else {
-			deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
-		}	
-		
-		component = updateComponentDetailsByLifeCycleState(chosenLifeCycleState, component);
-			
-		// Get list of deployment artifact + download them via external API
-		deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
-		if(deploymentArtifacts.get(artifactName) != null) {
-			Assert.assertTrue(false, "Expected that deleted artifact will not appear in deployment artifact list.");
-		}
-		if((LifeCycleStatesEnum.CERTIFICATIONREQUEST.equals(chosenLifeCycleState)) && (ComponentTypeEnum.RESOURCE_INSTANCE.equals(componentTypeEnum)) && (!component.getComponentType().toString().equals(ComponentTypeEnum.RESOURCE.toString()))) {
-			Assert.assertEquals(numberOfArtifact - 1 - moduleTypeArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact (one deleted and one vfmodule) will decrease by two.");
-		} else {
-			Assert.assertEquals(numberOfArtifact - 1, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will decrease by one.");
-		}
+        String artifactUUID = null;
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
 
-		if(chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
-			Assert.assertEquals(componentVersionBeforeDelete, component.getVersion(), "Expected that check-out component will not change version number.");
-		} else {
-			Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeDelete) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
-		}
-		
-		downloadResourceDeploymentArtifactExternalAPI(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, componentTypeEnum);
-		
-		return component;
-	}
-	
-	// Delete artifact via external API + Check auditing for upload operation + Check response of external API
-	protected RestResponse deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentInstances().get(0), artifactUUID);
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-//		expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
-		expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
-		expectedExternalAudit.setRESOURCE_URL("/sdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + component.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts/" + artifactUUID);
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);*/
-		component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
-		return restResponse;
-	}
-	
-	
-	// Delete artifact via external API + Check auditing for upload operation + Check response of external API
-	protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
-		RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID);
-		
-		// Check response of external API
-		Integer responseCode = restResponse.getErrorCode();
-		Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
-		
-		
-		/*// Check auditing for upload operation
-		ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
-		
-		AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
-		
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, component.getName());
-		
-		AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((component.getComponentType().getValue() + "s").toUpperCase());
-		ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, component);
-		expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
-		AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);*/
-		component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER); 
-		return restResponse;
-	}
-	
-	
-	
-	// download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
-	protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component component, User sdncModifierDetails, String artifactUUID, ComponentTypeEnum componentTypeEnum) throws Exception {
-		RestResponse restResponse;
-		
-		if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
-			restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(component.getUUID(), component.getComponentInstances().get(0).getNormalizedName(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
-		} else {
-			restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(component.getUUID(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
-		}
-		
-		Integer responseCode = restResponse.getErrorCode();
-		Integer expectedCode = 404;
-		Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
-		
-		
-		//TODO - including body - resourceDetails.getName()
-//			// Verify audit
-//			String auditAction = "DownloadArtifact";
-//			
-//			Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-//			body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
-//			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
-//			
-//			ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
-//			expectedResourceAuditJavaObject.setAction(auditAction);
-//			expectedResourceAuditJavaObject.setResourceType(resourceDetails.getComponentType().getValue());
-//			expectedResourceAuditJavaObject.setStatus("200");
-//			expectedResourceAuditJavaObject.setDesc("OK");
-//			expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
-//			
-//			if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
-//				expectedResourceAuditJavaObject.setResourceName(resourceDetails.getComponentInstances().get(0).getName());
-//				String resource_url = String.format("/sdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s", resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID());
-//				expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-//					
-//				AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
-//			} else {
-//				expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName());
-//				String resource_url = String.format("/sdc/v1/catalog/services/%s/artifacts/%s", resourceDetails.getUUID(), artifactDefinition.getArtifactUUID());
-//				expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-//			}
-//			
-//			AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
-			
-		return restResponse;
-			
-	}
-	
-	
-	
-	
-	public Component getComponentInTargetLifeCycleState(String componentType, UserRoleEnum creatorUser, LifeCycleStatesEnum targetLifeCycleState, ResourceTypeEnum resourceTypeEnum) throws Exception {
-		Component resourceDetails = null;
-		
-		if((componentType.toLowerCase().equals("vf")) || (componentType.toLowerCase().equals("resource"))){
-			if(resourceTypeEnum==null) {
-				resourceTypeEnum = ResourceTypeEnum.VF;
-			}
-			Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(resourceTypeEnum, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, creatorUser, true);
-			resourceDetails = createdResource.left().value();
-			resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
-		} else {
-			Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(creatorUser, true);
-			resourceDetails = createdResource.left().value();
-			// Add artifact to service if asked for certifcationrequest - must be at least one artifact for the flow
-			if((LifeCycleStatesEnum.CERTIFICATIONREQUEST == targetLifeCycleState) || (LifeCycleStatesEnum.STARTCERTIFICATION == targetLifeCycleState)) {
-						AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetails, UserRoleEnum.DESIGNER, true, true).left().value();
-			}
-			resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
-		}
-		
-		return resourceDetails;
-	}
-	
+        // Invalid artifactUUID
+        String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+        List<String> variables = asList(invalidArtifactUUID);
+
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), invalidArtifactUUID, errorInfo, variables, null, true);
+        } else {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, invalidArtifactUUID, errorInfo, variables, null, true);
+
+        }
+        // Invalid componentUUID
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
+            errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
+            variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, true);
+        } else {
+            component.setUUID("invalidComponentUUID");
+            if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE)) {
+                errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+            } else {
+                errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.SERVICE_NOT_FOUND.name());
+            }
+            variables = asList("invalidComponentUUID");
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN, false);
+        }
+
+    }
+
+    @DataProvider(name = "deleteArtifactOnAssetWhichInInvalidStateForUploading", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
+        return new Object[][]{
+                {ComponentTypeEnum.SERVICE, ArtifactTypeEnum.OTHER.getType()},
+        };
+    }
+
+
+    @Test(dataProvider = "deleteArtifactOnAssetWhichInInvalidStateForUploading")
+    public void deleteArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
+        getExtendTest().log(Status.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+        Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+        component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
+
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        String artifactUUID = null;
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
+        // Invalid artifactUUID
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+        List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
+                ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
+
+        if (componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null, true);
+        } else {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                    null, artifactUUID, errorInfo, variables, null, true);
+
+        }
+
+    }
+
+    @DataProvider(name = "deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI", parallel = true)
+    public static Object[][] dataProviderDeleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
+        return new Object[][]{
+                {ResourceTypeEnum.VFC},
+                {ResourceTypeEnum.VL},
+                {ResourceTypeEnum.CP}
+        };
+    }
+
+    // Verify that it cannot delete VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
+    @Test(dataProvider = "deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+    public void deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
+
+        getExtendTest().log(Status.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
+
+        Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
+        ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", ArtifactTypeEnum.SNMP_TRAP.getType(), true, false);
+        uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+        resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+        Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+        AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+        component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+
+        ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.OK.name());
+        Map<String, ArtifactDefinition> deploymentArtifacts;
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
+        String artifactUUID = null;
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci")) {
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+                break;
+            }
+        }
+        List<String> variables = asList(artifactUUID);
+        deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+                component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null, true);
+    }
+
+    protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails,
+                                                                                          ComponentInstance componentInstance, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum, Boolean resourceNameInAudit) throws Exception {
+        RestResponse restResponse;
+
+        if (componentInstance != null) {
+            restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(component, sdncModifierDetails, componentInstance, artifactUUID);
+        } else {
+            restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(component, sdncModifierDetails, artifactUUID);
+
+        }
+
+        // validate response code
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, errorInfo.getCode(), "Response code is not correct.");
+        return restResponse;
+
+    }
+
+
+    // Happy flow - get chosen life cycle state, artifact type and asset type
+    // delete artifact via external API + check audit & response code
+    protected Component deleteArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState) throws Exception {
+        String artifactName = null;
+        component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+        if (!LifeCycleStatesEnum.CHECKOUT.equals(chosenLifeCycleState)) {
+            component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
+        } else {
+            component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+        }
+        // get updated artifact data
+        String artifactUUID = null;
+        int moduleTypeArtifact = 0;
+        Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+        for (String key : deploymentArtifacts.keySet()) {
+            if (key.startsWith("ci") && StringUtils.isNotEmpty(deploymentArtifacts.get(key).getArtifactUUID())) {
+                artifactName = key;
+                artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+
+                if (deploymentArtifacts.get(key).getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA)) {
+                    moduleTypeArtifact = 1;
+                }
+                break;
+            }
+        }
+
+        String componentVersionBeforeDelete = component.getVersion();
+        int numberOfArtifact = deploymentArtifacts.size();
+
+        // create component/s & upload artifact via external api
+        if (ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+            deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
+        } else {
+            deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
+        }
+
+        component = updateComponentDetailsByLifeCycleState(chosenLifeCycleState, component);
+
+        // Get list of deployment artifact + download them via external API
+        deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+        if (deploymentArtifacts.get(artifactName) != null) {
+            Assert.assertTrue(false, "Expected that deleted artifact will not appear in deployment artifact list.");
+        }
+        if ((LifeCycleStatesEnum.CERTIFICATIONREQUEST.equals(chosenLifeCycleState)) && (ComponentTypeEnum.RESOURCE_INSTANCE.equals(componentTypeEnum)) && (!component.getComponentType().toString().equals(ComponentTypeEnum.RESOURCE.toString()))) {
+            Assert.assertEquals(numberOfArtifact - 1 - moduleTypeArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact (one deleted and one vfmodule) will decrease by two.");
+        } else {
+            Assert.assertEquals(numberOfArtifact - 1, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will decrease by one.");
+        }
+
+        if (chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
+            Assert.assertEquals(componentVersionBeforeDelete, component.getVersion(), "Expected that check-out component will not change version number.");
+        } else {
+            Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeDelete) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
+        }
+
+        downloadResourceDeploymentArtifactExternalAPI(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, componentTypeEnum);
+
+        return component;
+    }
+
+    // Delete artifact via external API + Check auditing for upload operation + Check response of external API
+    protected RestResponse deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component component, ComponentInstance componentInstance, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentInstances().get(0), artifactUUID);
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+//		component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
+        return restResponse;
+    }
+
+
+    // Delete artifact via external API + Check auditing for upload operation + Check response of external API
+    protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component component, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+        RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID);
+
+        // Check response of external API
+        Integer responseCode = restResponse.getErrorCode();
+        Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+//		component = AtomicOperationUtils.getComponentObject(component, UserRoleEnum.DESIGNER);
+        return restResponse;
+    }
+
+
+    // download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
+    protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component component, User sdncModifierDetails, String artifactUUID, ComponentTypeEnum componentTypeEnum) throws Exception {
+        RestResponse restResponse;
+
+        if (componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+            restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(component.getUUID(), component.getComponentInstances().get(0).getNormalizedName(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
+        } else {
+            restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(component.getUUID(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), component.getComponentType().toString());
+        }
+
+        Integer responseCode = restResponse.getErrorCode();
+        Integer expectedCode = 404;
+        Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
+
+        return restResponse;
+
+    }
+
+
+    public Component getComponentInTargetLifeCycleState(String componentType, UserRoleEnum creatorUser, LifeCycleStatesEnum targetLifeCycleState, ResourceTypeEnum resourceTypeEnum) throws Exception {
+        Component resourceDetails = null;
+
+        if ((componentType.toLowerCase().equals("vf")) || (componentType.toLowerCase().equals("resource"))) {
+            if (resourceTypeEnum == null) {
+                resourceTypeEnum = ResourceTypeEnum.VF;
+            }
+            Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(resourceTypeEnum, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, creatorUser, true);
+            resourceDetails = createdResource.left().value();
+            resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+        } else {
+            Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(creatorUser, true);
+            resourceDetails = createdResource.left().value();
+            // Add artifact to service if asked for certifcationrequest - must be at least one artifact for the flow
+            if ((LifeCycleStatesEnum.CERTIFICATIONREQUEST == targetLifeCycleState) || (LifeCycleStatesEnum.STARTCERTIFICATION == targetLifeCycleState)) {
+                AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetails, UserRoleEnum.DESIGNER, true, true).left().value();
+            }
+            resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+        }
+        return resourceDetails;
+    }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/DeploymentValiditaion.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/DeploymentValiditaion.java
index 9e82a81..fb60f44 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/DeploymentValiditaion.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/DeploymentValiditaion.java
@@ -52,8 +52,9 @@
 import java.nio.file.Paths;
 import java.util.*;
 import java.util.stream.Collectors;
+
 import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertTrue;
+
 public class DeploymentValiditaion extends ComponentBaseTest{
 
 	@Rule
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
index 9db9e8a..917d980 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
@@ -20,6 +20,7 @@
 
 package org.openecomp.sdc.externalApis;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
@@ -27,7 +28,6 @@
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
@@ -49,7 +49,9 @@
 import org.openecomp.sdc.ci.tests.utils.Utils;
 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.*;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
 import org.openecomp.sdc.common.api.Constants;
 import org.testng.annotations.Test;
 
@@ -127,13 +129,13 @@
 		resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
 		expectedAssetNamesList.add(resourceDetails.getName());
 
-		resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails);
+/*		resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails);
 		resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
 		resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
 		resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
-		expectedAssetNamesList.add(resourceDetails.getName());
+		expectedAssetNamesList.add(resourceDetails.getName());*/
 
-		System.out.println("7 VF resources were created");
+		System.out.println("6 VF resources were created");
 
 		RestResponse assetResponse = AssetRestUtils.getComponentListByAssetType(true, AssetTypeEnum.RESOURCES);
 		BaseRestUtils.checkSuccess(assetResponse);
@@ -146,8 +148,8 @@
 
 	/*	// Validate audit message
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_ASSET_LIST);
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-        body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+        body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
         AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body);*/
 
 	}
@@ -225,8 +227,8 @@
 
 		/*// Validate audit message
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(AssetTypeEnum.SERVICES, AuditingActionEnum.GET_ASSET_LIST);
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-        body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+        body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
         AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body);*/
 
 	}
@@ -234,25 +236,35 @@
 	@Test(enabled = false)
 	public void getToscaModelSuccess() throws Exception {
 
-		CloseableHttpClient httpclient = HttpClients.createDefault();
-		ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails);
-		Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
-		HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.RESOURCES, resource.getUUID());
-		resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-		String artId = resource.getToscaArtifacts().get("assettoscacsar").getEsId();
-		String url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), resource.getUniqueId(), artId);
-		HttpGet httpGet = createGetRequest(url);
-		HttpResponse response = httpclient.execute(httpGet);
-		InputStream inputStream = response.getEntity().getContent();
-		ArtifactUiDownloadData artifactUiDownloadData = getArtifactUiDownloadData(IOUtils.toString(inputStream));
+		Resource resource;
+		HttpResponse assetResponse;
+		HttpResponse response;
+		InputStream inputStream;
+		ArtifactUiDownloadData artifactUiDownloadData;
+		int len;
+		byte[] res;
+		byte[] fromUiDownload;
+		String fileName;
+		try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
+			ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails);
+			resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
+			assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.RESOURCES, resource.getUUID());
+			resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+			String artId = resource.getToscaArtifacts().get("assettoscacsar").getEsId();
+			String url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), resource.getUniqueId(), artId);
+			HttpGet httpGet = createGetRequest(url);
+			response = httpclient.execute(httpGet);
+		}
+		inputStream = response.getEntity().getContent();
+		artifactUiDownloadData = getArtifactUiDownloadData(IOUtils.toString(inputStream));
 		assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.RESOURCES, resource.getUUID());
 		inputStream = assetResponse.getEntity().getContent();
-		int len = (int) assetResponse.getEntity().getContentLength();
-		byte[] res = new byte[len];
+		len = (int) assetResponse.getEntity().getContentLength();
+		res = new byte[len];
 		inputStream.read(res, 0, len);
-		byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
+		fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
 		assertEquals(Base64.encodeBase64(res), fromUiDownload);
-		String fileName = assetResponse.getFirstHeader(Constants.CONTENT_DISPOSITION_HEADER).getValue();
+		fileName = assetResponse.getFirstHeader(Constants.CONTENT_DISPOSITION_HEADER).getValue();
 		assertEquals(fileName, new StringBuilder().append("attachment; filename=\"")
 				.append(artifactUiDownloadData.getArtifactName()).append("\"").toString());
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetCSARofVF.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetCSARofVF.java
index fbbd394..57c678e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetCSARofVF.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetCSARofVF.java
@@ -197,6 +197,7 @@
 		expectedDefinitionFolderFileList.add("Definitions/data.yml");
 		expectedDefinitionFolderFileList.add("Definitions/capabilities.yml");
 		expectedDefinitionFolderFileList.add("Definitions/artifacts.yml");
+		expectedDefinitionFolderFileList.add("Definitions/annotations.yml");
 		
 		Enumeration<? extends ZipEntry> entries = zipFile.entries();
 		while(entries.hasMoreElements()){
@@ -225,8 +226,8 @@
 		expectedAudit.setRESOURCE_TYPE(resource.getComponentType().getValue());
 //		AuditValidationUtils.validateExternalAudit(expectedAudit, AuditingActionEnum.GET_TOSCA_MODEL.getName(),	null);
 
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-        body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, expectedAudit.getRESOURCE_NAME());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+        body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, expectedAudit.getRESOURCE_NAME());
         AuditValidationUtils.validateExternalAudit(expectedAudit, AuditingActionEnum.GET_TOSCA_MODEL.getName(), body);
 
 	}*/
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
index 57a0f26..fd230d4 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
@@ -37,7 +37,6 @@
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
 import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
-import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
@@ -388,8 +387,8 @@
 
 		/*// Validate audit message
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getFilteredAssetListAuditCategoryNotFound(AssetTypeEnum.RESOURCES, "?" + query, "Application L3+");
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-        body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+        body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
         AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);*/
 
 	}
@@ -444,7 +443,7 @@
 
 	}
 
-	@Test
+	/*@Test
 	public void getFilteredServiceAssetInformationalSuccess() throws Exception {
 
 		List<String> expectedAssetNamesList = new ArrayList<>();
@@ -500,10 +499,7 @@
 		List<String> getActualAssetNamesList = AssetRestUtils.getServiceNamesList(resourceAssetList);
 		Utils.compareArrayLists(getActualAssetNamesList, expectedAssetNamesList, "Element");
 
-		/*// Validate audit message
-		validateFilteredAudit(query, AssetTypeEnum.SERVICES);*/
-
-	}
+	}*/
 
 	@Test
 	public void getFilteredServiceAssetDeploymentSuccess() throws Exception {
@@ -567,15 +563,15 @@
 	/*private void validateSuccessAudit(String[] filter, AssetTypeEnum assetType) throws Exception {
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(assetType, AuditingActionEnum.GET_FILTERED_ASSET_LIST);
 		expectedAssetListAudit.setRESOURCE_URL(AssetRestUtils.buildUrlWithFilter(expectedAssetListAudit.getRESOURCE_URL(), filter));
-		Map<AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map<AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
 	}
 
 	private void validateFilteredAudit(String query, AssetTypeEnum assetType) throws Exception {
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultFilteredAssetListAudit(assetType, "?" + query);
-		Map<AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map<AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
 	}
 
@@ -584,8 +580,8 @@
 		expectedAssetListAudit.setRESOURCE_URL(AssetRestUtils.buildUrlWithFilter(expectedAssetListAudit.getRESOURCE_URL(), filter));
 		expectedAssetListAudit.setSTATUS(errorInfo.getCode().toString());
 		expectedAssetListAudit.setDESC(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
-		Map<AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map<AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
 	}*/
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
index c036c7f..6bd47e9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
@@ -20,14 +20,11 @@
 
 package org.openecomp.sdc.externalApis;
 
-import java.util.ArrayList;
-
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -39,14 +36,12 @@
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 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.AssetRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-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.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+
 public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
 
 	@Rule
@@ -106,7 +101,7 @@
 		Resource resource2 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
 		resource2 = (Resource) AtomicOperationUtils.changeComponentState(resource2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
 		Resource resource3 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
-		resource3 = (Resource) AtomicOperationUtils.changeComponentState(resource3, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
+		resource3 = (Resource) AtomicOperationUtils.changeComponentState(resource3, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
 
 		AtomicOperationUtils.addComponentInstanceToComponentContainer(resource2, resourceVF, UserRoleEnum.DESIGNER, true);
 		AtomicOperationUtils.addComponentInstanceToComponentContainer(resource3, resourceVF, UserRoleEnum.DESIGNER, true);
@@ -129,7 +124,7 @@
 		validateAudit(resourceVF, AssetTypeEnum.RESOURCES);*/
 	}
 
-	@Test // (enabled = false)
+	/*@Test // (enabled = false)
 	public void getResourceAssetMetadataWithResourceInstancesVfInSubmitForTestingSuccess() throws Exception {
 
 		Resource resourceVF = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
@@ -155,9 +150,9 @@
 		ResourceDetailedAssetStructure resourceAssetMetadata = AssetRestUtils.getResourceAssetMetadata(assetResponse);
 		AssetRestUtils.resourceMetadataValidatior(resourceAssetMetadata, resourceVF, AssetTypeEnum.RESOURCES);
 
-	/*	// Validate audit message
-		validateAudit(resourceVF, AssetTypeEnum.RESOURCES);*/
-	}
+	*//*	// Validate audit message
+		validateAudit(resourceVF, AssetTypeEnum.RESOURCES);*//*
+	}*/
 
 	@Test // (enabled = false)
 	public void getResourceAssetMetadataWithResourceInstancesVfInStartCertificationSuccess() throws Exception {
@@ -219,7 +214,7 @@
 		validateAudit(resourceVF, AssetTypeEnum.RESOURCES);*/
 	}
 
-	@Test // (enabled = false)
+	/*@Test // (enabled = false)
 	public void getResourceAssetMetadataWithNonCertifiedResourceInstancesAndArtifactsSuccess() throws Exception {
 
 		Resource resourceVF = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
@@ -241,9 +236,7 @@
 		ResourceDetailedAssetStructure resourceAssetMetadata = AssetRestUtils.getResourceAssetMetadata(assetResponse);
 		AssetRestUtils.resourceMetadataValidatior(resourceAssetMetadata, resourceVF, AssetTypeEnum.RESOURCES);
 
-		/*// Validate audit message
-		validateAudit(resourceVF, AssetTypeEnum.RESOURCES);*/
-	}
+	}*/
 
 
 	// Import CSAR
@@ -404,8 +397,8 @@
 
 	/*private void validateAudit(Component component, AssetTypeEnum assetType) throws Exception {
 		ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetMetadataAudit(assetType, component);
-		Map<AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
+		Map<AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_METADATA.getName(), body);
 	}*/
 
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/SearchFilterCategoryExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/SearchFilterCategoryExternalAPI.java
index 8b174e5..e446dc3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/SearchFilterCategoryExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/SearchFilterCategoryExternalAPI.java
@@ -101,8 +101,8 @@
 		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_FILTER_KEY.name());
 		expectedExternalAudit.setDESC(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
 		expectedExternalAudit.setSTATUS("400");
-		Map<AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+		Map<AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
 	}*/
 
@@ -129,8 +129,8 @@
 		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
 		expectedExternalAudit.setDESC(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
 		expectedExternalAudit.setSTATUS("400");
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
 		AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);*/
 	}
 	
@@ -157,8 +157,8 @@
 			
 			
 			/*ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + resourceTypeEnum.toString());
-			Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+			Map <AuditingFieldsKey, String> body = new HashMap<>();
+			body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
 			AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);*/
 		}
 	}
@@ -179,8 +179,8 @@
 			validateJsonContainResource(restResponse.getResponse(), createdResoucesName, true);
 			
 			/*ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + resourceTypeEnum.toString());
-			Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+			Map <AuditingFieldsKey, String> body = new HashMap<>();
+			body.put(AuditingFieldsKey.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
 			AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);*/
 		}
 	}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/UserAPIs.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/UserAPIs.java
index 2d1d87e..67c7fb0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/UserAPIs.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/UserAPIs.java
@@ -20,17 +20,8 @@
 
 package org.openecomp.sdc.externalApis;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.portalsdk.core.restful.domain.EcompRole;
@@ -51,8 +42,12 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class UserAPIs extends ComponentBaseTest {
 	
@@ -311,7 +306,7 @@
 		}
 	}
 	
-	@Test
+	/*@Test
 	public void deactivateUserRoleWithStartTestingResource() throws Exception {
 		
 		EcompUser ecompUser = new EcompUser();
@@ -364,7 +359,7 @@
 			ResourceRestUtils.deleteResource(resource.getUniqueId(), adminUser.getUserId());
 			deleteUser(ecompUser.getLoginId());
 		}
-	}
+	}*/
 	
 	@Test
 	public void changeUserRoleWithStartTestingResource() throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/VFCMTExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/VFCMTExternalAPI.java
index 4cd5c1c..8c3404e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/VFCMTExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/VFCMTExternalAPI.java
@@ -104,8 +104,8 @@
 
 	/*	// auditing verification
 		AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
 		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(parsedCreatedResponse.getName());
 		AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);*/
 		
@@ -152,8 +152,8 @@
 
 		/*// auditing verification
 		AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
 		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(parsedCreatedResponse.getName());	
 		AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);*/
 		
@@ -161,7 +161,7 @@
 		RestResponse secondTryToCreate = ResourceRestUtilsExternalAPI.createResource(defaultResource, defaultUser);
 		Assert.assertEquals((int)secondTryToCreate.getErrorCode(), 409);
 		
-		/*body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, "409");
+		/*body.put(AuditingFieldsKey.AUDIT_STATUS, "409");
 		ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name());
 		List<String> variables = asList(ComponentTypeEnum.RESOURCE.getValue(), defaultResource.getName());
 		expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
@@ -212,8 +212,8 @@
 		/*List<String> variables = null;
 		AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
 		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(defaultResource.getName());	
-		Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
-		body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, defaultResource.getName());*/
+		Map <AuditingFieldsKey, String> body = new HashMap<>();
+		body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, defaultResource.getName());*/
 		
 		switch (flow) {
 		case "name_missing":
@@ -224,21 +224,21 @@
 			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_COMPONENT_NAME.name());
 			/*expectedResourceAuditJavaObject.setResourceName("");
 			variables = asList(ComponentTypeEnum.RESOURCE.getValue());
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "");*/
+			body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, "");*/
 			break;
 		case "name_to_long":
 			defaultResource.setName("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
 			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name());
 			/*expectedResourceAuditJavaObject.setResourceName("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
 			variables = asList(ComponentTypeEnum.RESOURCE.getValue(), "1024");
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");*/
+			body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, "asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");*/
 			break;
 		case "name_with_invalid_char":
 			defaultResource.setName("!@#$%^&*(");
 			errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_COMPONENT_NAME.name());
 			/*expectedResourceAuditJavaObject.setResourceName("!@#$%^&*(");
 			variables = asList(ComponentTypeEnum.RESOURCE.getValue());
-			body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "!@#$%^&*(");*/
+			body.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME, "!@#$%^&*(");*/
 			break;
 		case "description_missing":
 			defaultResource.setDescription("");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/internalApis/annotations/AnnotationsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/internalApis/annotations/AnnotationsTest.java
new file mode 100644
index 0000000..05d7a80
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/internalApis/annotations/AnnotationsTest.java
@@ -0,0 +1,201 @@
+package org.openecomp.sdc.internalApis.annotations;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.utils.MapUtil;
+import org.openecomp.sdc.be.datatypes.elements.Annotation;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.utils.ComponentUtilities;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaAnnotationsTypesDefinition;
+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.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
+import org.testng.annotations.Test;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.toMap;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaAnnotationsTypesDefinition.SOURCE_ANNOTATION;
+import static org.openecomp.sdc.ci.tests.utils.ToscaTypesDefinitionUtils.getToscaAnnotationsFromCsar;
+import static org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils.*;
+import static org.openecomp.sdc.ci.tests.utils.general.ElementFactory.getDefaultUser;
+import static org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils.deleteInputFromComponent;
+import static org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils.checkSuccess;
+import static org.springframework.util.CollectionUtils.isEmpty;
+
+public class AnnotationsTest extends ComponentBaseTest{
+
+    private static final String PCM_FLAVOR_NAME = "pcm_flavor_name";
+    private static final String AVAILABILITY_ZONE = "availabilityzone_name";
+    private static final String NET_NAME = "net_name";
+    private static final String NF_NAMING_CODE = "nf_naming_code";
+    private static final String [] PROPS_TO_DECLARE = new String [] {PCM_FLAVOR_NAME, AVAILABILITY_ZONE, NET_NAME, NF_NAMING_CODE};
+    private static final String CSAR_WITH_ANNOTATIONS_V1 = "SIROV_annotations_VSP.csar";
+    private static final String CSAR_WITH_ANNOTATIONS_V2 = "SIROV_annotations_VSP_V2.csar";
+    private static final String SRIOV_PATH = FileHandling.getFilePath("SRIOV");
+
+    @Rule
+    public static TestName name = new TestName();
+
+    public AnnotationsTest() {
+        super(name, AnnotationsTest.class.getName());
+    }
+
+    @Test
+    public void whenExportingToscaOfTopologyTemplate_annotationTypeYamlExist_sourceAnnotationExist() throws Exception {
+        User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+        ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType("exportToscaAnnotationsYml", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncModifierDetails.getUserId(), ResourceTypeEnum.VF.toString());
+        Resource createdVF = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
+        ToscaAnnotationsTypesDefinition toscaAnnotations = getToscaAnnotationsFromCsar(createdVF, sdncModifierDetails);
+        assertTrue(toscaAnnotations.getAnnotation_types().containsKey(SOURCE_ANNOTATION));
+    }
+
+    @Test
+    public void whenDeclaringAnInputFromPropertyWhichOriginatedFromInputWithAnnotation_copyAnnotationsToNewInput() throws Exception {
+        Resource vfWithAnnotationsV1 = importAnnotationsCsarAndCheckIn();
+        Service service = createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+        ComponentInstance createdCmptInstance = addComponentInstanceToComponentContainer(vfWithAnnotationsV1, service).left().value();
+        Service fetchedService = getServiceObject(service.getUniqueId());
+        List<ComponentInstanceInput> declaredProps = declareProperties(fetchedService, createdCmptInstance, PROPS_TO_DECLARE);
+        verifyAnnotationsOnDeclaredInputs(vfWithAnnotationsV1, fetchedService, declaredProps);
+        Service serviceAfterPropertyDeclaration = getServiceObject(service.getUniqueId());
+        deleteDeclaredInputsAndVerifySuccess(serviceAfterPropertyDeclaration);
+    }
+
+    @Test
+    public void onChangeVersion_copyAnnotationsFromNewVspToServiceInputs() throws Exception {
+        Resource vfWithAnnotationsV1 = importAnnotationsCsarAndCheckIn();
+        Service service = createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+        ComponentInstance createdCmptInstance = addComponentInstanceToComponentContainer(vfWithAnnotationsV1, service).left().value();
+        Service fetchedService = getServiceObject(service.getUniqueId());
+        declareProperties(fetchedService, createdCmptInstance, PROPS_TO_DECLARE);
+
+        Resource vfWithAnnotationsV2 = updateAnnotationsCsarAndCheckIn(vfWithAnnotationsV1);
+        Pair<Component, ComponentInstance> changeVersionRes = changeComponentInstanceVersion(service, createdCmptInstance, vfWithAnnotationsV2, UserRoleEnum.DESIGNER, true).left().value();
+        Component serviceAfterChangeVersion = changeVersionRes.getKey();
+        ComponentInstance newInstance = changeVersionRes.getRight();
+        List<ComponentInstanceInput> declaredProps = getInstanceProperties(serviceAfterChangeVersion, newInstance.getUniqueId(), PROPS_TO_DECLARE);
+        verifyAnnotationsOnDeclaredInputs(vfWithAnnotationsV2, serviceAfterChangeVersion, declaredProps);
+
+    }
+
+    private void verifyAnnotationsOnDeclaredInputs(Resource vfWithAnnotations, Component fetchedService, List<ComponentInstanceInput> declaredProps) throws Exception {
+        Map<String, InputDefinition> serviceLevelInputsByProperty = getCreatedInputsByProperty(fetchedService, declaredProps);
+        Map<String, List<Annotation>> annotationsFromVfLevelInputs = getAnnotationsByInputName(vfWithAnnotations);
+        verifyInputsAnnotation(serviceLevelInputsByProperty, declaredProps, annotationsFromVfLevelInputs);
+    }
+
+    private Map<String, List<Annotation>> getAnnotationsByInputName(Resource resource) {
+        return resource.getInputs()
+                .stream()
+                .collect(toMap(InputDefinition::getName, input -> ComponentUtilities.getInputAnnotations(resource, input.getName())));
+    }
+
+    private void deleteDeclaredInputsAndVerifySuccess(Component service) throws Exception {
+        for (InputDefinition declaredInput : service.getInputs()) {
+            RestResponse deleteInputResponse = deleteInputFromComponent(service, declaredInput.getUniqueId());
+            checkSuccess(deleteInputResponse);
+        }
+        Service fetchedService = getServiceObject(service.getUniqueId());
+        assertThat(fetchedService.getInputs()).isNullOrEmpty();
+    }
+
+    private void verifyInputsAnnotation(Map<String, InputDefinition> inputsByProperty, List<ComponentInstanceInput> declaredProps, Map<String, List<Annotation>> expectedAnnotationsByInput) {
+        Map<String, ComponentInstanceInput> propsByName = MapUtil.toMap(declaredProps, ComponentInstanceInput::getName);
+
+        InputDefinition declaredFromPcmFlavourName = findInputDeclaredFromProperty(PCM_FLAVOR_NAME, inputsByProperty, propsByName);
+        verifyInputAnnotations(declaredFromPcmFlavourName, expectedAnnotationsByInput.get(PCM_FLAVOR_NAME));
+
+        InputDefinition declaredFromAvailabilityZone = findInputDeclaredFromProperty(AVAILABILITY_ZONE, inputsByProperty, propsByName);
+        verifyInputAnnotations(declaredFromAvailabilityZone, expectedAnnotationsByInput.get(AVAILABILITY_ZONE));
+
+        InputDefinition declaredFromNetName = findInputDeclaredFromProperty(NET_NAME, inputsByProperty, propsByName);
+        verifyInputAnnotations(declaredFromNetName, expectedAnnotationsByInput.get(NET_NAME));
+
+        InputDefinition declaredFromNFNamingCode = findInputDeclaredFromProperty(NF_NAMING_CODE, inputsByProperty, propsByName);
+        verifyInputHasNoAnnotations(declaredFromNFNamingCode);
+    }
+
+    private void verifyInputHasNoAnnotations(InputDefinition inputWithoutAnnotation) {
+        assertThat(inputWithoutAnnotation.getAnnotations()).isNullOrEmpty();
+    }
+
+    private InputDefinition findInputDeclaredFromProperty(String propName, Map<String, InputDefinition> inputsByProperty, Map<String, ComponentInstanceInput> propsByName) {
+        String propId = propsByName.get(propName).getUniqueId();
+        return inputsByProperty.get(propId);
+    }
+
+    private Map<String, InputDefinition> getCreatedInputsByProperty(Component service, List<ComponentInstanceInput> declaredProps) throws Exception {
+        Service fetchedService = getServiceObject(service.getUniqueId());
+        List<InputDefinition> inputs = fetchedService.getInputs();
+        return filterInputsCreatedByDeclaringFromProperties(declaredProps, inputs);
+    }
+
+    private Map<String, InputDefinition> filterInputsCreatedByDeclaringFromProperties(List<ComponentInstanceInput> declaredProps, List<InputDefinition> inputs) {
+        List<String> declaredPropsIds = declaredProps.stream().map(ComponentInstanceInput::getUniqueId).collect(Collectors.toList());
+        Map<String, InputDefinition> inputsByPropertyId = MapUtil.toMap(inputs, InputDefinition::getPropertyId);
+        return Maps.filterKeys(inputsByPropertyId, declaredPropsIds::contains);
+    }
+
+    private Resource importAnnotationsCsarAndCheckIn() throws Exception {
+        Resource annotationsVF = importResourceFromCsar(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, CSAR_WITH_ANNOTATIONS_V1, SRIOV_PATH);
+        changeComponentState(annotationsVF, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
+        return annotationsVF;
+    }
+
+    private Resource updateAnnotationsCsarAndCheckIn(Resource vfToUpdate) throws Exception {
+        changeComponentState(vfToUpdate, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true);
+        Resource annotationsVfV2 = updateResourceFromCsar(vfToUpdate, UserRoleEnum.DESIGNER, CSAR_WITH_ANNOTATIONS_V2, SRIOV_PATH);
+        changeComponentState(annotationsVfV2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
+        return annotationsVfV2;
+    }
+
+    private List<ComponentInstanceInput> declareProperties(Service service, ComponentInstance instance, String ... propertiesToDeclareNames) throws Exception {
+        Map<String, List<ComponentInstanceInput>> propertiesToDeclare = getServiceInstancesProps(service, instance.getUniqueId(), propertiesToDeclareNames);
+        RestResponse restResponse = PropertyRestUtils.declareProporties(service, propertiesToDeclare, getDefaultUser(UserRoleEnum.DESIGNER));
+        checkSuccess(restResponse);
+        return propertiesToDeclare.get(instance.getUniqueId());
+    }
+
+    private List<ComponentInstanceInput> getInstanceProperties(Component service, String ofInstance, String ... propsNames) {
+        return getServiceInstancesProps(service, ofInstance, propsNames).get(ofInstance);
+    }
+
+    private void verifyInputAnnotations(InputDefinition input, List<Annotation> expectedAnnotations) {
+        if (isEmpty(expectedAnnotations)) {
+            assertThat(input.getAnnotations()).isNullOrEmpty();
+            return;
+        }
+        assertThat(input.getAnnotations())
+                .usingElementComparatorOnFields("type", "name", "properties")
+                .isNotEmpty()
+                .containsExactlyElementsOf(expectedAnnotations);
+    }
+
+    private Map<String, List<ComponentInstanceInput>> getServiceInstancesProps(Component fromService, String ofInstance, String ... propsToDeclareNames) {
+        Set<String> propsToDeclare = ImmutableSet.<String>builder().add(propsToDeclareNames).build();
+        List<ComponentInstanceInput> componentInstancesInputs = fromService.getComponentInstancesInputs().get(ofInstance);
+        return componentInstancesInputs.stream()
+                .filter(insInput -> propsToDeclare.contains(insInput.getName()))
+                .collect(groupingBy((i) -> ofInstance));
+    }
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java b/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
index 5e9e02c..803e190 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
@@ -20,12 +20,12 @@
 
 package org.openecomp.sdc.post;
 
-import java.io.File;
-
 import org.openecomp.sdc.be.dao.DAOTitanStrategy;
 import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
 
+import java.io.File;
+
 public class Install {
 	public static void main(String[] args) {
 
diff --git a/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml b/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
index 5ee9d05..21294e7 100644
--- a/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
+++ b/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -1,6 +1,6 @@
 outputFolder: target
 reportName: index.html
-catalogBeHost: localhost
+catalogBeHost: 192.168.33.10
 catalogFeHost: fehost
 #QA-SCRUM1
 #catalogBeHost: 135.21.125.97
@@ -40,9 +40,9 @@
 cassandraTruststorePassword : 123123
 cassandraAuditKeySpace: sdcaudit
 cassandraArtifactKeySpace: sdcartifact
-url: http://localhost:8181/sdc1/proxy-designer1#/dashboard
+url: http://localhost:8285/sdc1
 
-sdcHttpMethod: https
+sdcHttpMethod: http
 localDataCenter: DC-Automate01
 
 stopOnClassFailure: false
diff --git a/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh b/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh
index d2b142a..979d091 100644
--- a/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh
+++ b/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh
@@ -6,9 +6,9 @@
 VERSION=$2
 ENV=$3
 
-RECIPIENTS1="dl-sdcqa@att.com,ml636r@att.com,bl5783@att.com,ak314p@att.com,el489u@att.com,hk096q@att.com,bs5719@att.com"
+RECIPIENTS1="md9897@att.com,NETCOM_ASDC_DEV@att.com,IL-D2-QA-Alex@att.com,bs5719@att.com,yg356h@att.com,yr9970@att.com,sl615n@att.com,yn813h@att.com,as221v@att.com,ms172g@att.com,ma2244@att.com,el489u@att.com,gg980r@att.com,ak991p@att.com,bv095y@att.com,ms656r@att.com,df502y@att.com,bt750h@att.com,ln699k@att.com,hm104p@att.com"
 #RECIPIENTS2="dl-asdcqa@intl.att.com"
-RECIPIENTS2="md9897@att.com,ms656r@att.com,al714h@att.com,ak991p@att.com,ya107f@att.com,bv095y@att.com,st198j@att.com,th0695@att.com,vk195d@att.com,gg980r@att.com,il0695@att.com,el489u@att.com"
+RECIPIENTS2="md9897@att.com,NETCOM_ASDC_DEV@att.com,IL-D2-QA-Alex@att.com,bs5719@att.com,yg356h@att.com,yr9970@att.com,sl615n@att.com,yn813h@att.com,as221v@att.com,ms172g@att.com,ma2244@att.com,el489u@att.com,gg980r@att.com,ak991p@att.com,bv095y@att.com,ms656r@att.com,df502y@att.com,bt750h@att.com,ln699k@att.com,hm104p@att.com"
 source ExtentReport/versions.info
 if [ -z "$REPORT_NAME" ]
  then
diff --git a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh b/test-apis-ci/src/main/resources/ci/scripts/startTest.sh
index 88c9521..719bca4 100644
--- a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh
+++ b/test-apis-ci/src/main/resources/ci/scripts/startTest.sh
@@ -100,7 +100,7 @@
     JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;
 fi  
 
-cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" 
+cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -Dorg.freemarker.loggerLibrary=none -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
 
 
 if [ $DEBUG == "true" ]
@@ -115,7 +115,7 @@
         echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ...";
         prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE;
         SUITE_FILE=${fileName};
-	cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+	cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -Dorg.freemarker.loggerLibrary=none -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
         $cmd;
     fi
 fi
diff --git a/test-apis-ci/src/main/resources/ci/testSuites/externalAPIs.xml b/test-apis-ci/src/main/resources/ci/testSuites/externalAPIs.xml
index 6440dc1..7c9d6d9 100644
--- a/test-apis-ci/src/main/resources/ci/testSuites/externalAPIs.xml
+++ b/test-apis-ci/src/main/resources/ci/testSuites/externalAPIs.xml
@@ -1,6 +1,6 @@
 <?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="1" data-provider-thread-count="10">
+<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="1" data-provider-thread-count="8">
 	<test name="ExternalApis"> 
 		<classes>	
 			
@@ -13,7 +13,9 @@
 			<class name="org.openecomp.sdc.externalApis.GetSpecificAssetMetadataServlet"/>
 			<class name="org.openecomp.sdc.externalApis.SearchFilterCategoryExternalAPI"/>
 			<class name="org.openecomp.sdc.externalApis.AssetLifeCycle"/>
-			<class name="org.openecomp.sdc.externalApis.UserAPIs"/>  
+			<class name="org.openecomp.sdc.externalApis.UserAPIs"/>
+
+			<class name="org.openecomp.sdc.internalApis.annotations.AnnotationsTest"/>
 
 			
 <!-- 	      <class name="org.openecomp.sdc.ci.tests.execute.product.ChangeServiceInstanceVersionTest"/>
diff --git a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationCucumberCI.java b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationCucumberCI.java
index d9183fc..e2d324b 100644
--- a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationCucumberCI.java
+++ b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationCucumberCI.java
@@ -1,13 +1,12 @@
 package org.openecomp.sdc.cucumber.runners;
 
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.openecomp.sdc.conf.TestAPIConfDependentTest;
 
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
-
 @RunWith(Cucumber.class)
 @CucumberOptions(features = "classpath:cucumber/tenantIsolation.feature", glue = "org.openecomp.sdc.cucumber.steps")
 
diff --git a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/PrecannedTestExpectationCallback.java b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/PrecannedTestExpectationCallback.java
index 56802ec..0aec904 100644
--- a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/PrecannedTestExpectationCallback.java
+++ b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/PrecannedTestExpectationCallback.java
@@ -1,14 +1,13 @@
 package org.openecomp.sdc.cucumber.steps;
 
-import static org.mockserver.model.HttpResponse.response;
-
+import com.google.common.net.HttpHeaders;
 import org.apache.http.entity.ContentType;
 import org.mockserver.mock.action.ExpectationCallback;
 import org.mockserver.model.Header;
 import org.mockserver.model.HttpRequest;
 import org.mockserver.model.HttpResponse;
 
-import com.google.common.net.HttpHeaders;
+import static org.mockserver.model.HttpResponse.response;
 
 public class PrecannedTestExpectationCallback implements ExpectationCallback  {
 	private static volatile int countRequests;
diff --git a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/StepsTenantIsolationCI.java b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/StepsTenantIsolationCI.java
index 490b3e0..98c6291 100644
--- a/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/StepsTenantIsolationCI.java
+++ b/test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/StepsTenantIsolationCI.java
@@ -1,30 +1,16 @@
 package org.openecomp.sdc.cucumber.steps;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.mockserver.model.HttpCallback.callback;
-import static org.mockserver.model.HttpRequest.request;
-import static org.mockserver.model.HttpResponse.response;
-import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnResult;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.UUID;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
+import com.google.common.base.Strings;
+import com.google.common.net.HttpHeaders;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+import cucumber.api.java.After;
+import cucumber.api.java.Before;
+import cucumber.api.java.en.Given;
+import cucumber.api.java.en.Then;
+import cucumber.api.java.en.When;
+import fj.data.Either;
 import org.apache.commons.collections.CollectionUtils;
-//import org.openecomp.sdc.dmaap.DmaapPublisher;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpStatus;
 import org.apache.http.entity.ContentType;
@@ -56,17 +42,20 @@
 import org.openecomp.sdc.utils.DistributionStatusEnum;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
-import com.google.common.base.Strings;
-import com.google.common.net.HttpHeaders;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
-import cucumber.api.java.After;
-import cucumber.api.java.Before;
-import cucumber.api.java.en.Given;
-import cucumber.api.java.en.Then;
-import cucumber.api.java.en.When;
-import fj.data.Either;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockserver.model.HttpCallback.callback;
+import static org.mockserver.model.HttpRequest.request;
+import static org.mockserver.model.HttpResponse.response;
+import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnResult;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+//import org.openecomp.sdc.dmaap.DmaapPublisher;
 
 public class StepsTenantIsolationCI {
 
diff --git a/test-apis-ci/src/test/resources/CI/csars/VLANTaggingFromAmdox1303_2018.csar b/test-apis-ci/src/test/resources/CI/csars/VLANTaggingFromAmdox1303_2018.csar
new file mode 100644
index 0000000..54897dc
--- /dev/null
+++ b/test-apis-ci/src/test/resources/CI/csars/VLANTaggingFromAmdox1303_2018.csar
Binary files differ
diff --git a/test-apis-ci/src/test/resources/CI/csars/incorrect_cap.csar b/test-apis-ci/src/test/resources/CI/csars/incorrect_cap.csar
new file mode 100644
index 0000000..0ba608f
--- /dev/null
+++ b/test-apis-ci/src/test/resources/CI/csars/incorrect_cap.csar
Binary files differ
diff --git a/test-apis-ci/src/test/resources/CI/csars/with_groups.csar b/test-apis-ci/src/test/resources/CI/csars/with_groups.csar
new file mode 100644
index 0000000..823bd9a
--- /dev/null
+++ b/test-apis-ci/src/test/resources/CI/csars/with_groups.csar
Binary files differ
diff --git a/test-apis-ci/src/test/resources/CI/csars/with_groups_update.csar b/test-apis-ci/src/test/resources/CI/csars/with_groups_update.csar
new file mode 100644
index 0000000..a545480
--- /dev/null
+++ b/test-apis-ci/src/test/resources/CI/csars/with_groups_update.csar
Binary files differ
diff --git a/test-apis-ci/src/test/resources/CI/csars/without_caps.csar b/test-apis-ci/src/test/resources/CI/csars/without_caps.csar
new file mode 100644
index 0000000..55d200c
--- /dev/null
+++ b/test-apis-ci/src/test/resources/CI/csars/without_caps.csar
Binary files differ
diff --git a/test-apis-ci/src/test/resources/CI/error-configuration.yaml b/test-apis-ci/src/test/resources/CI/error-configuration.yaml
index 899a225..7ff62b1 100644
--- a/test-apis-ci/src/test/resources/CI/error-configuration.yaml
+++ b/test-apis-ci/src/test/resources/CI/error-configuration.yaml
@@ -1494,7 +1494,7 @@
 # %2 - VF name
 # %3 - component type [VF ]
     GROUP_IS_MISSING: {
-        code: 400,
+        code: 404,
         message: "Error: Invalid Content. The groups '%1' cannot be found under %2 %3.",
         messageId: "SVC4624"
     }
diff --git a/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml b/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
index f138ba1..70a3e55 100644
--- a/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
+++ b/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
@@ -23,7 +23,7 @@
 
 version: 1.1.0
 released: 2012-11-30
-toscaConformanceLevel: 5.0
+toscaConformanceLevel: 8.0
 minToscaConformanceLevel: 3.0
 
 titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
diff --git a/test-apis-ci/tmpCSAR b/test-apis-ci/tmpCSAR
index c1d5652..0b81510 100644
--- a/test-apis-ci/tmpCSAR
+++ b/test-apis-ci/tmpCSAR
Binary files differ
