diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
index e56b45f..b185f80 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
@@ -1,46 +1,40 @@
 /*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 TechMahindra
+ * ================================================================================ 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
-*/
+ */
 
 
 import static org.junit.Assert.assertEquals;
-
 import org.junit.Test;
 import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
 
-public class RequestHeaderTest{
-	RequestHeader rh = new RequestHeader();
+public class RequestHeaderTest {
+    RequestHeader rh = new RequestHeader();
 
-	@Test
-	public void testRequestHeader() {
-		rh.setRequestId("requestId");
-		rh.setSvcInstanceId("svcInstanceId");
-		rh.setSvcAction("svcAction");
-		rh.setSvcOperation("svcOperation");
-		rh.setCallbackUrl("callbackUrl");
-		rh.setMsoAction("msoAction");
-		assertEquals(rh.getRequestId(), "requestId");
-		assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
-		assertEquals(rh.getSvcAction(), "svcAction");
-		assertEquals(rh.getSvcOperation(), "svcOperation");
-		assertEquals(rh.getCallbackUrl(), "callbackUrl");
-		assertEquals(rh.getMsoAction(), "msoAction");
-		assert(rh.toString()!=null);	
-	}
+    @Test
+    public void testRequestHeader() {
+        rh.setRequestId("requestId");
+        rh.setSvcInstanceId("svcInstanceId");
+        rh.setSvcAction("svcAction");
+        rh.setSvcOperation("svcOperation");
+        rh.setCallbackUrl("callbackUrl");
+        rh.setMsoAction("msoAction");
+        assertEquals(rh.getRequestId(), "requestId");
+        assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
+        assertEquals(rh.getSvcAction(), "svcAction");
+        assertEquals(rh.getSvcOperation(), "svcOperation");
+        assertEquals(rh.getCallbackUrl(), "callbackUrl");
+        assertEquals(rh.getMsoAction(), "msoAction");
+        assert (rh.toString() != null);
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
index 884c2ac..7ce8281 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
@@ -1,44 +1,38 @@
 /*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 TechMahindra
+ * ================================================================================ 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
-*/
+ */
 
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-
 import org.junit.Test;
 import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader;
 import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
 
-public class SDNCAdapterCallbackRequestTest{
-	
-	SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
-	CallbackHeader cbh = new CallbackHeader();
-	String o = "test";
+public class SDNCAdapterCallbackRequestTest {
 
-	@Test
-	public void testSDNCAdapterCallbackRequest() {
-		sdnccall.setCallbackHeader(cbh);
-		sdnccall.setRequestData(o);
-		assertEquals(sdnccall.getCallbackHeader(), cbh);
-		assertEquals(sdnccall.getRequestData(), o);
-		assertNotNull(sdnccall.toString());	
-	}
+    SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
+    CallbackHeader cbh = new CallbackHeader();
+    String o = "test";
+
+    @Test
+    public void testSDNCAdapterCallbackRequest() {
+        sdnccall.setCallbackHeader(cbh);
+        sdnccall.setRequestData(o);
+        assertEquals(sdnccall.getCallbackHeader(), cbh);
+        assertEquals(sdnccall.getRequestData(), o);
+        assertNotNull(sdnccall.toString());
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
index 79bffe4..8a97671 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
@@ -1,41 +1,35 @@
 /*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 TechMahindra
+ * ================================================================================ 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
-*/
+ */
 
 
 import static org.junit.Assert.assertEquals;
-
 import org.junit.Test;
 import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
 import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterRequest;
 
 public class SDNCAdapterRequestTest {
-	
-	SDNCAdapterRequest adapter = new SDNCAdapterRequest();
-	RequestHeader rh = new RequestHeader();
-	Object o = new Object();
 
-	@Test
-	public void testSDNCAdapterRequest() {
-		adapter.setRequestHeader(rh);
-		adapter.setRequestData(o);
-		assertEquals(adapter.getRequestHeader(), rh);
-		assertEquals(adapter.getRequestData(), o);
-		}
+    SDNCAdapterRequest adapter = new SDNCAdapterRequest();
+    RequestHeader rh = new RequestHeader();
+    Object o = new Object();
+
+    @Test
+    public void testSDNCAdapterRequest() {
+        adapter.setRequestHeader(rh);
+        adapter.setRequestData(o);
+        assertEquals(adapter.getRequestHeader(), rh);
+        assertEquals(adapter.getRequestData(), o);
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
index fc21ff9..2176dd8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -31,7 +31,6 @@
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
-
 import com.github.tomakehurst.wiremock.WireMockServer;
 import com.github.tomakehurst.wiremock.client.WireMock;
 
@@ -40,19 +39,19 @@
 @ActiveProfiles("test")
 @ContextConfiguration
 @AutoConfigureWireMock(port = 0)
-public abstract class  BaseIntegrationTest extends WorkflowTest {
-	@Autowired
-	BPMNUtil bpmnUtil;
+public abstract class BaseIntegrationTest extends WorkflowTest {
+    @Autowired
+    BPMNUtil bpmnUtil;
 
-	@Value("${wiremock.server.port}")
-	protected String wiremockPort;
-	
-	@Autowired
-	protected WireMockServer wireMockServer;
-	
-	@After
-	public void baseAfterTest() {
-		wireMockServer.resetAll();
-	}
+    @Value("${wiremock.server.port}")
+    protected String wiremockPort;
+
+    @Autowired
+    protected WireMockServer wireMockServer;
+
+    @After
+    public void baseAfterTest() {
+        wireMockServer.resetAll();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
index c28a86c..0a53266 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
@@ -19,6 +19,7 @@
  */
 
 package org.onap.so.bpmn;
+
 import ch.vorburger.exec.ManagedProcessException;
 import ch.vorburger.mariadb4j.DBConfigurationBuilder;
 import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,38 +36,27 @@
 import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
 import org.springframework.transaction.PlatformTransactionManager;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
-
 import javax.persistence.EntityManagerFactory;
 import javax.sql.DataSource;
 
 @Configuration
 @EnableTransactionManagement
-@EnableJpaRepositories(
-        entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
-        basePackages = { "org.onap.so.db.request.data.repository"}
-)
+@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory",
+        transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
 @Profile({"test"})
 public class InfraEmbeddedMariaDbConfig {
 
     @Primary
     @Bean(name = "requestEntityManagerFactory")
-    public LocalContainerEntityManagerFactoryBean
-    entityManagerFactory(
-            EntityManagerFactoryBuilder builder,
-            DataSource dataSource
-    ) {
-        return builder
-                .dataSource(dataSource)
-                .packages("org.onap.so.db.request.beans")
-                .persistenceUnit("requestDB")
+    public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+            DataSource dataSource) {
+        return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB")
                 .build();
     }
 
     @Bean(name = "requestTransactionManager")
     public PlatformTransactionManager transactionManager(
-            @Qualifier("requestEntityManagerFactory") EntityManagerFactory
-                    entityManagerFactory
-    ) {
+            @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
         return new JpaTransactionManager(entityManagerFactory);
     }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
index f65cada..bc002c7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
@@ -27,6 +27,6 @@
 @RunWith(WildcardPatternSuite.class)
 @SuiteClasses({"**/*IT.class"})
 public class IntegrationTestSuite {
-  // the class remains empty,
-  // used only as a holder for the above annotations
+    // the class remains empty,
+    // used only as a holder for the above annotations
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
index 5f0722a..f417a55 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -25,14 +25,11 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.ws.rs.core.Response;
-
 import org.camunda.bpm.engine.HistoryService;
 import org.camunda.bpm.engine.ProcessEngineServices;
 import org.camunda.bpm.engine.RuntimeService;
@@ -52,306 +49,303 @@
 @Component
 public class BPMNUtil {
 
-	private static WorkflowAsyncResource workflowResource;
-	
-	@Autowired
-	public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
-		BPMNUtil.workflowResource = workflowResource;
-	}
+    private static WorkflowAsyncResource workflowResource;
 
-	public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
-		String pID = getProcessInstanceId(processEngineServices,
-				processDefinitionID);
-		return getVariable( processEngineServices,  processDefinitionID,  name,  pID);
-	}
-	
-	public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
-		assertProcessInstanceFinished(processEngineServices, processInstanceId);
-		HistoricVariableInstance responseData = processEngineServices.getHistoryService()
-			    .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
-			    .variableName(name)
-			    .singleResult();
-		
-		if (responseData != null) {
-			return (responseData.getValue() != null ? responseData.getValue().toString(): null); 
-		}
-		return null;
-	}
+    @Autowired
+    public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
+        BPMNUtil.workflowResource = workflowResource;
+    }
 
-	/*
-	@SuppressWarnings("unchecked")
-	public static <T extends Object> T getRawVariable(HistoryService historyService, String processDefinitionID, String name) {
-		//String pID = getProcessInstanceId(processEngineServices,
-		//		processDefinitionID);
-		assertProcessInstanceFinished(historyService, pID);
-		Object responseData = historyService
-			    .createHistoricVariableInstanceQuery().processInstanceId(pID)
-			    .variableName(name)
-			    .singleResult()
-			    .getValue();
-		return (T) responseData;
-	}
-	*/
-	
-	@SuppressWarnings("unchecked")
-	public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
-		String pID = getProcessInstanceId(processEngineServices,
-				processDefinitionID);
-		return getRawVariable( processEngineServices,  processDefinitionID,  name,  pID);
-	}
-	
-	@SuppressWarnings("unchecked")
-	public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
-		assertProcessInstanceFinished(processEngineServices, processInstanceId);
-		Object responseData = processEngineServices.getHistoryService()
-			    .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
-			    .variableName(name)
-			    .singleResult()
-			    .getValue();
-		return (T) responseData;
-	}
+    public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+            String name) {
+        String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+        return getVariable(processEngineServices, processDefinitionID, name, pID);
+    }
 
-	
-	public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
-		String pID = getProcessInstanceId(processEngineServices,
-				processDefinitionID);
-		assertNotNull(pID);
-	    assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);
-	}
-	
-	public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {
-		assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
-	}
-	
-	public static void assertProcessInstanceFinished(HistoryService historyService, String pid) {
-	    assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
-	}
-	
-	public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
-	    assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
-	}
-	
-	public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
-		String pID = getProcessInstanceId(processEngineServices,
-				processDefinitionID);		
-	    assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count());
-	}
-	
-	private static String getProcessInstanceId(
-			ProcessEngineServices processEngineServices, String processDefinitionID) {
-		List<HistoricProcessInstance> historyList =  processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
-		String pID = null;
-		for (HistoricProcessInstance hInstance: historyList) {
-			if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
-				pID = hInstance.getId();
-				break;
-			}
-		}
-		return pID;
-	}
-	
-	public static void cleanHistory(ProcessEngineServices processEngineServices) {
-		List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
-		List<String> pidList = new ArrayList<>();
-		for (HistoricProcessInstance hInstance : historyList) {
-			pidList.add(hInstance.getId());
-		}
-		if (pidList.size() > 0) {
-			processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList);
-		}
-	}
-	
-	private static String getProcessInstanceId(
-			HistoryService historyService, String processDefinitionID) {
-		List<HistoricProcessInstance> historyList =  historyService.createHistoricProcessInstanceQuery().list();
-		String pID = null;
-		for (HistoricProcessInstance hInstance: historyList) {
-			if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
-				pID = hInstance.getId();
-				break;
-			}
-		}
-		return pID;
-	}
+    public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+            String name, String processInstanceId) {
+        assertProcessInstanceFinished(processEngineServices, processInstanceId);
+        HistoricVariableInstance responseData =
+                processEngineServices.getHistoryService().createHistoricVariableInstanceQuery()
+                        .processInstanceId(processInstanceId).variableName(name).singleResult();
 
-	public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
-	    return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false;
-	}
+        if (responseData != null) {
+            return (responseData.getValue() != null ? responseData.getValue().toString() : null);
+        }
+        return null;
+    }
 
-	
-	private static void buildVariable(String key, String value, Map<String,Object> variableValueType) {
-		Map<String, Object> host = new HashMap<>();
-		host.put("value", value);
-		host.put("type", "String");
-		variableValueType.put(key, host);
-	}
-	
-	public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) {
-		VariableMapImpl variableMap = new VariableMapImpl();
+    /*
+     * @SuppressWarnings("unchecked") public static <T extends Object> T getRawVariable(HistoryService historyService,
+     * String processDefinitionID, String name) { //String pID = getProcessInstanceId(processEngineServices, //
+     * processDefinitionID); assertProcessInstanceFinished(historyService, pID); Object responseData = historyService
+     * .createHistoricVariableInstanceQuery().processInstanceId(pID) .variableName(name) .singleResult() .getValue();
+     * return (T) responseData; }
+     */
 
-		Map<String, Object> variableValueType = new HashMap<>();
-		for (String key : variables.keySet()) {
-			buildVariable(key, variables.get(key), variableValueType);
-		}
-		buildVariable("mso-service-request-timeout","600", variableValueType);
-		variableMap.put("variables", variableValueType);
-		
-		workflowResource.setProcessEngineServices4junit(processEngineServices);
-		Response response = workflowResource.startProcessInstanceByKey(
-					processKey, variableMap);
-		WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
-		return workflowResponse;
-	}
-	
-	public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey, Map<String,String> variables, WorkflowResource workflowResource) {
-		
-		VariableMapImpl variableMap = new VariableMapImpl();
+    @SuppressWarnings("unchecked")
+    public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+            String name) {
+        String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+        return getRawVariable(processEngineServices, processDefinitionID, name, pID);
+    }
 
-		Map<String, Object> variableValueType = new HashMap<String, Object>();
-		for (String key : variables.keySet()) {
-			buildVariable(key, variables.get(key), variableValueType);
-		}
-		buildVariable("mso-service-request-timeout","600", variableValueType);
-		variableMap.put("variables", variableValueType);
-		
+    @SuppressWarnings("unchecked")
+    public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+            String name, String processInstanceId) {
+        assertProcessInstanceFinished(processEngineServices, processInstanceId);
+        Object responseData = processEngineServices.getHistoryService().createHistoricVariableInstanceQuery()
+                .processInstanceId(processInstanceId).variableName(name).singleResult().getValue();
+        return (T) responseData;
+    }
 
-		Response response = workflowResource.startProcessInstanceByKey(
-					processKey, variableMap);
-		WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
-		return workflowResponse;
-	}
 
-	//Check the runtime service to see whether the process is completed
-	public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException {
-		// Don't wait forever
-		long waitTime = 120000;
-		long endTime = System.currentTimeMillis() + waitTime;
+    public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices,
+            String processDefinitionID) {
+        String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+        assertNotNull(pID);
+        assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID)
+                .finished().count() > 0);
+    }
 
-		while (true) {
-			if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
-				break;
-			}
+    public static void assertNoProcessInstance(ProcessEngineServices processEngineServices,
+            String processDefinitionID) {
+        assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
+    }
 
-			if (System.currentTimeMillis() >= endTime) {
-				fail("Process " + pid + " did not finish in " + waitTime + "ms");
-			}
+    public static void assertProcessInstanceFinished(HistoryService historyService, String pid) {
+        assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+    }
 
-			Thread.sleep(200);
-		}
-	}
-	
-	
-	//Check the runtime service to see whether the process is completed
-	public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException {
-		// Don't wait forever
-		long waitTime = 120000;
-		long endTime = System.currentTimeMillis() + waitTime;
+    public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+        assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery()
+                .processInstanceId(pid).finished().count());
+    }
 
-		while (true) {
-			if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
-				break;
-			}
+    public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices,
+            String processDefinitionID) {
+        String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+        assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery()
+                .processInstanceId(pID).finished().count());
+    }
 
-			if (System.currentTimeMillis() >= endTime) {
-				fail("Process " + pid + " did not finish in " + waitTime + "ms");
-			}
+    private static String getProcessInstanceId(ProcessEngineServices processEngineServices,
+            String processDefinitionID) {
+        List<HistoricProcessInstance> historyList =
+                processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+        String pID = null;
+        for (HistoricProcessInstance hInstance : historyList) {
+            if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+                pID = hInstance.getId();
+                break;
+            }
+        }
+        return pID;
+    }
 
-			Thread.sleep(200);
-		}
-	}
-	
-	
-	/**
-	 * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
-	 * @param processEngineServices
-	 * @param processKey
-	 * @param variables
-	 * @return
-	 * @throws InterruptedException
-	 */
-	public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
-		ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
-		pthread.start();
-		BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
-		String pid = getProcessInstanceId(processEngineServices, processKey);
-		//Caution: If there is a problem with workflow, this may wait for ever
-		while (true) {
-			pid = getProcessInstanceId(processEngineServices, processKey);
-			if (!isProcessInstanceFinished(processEngineServices,pid)) {
-				Thread.sleep(200);
-			} else{
-				break;
-			}
-		}
-		//need to retrieve for second time ?
-		pid = getProcessInstanceId(processEngineServices, processKey);
-		waitForWorkflowToFinish(processEngineServices, pid);
-		return pthread.workflowResponse;
-	}
+    public static void cleanHistory(ProcessEngineServices processEngineServices) {
+        List<HistoricProcessInstance> historyList =
+                processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+        List<String> pidList = new ArrayList<>();
+        for (HistoricProcessInstance hInstance : historyList) {
+            pidList.add(hInstance.getId());
+        }
+        if (pidList.size() > 0) {
+            processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList);
+        }
+    }
 
-	/**
-	 * Execute workflow using async resource
-	 * @param processEngineServices
-	 * @param processKey
-	 * @param asyncResponse
-	 * @param variables
-	 * @throws InterruptedException 
-	 */
-	private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
-		VariableMapImpl variableMap = new VariableMapImpl();
+    private static String getProcessInstanceId(HistoryService historyService, String processDefinitionID) {
+        List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
+        String pID = null;
+        for (HistoricProcessInstance hInstance : historyList) {
+            if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+                pID = hInstance.getId();
+                break;
+            }
+        }
+        return pID;
+    }
 
-		Map<String, Object> variableValueType = new HashMap<>();
-		for (String key : variables.keySet()) {
-			buildVariable(key, variables.get(key), variableValueType);
-		}
-		buildVariable("mso-service-request-timeout","600", variableValueType);
-		variableMap.put("variables", variableValueType);
-		
-		workflowResource.setProcessEngineServices4junit(processEngineServices);
-		workflowResource.startProcessInstanceByKey(processKey, variableMap);
-	}
-	
-	/**
-	 * Helper class which executes workflow in a thread
-	 *
-	 */
-	static class ProcessThread extends Thread {
-		
-		public WorkflowResponse workflowResponse = null;
-		public String processKey;
-		public boolean started;
-		public ProcessEngineServices processEngineServices;
-		public Map<String,String> variables;
-		
-		public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String,String> variables) {
-			this.processKey = processKey;
-			this.processEngineServices = processEngineServices;
-			this.variables = variables;
-		}
-		
-		public void run() {
-			started = true;
-			/*doAnswer(new Answer<Void>() {
-			    public Void answer(InvocationOnMock invocation) {
-			      Response response = (Response) invocation.getArguments()[0];
-			      try {
-			      workflowResponse = (WorkflowResponse) response.getEntity();
-			      } catch (ClassCastException e) {
-			    	  String workflowResponseString = (String)response.getEntity();
-			    	  workflowResponse = new WorkflowResponse();
-			    	  workflowResponse.setResponse(workflowResponseString);
-			    	  workflowResponse.setMessageCode(200);
-			      }
-			      return null;
-			    }
-			}).when(asyncResponse).setResponse(any(Response.class));
-			*/
-			try {
-				executeAsyncFlow(processEngineServices, processKey, variables);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
+    public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+        return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid)
+                .finished().count() == 1 ? true : false;
+    }
+
+
+    private static void buildVariable(String key, String value, Map<String, Object> variableValueType) {
+        Map<String, Object> host = new HashMap<>();
+        host.put("value", value);
+        host.put("type", "String");
+        variableValueType.put(key, host);
+    }
+
+    public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey,
+            Map<String, String> variables) {
+        VariableMapImpl variableMap = new VariableMapImpl();
+
+        Map<String, Object> variableValueType = new HashMap<>();
+        for (String key : variables.keySet()) {
+            buildVariable(key, variables.get(key), variableValueType);
+        }
+        buildVariable("mso-service-request-timeout", "600", variableValueType);
+        variableMap.put("variables", variableValueType);
+
+        workflowResource.setProcessEngineServices4junit(processEngineServices);
+        Response response = workflowResource.startProcessInstanceByKey(processKey, variableMap);
+        WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+        return workflowResponse;
+    }
+
+    public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey,
+            Map<String, String> variables, WorkflowResource workflowResource) {
+
+        VariableMapImpl variableMap = new VariableMapImpl();
+
+        Map<String, Object> variableValueType = new HashMap<String, Object>();
+        for (String key : variables.keySet()) {
+            buildVariable(key, variables.get(key), variableValueType);
+        }
+        buildVariable("mso-service-request-timeout", "600", variableValueType);
+        variableMap.put("variables", variableValueType);
+
+
+        Response response = workflowResource.startProcessInstanceByKey(processKey, variableMap);
+        WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+        return workflowResponse;
+    }
+
+    // Check the runtime service to see whether the process is completed
+    public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid)
+            throws InterruptedException {
+        // Don't wait forever
+        long waitTime = 120000;
+        long endTime = System.currentTimeMillis() + waitTime;
+
+        while (true) {
+            if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid)
+                    .singleResult() == null) {
+                break;
+            }
+
+            if (System.currentTimeMillis() >= endTime) {
+                fail("Process " + pid + " did not finish in " + waitTime + "ms");
+            }
+
+            Thread.sleep(200);
+        }
+    }
+
+
+    // Check the runtime service to see whether the process is completed
+    public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException {
+        // Don't wait forever
+        long waitTime = 120000;
+        long endTime = System.currentTimeMillis() + waitTime;
+
+        while (true) {
+            if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
+                break;
+            }
+
+            if (System.currentTimeMillis() >= endTime) {
+                fail("Process " + pid + " did not finish in " + waitTime + "ms");
+            }
+
+            Thread.sleep(200);
+        }
+    }
+
+
+    /**
+     * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
+     * 
+     * @param processEngineServices
+     * @param processKey
+     * @param variables
+     * @return
+     * @throws InterruptedException
+     */
+    public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey,
+            Map<String, String> variables) throws InterruptedException {
+        ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
+        pthread.start();
+        BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
+        String pid = getProcessInstanceId(processEngineServices, processKey);
+        // Caution: If there is a problem with workflow, this may wait for ever
+        while (true) {
+            pid = getProcessInstanceId(processEngineServices, processKey);
+            if (!isProcessInstanceFinished(processEngineServices, pid)) {
+                Thread.sleep(200);
+            } else {
+                break;
+            }
+        }
+        // need to retrieve for second time ?
+        pid = getProcessInstanceId(processEngineServices, processKey);
+        waitForWorkflowToFinish(processEngineServices, pid);
+        return pthread.workflowResponse;
+    }
+
+    /**
+     * Execute workflow using async resource
+     * 
+     * @param processEngineServices
+     * @param processKey
+     * @param asyncResponse
+     * @param variables
+     * @throws InterruptedException
+     */
+    private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey,
+            Map<String, String> variables) throws InterruptedException {
+        VariableMapImpl variableMap = new VariableMapImpl();
+
+        Map<String, Object> variableValueType = new HashMap<>();
+        for (String key : variables.keySet()) {
+            buildVariable(key, variables.get(key), variableValueType);
+        }
+        buildVariable("mso-service-request-timeout", "600", variableValueType);
+        variableMap.put("variables", variableValueType);
+
+        workflowResource.setProcessEngineServices4junit(processEngineServices);
+        workflowResource.startProcessInstanceByKey(processKey, variableMap);
+    }
+
+    /**
+     * Helper class which executes workflow in a thread
+     *
+     */
+    static class ProcessThread extends Thread {
+
+        public WorkflowResponse workflowResponse = null;
+        public String processKey;
+        public boolean started;
+        public ProcessEngineServices processEngineServices;
+        public Map<String, String> variables;
+
+        public ProcessThread(String processKey, ProcessEngineServices processEngineServices,
+                Map<String, String> variables) {
+            this.processKey = processKey;
+            this.processEngineServices = processEngineServices;
+            this.variables = variables;
+        }
+
+        public void run() {
+            started = true;
+            /*
+             * doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { Response response =
+             * (Response) invocation.getArguments()[0]; try { workflowResponse = (WorkflowResponse)
+             * response.getEntity(); } catch (ClassCastException e) { String workflowResponseString =
+             * (String)response.getEntity(); workflowResponse = new WorkflowResponse();
+             * workflowResponse.setResponse(workflowResponseString); workflowResponse.setMessageCode(200); } return
+             * null; } }).when(asyncResponse).setResponse(any(Response.class));
+             */
+            try {
+                executeAsyncFlow(processEngineServices, processKey, variables);
+            } catch (InterruptedException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
index f528205..2be7218 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
@@ -16,17 +16,15 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -36,148 +34,140 @@
  */
 
 public class CompleteMsoProcessIT extends BaseIntegrationTest {
-	
-	private void executeFlow(String inputRequestFile) throws InterruptedException {
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("CompleteMsoProcessRequest",inputRequestFile);
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess( "CompleteMsoProcess", variables);
-		waitForWorkflowToFinish(processEngine,processId);
-		logEnd();
-	}	
-	
-	@Test
-	public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
-		logStart();	
-		
-		//Execute Flow
-		executeFlow(gMsoCompletionRequestWithNotificationurl());
-		
-		//Verify Error
-		String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
-		Assert.assertEquals("200", CMSO_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
-		logEnd();
-	}
 
-	@Test
-	public void msoCompletionRequestWithNoNotificationurl() throws Exception {
-		logStart();	
-		
-		//Execute Flow
-		executeFlow(gMsoCompletionRequestWithNoNotificationurl());
-		
-		//Verify Error
-		String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
-		Assert.assertEquals("200", CMSO_ResponseCode);	
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
-		logEnd();
-	}
+    private void executeFlow(String inputRequestFile) throws InterruptedException {
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("CompleteMsoProcessRequest", inputRequestFile);
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("CompleteMsoProcess", variables);
+        waitForWorkflowToFinish(processEngine, processId);
+        logEnd();
+    }
 
-	@Test		
-	public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
-		logStart();	
-		
-		//Execute Flow
-		executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
-		
-		//Verify Error
-		String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
-		Assert.assertEquals("200", CMSO_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
-		logEnd();	
-	}
-	
-	@Test		
-	public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
-		logStart();
-		
-		//Execute Flow
-		executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
-		
-		//Verify Error
-		String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
-		Assert.assertEquals("200", CMSO_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
-		logEnd();
-	}	
+    @Test
+    public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
+        logStart();
 
-	public String gMsoCompletionRequestWithNotificationurl() {		
-		String xml = ""
-				+ "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
-				+ "		<ns:request-information>"
-				+ "			<ns:request-id>STUW105_5002</ns:request-id>"
-				+ "			<ns:request-action>RequestAction</ns:request-action>"				
-				+ "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>"
-				+ "			<ns:source>SOURCE</ns:source>"
-				+ "			<ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"				
-				+ "			<ns:order-number>10205000</ns:order-number>"				
-				+ "			<ns:order-version>1</ns:order-version>"
-				+ "		</ns:request-information>"				
-				+ "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
-				+ "</sdncadapterworkflow:MsoCompletionRequest>";
-		
-		return xml;
-	}
-		
+        // Execute Flow
+        executeFlow(gMsoCompletionRequestWithNotificationurl());
+
+        // Verify Error
+        String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+        Assert.assertEquals("200", CMSO_ResponseCode);
+        Assert.assertTrue(
+                (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+        logEnd();
+    }
+
+    @Test
+    public void msoCompletionRequestWithNoNotificationurl() throws Exception {
+        logStart();
+
+        // Execute Flow
+        executeFlow(gMsoCompletionRequestWithNoNotificationurl());
+
+        // Verify Error
+        String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+        Assert.assertEquals("200", CMSO_ResponseCode);
+        Assert.assertTrue(
+                (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+        logEnd();
+    }
+
+    @Test
+    public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
+        logStart();
+
+        // Execute Flow
+        executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
+
+        // Verify Error
+        String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+        Assert.assertEquals("200", CMSO_ResponseCode);
+        Assert.assertTrue(
+                (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+        logEnd();
+    }
+
+    @Test
+    public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
+        logStart();
+
+        // Execute Flow
+        executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
+
+        // Verify Error
+        String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+        Assert.assertEquals("200", CMSO_ResponseCode);
+        Assert.assertTrue(
+                (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+        logEnd();
+    }
+
+    public String gMsoCompletionRequestWithNotificationurl() {
+        String xml = ""
+                + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
+                + "		<ns:request-information>" + "			<ns:request-id>STUW105_5002</ns:request-id>"
+                + "			<ns:request-action>RequestAction</ns:request-action>"
+                + "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>" + "			<ns:source>SOURCE</ns:source>"
+                + "			<ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+                + "			<ns:order-number>10205000</ns:order-number>" + "			<ns:order-version>1</ns:order-version>"
+                + "		</ns:request-information>"
+                + "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+                + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+        return xml;
+    }
 
 
-	public String gMsoCompletionRequestWithNoNotificationurl() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
-				+ "		<ns:request-information>"
-				+ "			<ns:request-id>STUW105_5002</ns:request-id>"
-				+ "			<ns:request-action>RequestAction</ns:request-action>"				
-				+ "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>"
-				+ "			<ns:source>SOURCE</ns:source>"
-				+ "			<ns:notification-url></ns:notification-url>"				
-				+ "			<ns:order-number>10205000</ns:order-number>"				
-				+ "			<ns:order-version>1</ns:order-version>"
-				+ "		</ns:request-information>"				
-				+ "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
-				+ "</sdncadapterworkflow:MsoCompletionRequest>";
-		
-		return xml;
-	}
-	
-	public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
-				+ "		<ns:request-information>"
-				+ "			<ns:request-id></ns:request-id>"
-				+ "			<ns:request-action>RequestAction</ns:request-action>"
-				+ "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>"
-				+ "			<ns:source>SOURCE</ns:source>"
-				+ "			<ns:notification-url></ns:notification-url>"				
-				+ "			<ns:order-number>10205000</ns:order-number>"				
-				+ "			<ns:order-version>1</ns:order-version>"
-				+ "		</ns:request-information>"				
-				+ "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
-				+ "</sdncadapterworkflow:MsoCompletionRequest>";
-		
-		return xml;
-	}	
-	
-	public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
-				+ "		<ns:request-information>"
-				+ "			<ns:request-id></ns:request-id>"
-				+ "			<ns:request-action>RequestAction</ns:request-action>"				
-				+ "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>"
-				+ "			<ns:source>SOURCE</ns:source>"
-				+ "			<ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"				
-				+ "			<ns:order-number>10205000</ns:order-number>"				
-				+ "			<ns:order-version>1</ns:order-version>"
-				+ "		</ns:request-information>"				
-				+ "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
-				+ "</sdncadapterworkflow:MsoCompletionRequest>";
-		
-		return xml;
-	}	
+
+    public String gMsoCompletionRequestWithNoNotificationurl() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+                + "		<ns:request-information>" + "			<ns:request-id>STUW105_5002</ns:request-id>"
+                + "			<ns:request-action>RequestAction</ns:request-action>"
+                + "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>" + "			<ns:source>SOURCE</ns:source>"
+                + "			<ns:notification-url></ns:notification-url>"
+                + "			<ns:order-number>10205000</ns:order-number>" + "			<ns:order-version>1</ns:order-version>"
+                + "		</ns:request-information>"
+                + "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+                + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+        return xml;
+    }
+
+    public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+                + "		<ns:request-information>" + "			<ns:request-id></ns:request-id>"
+                + "			<ns:request-action>RequestAction</ns:request-action>"
+                + "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>" + "			<ns:source>SOURCE</ns:source>"
+                + "			<ns:notification-url></ns:notification-url>"
+                + "			<ns:order-number>10205000</ns:order-number>" + "			<ns:order-version>1</ns:order-version>"
+                + "		</ns:request-information>"
+                + "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+                + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+        return xml;
+    }
+
+    public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+                + "		<ns:request-information>" + "			<ns:request-id></ns:request-id>"
+                + "			<ns:request-action>RequestAction</ns:request-action>"
+                + "			<ns:request-sub-action>COMPLETE</ns:request-sub-action>" + "			<ns:source>SOURCE</ns:source>"
+                + "			<ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+                + "			<ns:order-number>10205000</ns:order-number>" + "			<ns:order-version>1</ns:order-version>"
+                + "		</ns:request-information>"
+                + "		<sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+                + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+        return xml;
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
index cc3ca94..ad0428c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
@@ -16,17 +16,15 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import static org.junit.Assert.assertEquals;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.RuntimeService;
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Ignore;
@@ -38,79 +36,83 @@
  */
 
 public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest {
-	/**
-	 * Sunny day scenario.
-	 * 
-	 * @throws Exception
-	 */
-	@Test	
-	public void sunnyDay() throws Exception {
-		logStart();
-		MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");		
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
-		variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
-		variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
-		String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
-					
-		assertEquals("200", responseCode);
-	
-		logEnd();
-	}
-	
-	/**
-	 * Rainy day scenario - nonexisting volume group id.
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void rainyDayNoVolumeGroupId() throws Exception {
-		logStart();
-		
-		// does not exist would return a 404 from AAI
-		MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404);
-					
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
-		variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
-		variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);	
-		String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
-					
-		assertEquals("404", responseCode);
-		
-		logEnd();
-	}
-	
-	/**
-	 * Rainy day scenario - volume group name does not match the name in AAI
-	 *
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void rainyDayNameDoesNotMatch() throws Exception {
-		logStart();
-		
-		MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
-				
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
-		variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
-		variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);		
-		String volumeGroupNameMatches = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches",processId);
-		
-		assertEquals("false", volumeGroupNameMatches);
-		
-		logEnd();
-	}
+    /**
+     * Sunny day scenario.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void sunnyDay() throws Exception {
+        logStart();
+        MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+        variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
+        variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+        String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName",
+                "CVGN_queryVolumeGroupResponseCode", processId);
+
+        assertEquals("200", responseCode);
+
+        logEnd();
+    }
+
+    /**
+     * Rainy day scenario - nonexisting volume group id.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void rainyDayNoVolumeGroupId() throws Exception {
+        logStart();
+
+        // does not exist would return a 404 from AAI
+        MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST",
+                "aai-volume-group-id-info.xml", 404);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+        variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
+        variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+        String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName",
+                "CVGN_queryVolumeGroupResponseCode", processId);
+
+        assertEquals("404", responseCode);
+
+        logEnd();
+    }
+
+    /**
+     * Rainy day scenario - volume group name does not match the name in AAI
+     *
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void rainyDayNameDoesNotMatch() throws Exception {
+        logStart();
+
+        MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+        variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
+        variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+        String volumeGroupNameMatches =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches", processId);
+
+        assertEquals("false", volumeGroupNameMatches);
+
+        logEnd();
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
index fd1f7c1..f190b62 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
@@ -19,17 +19,15 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import static org.junit.Assert.assertEquals;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
 
@@ -40,49 +38,59 @@
 
 public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
 
-	@Test	
-	public void testRemoveLayer3Service_success() throws Exception{
-		MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
+    @Test
+    public void testRemoveLayer3Service_success() throws Exception {
+        MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+                "CRTGVNF_queryAAIResponseVolume.xml");
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);	
+        String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
 
-		String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
-		String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
-		String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId",processId);
+        String actualNameMatch =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
+        String actualIdMatch =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
+        String actualResponse =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId", processId);
 
-		assertEquals("Response", "true", actualNameMatch);
-		assertEquals("Response", "true", actualIdMatch);
-		assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
-	}
+        assertEquals("Response", "true", actualNameMatch);
+        assertEquals("Response", "true", actualIdMatch);
+        assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
+    }
 
-	@Test	
-	public void testRemoveLayer3Service_idsNotMatch() throws Exception{
-		MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+    @Test
+    public void testRemoveLayer3Service_idsNotMatch() throws Exception {
+        MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+                "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);	
-		
+        String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
 
-		String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
-		String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
-		String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException",processId);
 
-		assertEquals("Response", "true", actualNameMatch);
-		assertEquals("Response", "false", actualIdMatch);
-		assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]", actualResponse);
+        String actualNameMatch =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
+        String actualIdMatch =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
+        String actualResponse =
+                BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException", processId);
 
-	}
+        assertEquals("Response", "true", actualNameMatch);
+        assertEquals("Response", "false", actualIdMatch);
+        assertEquals("Response",
+                "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]",
+                actualResponse);
 
-	private void setVariables(Map<String, Object> variables) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
-		variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
-		variables.put("aicCloudRegion", "MDTWNJ21");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-	}
+    }
+
+    private void setVariables(Map<String, Object> variables) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("volumeGroupId", "a8399879-31b3-4973-be26-0a0cbe776b58");
+        variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+        variables.put("aicCloudRegion", "MDTWNJ21");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
index f6cd74a..47d3799 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -26,18 +26,15 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
 import static com.github.tomakehurst.wiremock.client.WireMock.put;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
 import org.onap.so.bpmn.core.WorkflowException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import com.github.tomakehurst.wiremock.WireMockServer;
 
 /**
@@ -45,223 +42,228 @@
  */
 
 public class CreateAAIVfModuleIT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-	
-	@Test	
-	public void  TestCreateGenericVnfSuccess_200() {
 
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-					
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("isVidRequest", "false");
-		variables.put("vnfName", "STMTN5MMSC22");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
-		variables.put("vfModuleModelName", "MMSC::module-0");
-		
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
-		String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
-		Assert.assertEquals("201", responseCode);
-		logger.debug(response);
-	}
+    Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
 
-	@Test	
-	public void  TestCreateVfModuleSuccess_200() {
-		// create Add-on VF Module for existing Generic VNF
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);					
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("isVidRequest", "false");
-		variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
-		variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
-		String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
-		Assert.assertEquals("201", responseCode);
-		logger.debug(response);
-	}
+    @Test
+    public void TestCreateGenericVnfSuccess_200() {
 
-	@Test		
-	public void  TestQueryGenericVnfFailure_5000() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-					
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfName", "STMTN5MMSC23");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
-		variables.put("vfModuleModelName", "MMSC::module-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);		
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(500, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
-		logger.debug(exception.getErrorMessage());
-	}
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
 
-	@Test	
-	public void  TestCreateDupGenericVnfFailure_1002() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-			
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfName", "STMTN5MMSC21");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
-		variables.put("vfModuleModelName", "MMSC::module-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
-		logger.debug(exception.getErrorMessage());
-	}
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfName", "STMTN5MMSC22");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
+        variables.put("vfModuleModelName", "MMSC::module-0");
 
-	@Test		
-	public void  TestCreateDupVfModuleFailure_1002() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-			
-		Map<String, Object> variables = new HashMap<>(); 
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
-		variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
-		logger.debug(exception.getErrorMessage());
-	}
-	
-	@Test		
-	public void  TestCreateGenericVnfFailure_5000() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-			
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfName", "STMTN5MMSC22");
-		variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
-		variables.put("vfModuleModelName", "PCRF::module-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(5000, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
-		logger.debug(exception.getErrorMessage());
-	}
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+                "CAAIVfMod_createVfModuleResponseCode", processId);
+        String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+                "CAAIVfMod_createVfModuleResponseCode", processId);
+        Assert.assertEquals("201", responseCode);
+        logger.debug(response);
+    }
 
-	@Test	
-	public void  TestCreateGenericVnfFailure_1002() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-			
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
-		variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
-		variables.put("vfModuleModelName", "PCRF::module-0");
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
-		logger.debug(exception.getErrorMessage());
-	}
+    @Test
+    public void TestCreateVfModuleSuccess_200() {
+        // create Add-on VF Module for existing Generic VNF
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
+        variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+                "CAAIVfMod_createVfModuleResponseCode", processId);
+        String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+                "CAAIVfMod_createVfModuleResponseCode", processId);
+        Assert.assertEquals("201", responseCode);
+        logger.debug(response);
+    }
 
-	@Test	
-	public void  TestCreateVfModuleFailure_5000() {
-		new MockAAIGenericVnfSearch(wireMockServer);
-		MockAAICreateGenericVnf(wireMockServer);
-		MockAAIVfModulePUT(wireMockServer, true);
-			
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("isVidRequest", "false");
-		variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-		variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
-		variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-		variables.put("personaModelVersion", "1.0");
-		variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
-		variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess("CreateAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(5000, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
-		logger.debug(exception.getErrorMessage());
-	}
+    @Test
+    public void TestQueryGenericVnfFailure_5000() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
 
-	public static void MockAAICreateGenericVnf(WireMockServer wireMockServer){
-		wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
-				.withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
-				.willReturn(aResponse()
-						.withStatus(201)));
-		wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
-				.withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
-				.willReturn(aResponse()
-						.withStatus(500)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("aaiFault.xml")));
-	}
-	
-	// start of mocks used locally and by other VF Module unit tests
-	public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate){
-		wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
-				.withRequestBody(containing("MMSC"))
-				.willReturn(aResponse()
-						.withStatus(isCreate ? 201 : 200)));
-		wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
-				.withRequestBody(containing("PCRF"))
-				.willReturn(aResponse()
-						.withStatus(500)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("aaiFault.xml")));
-		wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))				
-				.willReturn(aResponse()
-					.withStatus(200)));
-	}
-	
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfName", "STMTN5MMSC23");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
+        variables.put("vfModuleModelName", "MMSC::module-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(500, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestCreateDupGenericVnfFailure_1002() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfName", "STMTN5MMSC21");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+        variables.put("vfModuleModelName", "MMSC::module-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true,
+                exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestCreateDupVfModuleFailure_1002() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
+        variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestCreateGenericVnfFailure_5000() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfName", "STMTN5MMSC22");
+        variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+        variables.put("vfModuleModelName", "PCRF::module-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(5000, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestCreateGenericVnfFailure_1002() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
+        variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+        variables.put("vfModuleModelName", "PCRF::module-0");
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestCreateVfModuleFailure_5000() {
+        new MockAAIGenericVnfSearch(wireMockServer);
+        MockAAICreateGenericVnf(wireMockServer);
+        MockAAIVfModulePUT(wireMockServer, true);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("isVidRequest", "false");
+        variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+        variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+        variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+        variables.put("personaModelVersion", "1.0");
+        variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
+        variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("CreateAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(5000, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    public static void MockAAICreateGenericVnf(WireMockServer wireMockServer) {
+        wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+                .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
+                .willReturn(aResponse().withStatus(201)));
+        wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+                .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
+                .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+                        .withBodyFile("aaiFault.xml")));
+    }
+
+    // start of mocks used locally and by other VF Module unit tests
+    public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate) {
+        wireMockServer
+                .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+                        .withRequestBody(containing("MMSC")).willReturn(aResponse().withStatus(isCreate ? 201 : 200)));
+        wireMockServer
+                .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+                        .withRequestBody(containing("PCRF")).willReturn(aResponse().withStatus(500)
+                                .withHeader("Content-Type", "text/xml").withBodyFile("aaiFault.xml")));
+        wireMockServer.stubFor(
+                put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+                        .willReturn(aResponse().withStatus(200)));
+    }
+
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
index 39a7e0c..b78c5b8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
@@ -26,12 +26,10 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleId;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -45,91 +43,95 @@
 
 public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest {
 
-	Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class);
+    Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class);
 
-	/**
-	 * Test the happy path through the flow.
-	 */
-	@Test
-	public void happyPath() throws IOException {
+    /**
+     * Test the happy path through the flow.
+     */
+    @Test
+    public void happyPath() throws IOException {
 
-		logStart();
+        logStart();
 
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
-		MockGetGenericVnfByIdWithPriority(wireMockServer, "skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
-		MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+        MockGetGenericVnfByIdWithPriority(wireMockServer, "skask", "lukewarm", 200,
+                "VfModularity/VfModule-lukewarm.xml", 2);
+        MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", "999-99-9999");
-		variables.put("isDebugLogEnabled","true");
-		variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", "999-99-9999");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
 
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(200, responseCode.intValue());
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(200, responseCode.intValue());
 
-		logEnd();
-	}
+        logEnd();
+    }
 
-	/**
-	 * Test the case where the GET to AAI returns a 404.
-	 */
-	@Test
-	public void badGet() throws IOException {
+    /**
+     * Test the case where the GET to AAI returns a 404.
+     */
+    @Test
+    public void badGet() throws IOException {
 
-		logStart();
+        logStart();
 
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
-		MockGetVfModuleId(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+        MockGetVfModuleId(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", "999-99-9999");
-		variables.put("isDebugLogEnabled","true");
-		variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", "999-99-9999");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
 
-		logEnd();
-	}
+        logEnd();
+    }
 
-	/**
-	 * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
-	 */
-	@Test
-	public void badPatch() throws IOException {
+    /**
+     * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+     */
+    @Test
+    public void badPatch() throws IOException {
 
-		logStart();
+        logStart();
 
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
-		MockGetVfModuleId(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
-		MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+        MockGetVfModuleId(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+        MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", "999-99-9999");
-		variables.put("isDebugLogEnabled","true");
-		variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", "999-99-9999");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
 
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
 
-		logEnd();
-	}
+        logEnd();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
index 3d15a4b..0bfcbd3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
@@ -16,7 +16,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -25,7 +25,6 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Ignore;
@@ -40,56 +39,55 @@
 public class DecomposeServiceIT extends BaseIntegrationTest {
 
 
-	public DecomposeServiceIT() throws IOException {
+    public DecomposeServiceIT() throws IOException {
 
-	}
+    }
 
-	@Test	
-	public void testDecomposeService_success() throws Exception{
-		MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json");
+    @Test
+    public void testDecomposeService_success() throws Exception {
+        MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+                "/getCatalogServiceResourcesDataWithConfig.json");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
-		invokeSubProcess("DecomposeService", businessKey, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        invokeSubProcess("DecomposeService", businessKey, variables);
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		Assert.assertTrue(isProcessEnded(businessKey));
+        Assert.assertTrue(isProcessEnded(businessKey));
 
-	}
-	
-	//@Test
-	@Test
-	public void testDecomposeService_success_partial() throws Exception{
-		MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json");
+    }
+
+    // @Test
+    @Test
+    public void testDecomposeService_success_partial() throws Exception {
+        MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+                "/getCatalogServiceResourcesDataNoNetwork.json");
 
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
-		invokeSubProcess("DecomposeService", businessKey, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        invokeSubProcess("DecomposeService", businessKey, variables);
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		Assert.assertTrue(isProcessEnded(businessKey));
+        Assert.assertTrue(isProcessEnded(businessKey));
 
-	}
+    }
 
-	private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("mso-request-id", requestId);
-		variables.put("msoRequestId", requestId);
-		variables.put("serviceInstanceId",siId);
+    private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", requestId);
+        variables.put("msoRequestId", requestId);
+        variables.put("serviceInstanceId", siId);
 
-		String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
-				"\"modelInvariantUuid\": \"cmw-123-456-789\"," +
-				"\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
-				"\"modelName\": \"ServicevSAMP12\"," +
-				"\"modelVersion\": \"1.0\"," +
-				"}";
-		variables.put("serviceModelInfo", serviceModelInfo);
+        String serviceModelInfo = "{ " + "\"modelType\": \"service\"," + "\"modelInvariantUuid\": \"cmw-123-456-789\","
+                + "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"ServicevSAMP12\","
+                + "\"modelVersion\": \"1.0\"," + "}";
+        variables.put("serviceModelInfo", serviceModelInfo);
 
-	}
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
index 99e4b8c..cac237a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
@@ -16,14 +16,13 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -36,245 +35,227 @@
  */
 
 public class DeleteAAIVfModuleIT extends BaseIntegrationTest {
-	private static final String EOL = "\n";
-	
-	Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class);
-	
-	@Test	
-	public void  TestDeleteGenericVnfSuccess_200() {
-		// delete the Base Module and Generic Vnf
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
-		String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
-		Assert.assertEquals("200", responseCode);
-		logger.debug(response);
-	}
+    private static final String EOL = "\n";
 
-	@Test	
-	public void  TestDeleteVfModuleSuccess_200() {
-		// delete Add-on Vf Module for existing Generic Vnf
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
+    Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class);
 
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
-		String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
-		Assert.assertEquals("200", responseCode);
-		logger.debug(response);
-	}
+    @Test
+    public void TestDeleteGenericVnfSuccess_200() {
+        // delete the Base Module and Generic Vnf
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
 
-	@Test	
-	public void  TestQueryGenericVnfFailure_5000() {
-		// query Generic Vnf failure (non-404) with A&AI
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(5000, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
-		logger.debug(exception.getErrorMessage());
-	}
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest",
+                "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+                "DAAIVfMod_deleteGenericVnfResponseCode", processId);
+        String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+                "DAAIVfMod_deleteGenericVnfResponseCode", processId);
+        Assert.assertEquals("200", responseCode);
+        logger.debug(response);
+    }
 
-	@Test	
-	public void  TestQueryGenericVnfFailure_1002() {
-		// attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
-		logger.debug(exception.getErrorMessage());
-	}
+    @Test
+    public void TestDeleteVfModuleSuccess_200() {
+        // delete Add-on Vf Module for existing Generic Vnf
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
 
-	@Test	
-	public void  TestDeleteGenericVnfFailure_5000() {
-		// A&AI failure (non-200) when attempting to delete a Generic Vnf
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(5000, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
-		logger.debug(exception.getErrorMessage());
-	}
-	
-	@Test	
-	public void  TestDeleteVfModuleFailure_5000() {
-		// A&AI failure (non-200) when attempting to delete a Vf Module
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(5000, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
-		logger.debug(exception.getErrorMessage());
-	}
-	
-	@Test	
-	public void  TestDeleteVfModuleFailure_1002_1() {
-		// failure attempting to delete Base Module when not the last Vf Module
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
-		String request =
-			"<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>DELETE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
-			"    <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
-			"    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
-			"    <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest",request);
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
-		logger.debug(exception.getErrorMessage());
-	}
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
 
-	@Test	
-	public void  TestDeleteVfModuleFailure_1002_2() {
-		// failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
-		// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
-		new MockAAIGenericVnfSearch(wireMockServer);
-		new MockAAIDeleteGenericVnf(wireMockServer);
-		new MockAAIDeleteVfModule(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
-		String processId = invokeSubProcess("DeleteAAIVfModule", variables);
-		WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
-		Assert.assertEquals(1002, exception.getErrorCode());
-		Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
-		logger.debug(exception.getErrorMessage());
-	}
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+                "DAAIVfMod_deleteVfModuleResponseCode", processId);
+        String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+                "DAAIVfMod_deleteVfModuleResponseCode", processId);
+        Assert.assertEquals("200", responseCode);
+        logger.debug(response);
+    }
+
+    @Test
+    public void TestQueryGenericVnfFailure_5000() {
+        // query Generic Vnf failure (non-404) with A&AI
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC23</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(5000, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestQueryGenericVnfFailure_1002() {
+        // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC22</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestDeleteGenericVnfFailure_5000() {
+        // A&AI failure (non-200) when attempting to delete a Generic Vnf
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC18</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(5000, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestDeleteVfModuleFailure_5000() {
+        // A&AI failure (non-200) when attempting to delete a Vf Module
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC19</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(5000, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestDeleteVfModuleFailure_1002_1() {
+        // failure attempting to delete Base Module when not the last Vf Module
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
+        String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+                + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL
+                + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL
+                + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+                + "    <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+                + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+                + "    <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL
+                + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+                + EOL;
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest", request);
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
+        logger.debug(exception.getErrorMessage());
+    }
+
+    @Test
+    public void TestDeleteVfModuleFailure_1002_2() {
+        // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
+        // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
+        new MockAAIGenericVnfSearch(wireMockServer);
+        new MockAAIDeleteGenericVnf(wireMockServer);
+        new MockAAIDeleteVfModule(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("DeleteAAIVfModuleRequest",
+                "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+        String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+        WorkflowException exception =
+                BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+        Assert.assertEquals(1002, exception.getErrorCode());
+        Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
+        logger.debug(exception.getErrorMessage());
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
index 88f8e5d..59f46b2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -26,11 +26,9 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.post;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
 import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -42,185 +40,164 @@
  */
 
 public class FalloutHandlerIT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
-	
-	
-	private void setupMocks() {
-		wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter"))
-				.willReturn(aResponse()
-				.withStatus(200)
-				.withHeader("Content-Type", "text/xml")
-				.withBody("<DbTag>Notified</DbTag>")));
-		wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
-				.willReturn(aResponse()
-				.withStatus(200)
-				.withHeader("Content-Type", "text/xml")
-				.withBody("<DbTag>Notified</DbTag>")));
-	}	
-	
-	private String executeFlow(String inputRequestFile) throws InterruptedException {	
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("FalloutHandlerRequest",inputRequestFile);		variables.put("mso-request-id", UUID.randomUUID().toString());
-		String processId = invokeSubProcess( "FalloutHandler", variables);
-		waitForWorkflowToFinish(processEngine,processId);
-		logEnd();
-		return processId;
-	}	
-	
-	@Test		
-	public void msoFalloutHandlerWithNotificationurl_200() throws Exception{		
-		//Setup Mocks
-		setupMocks();
-		//Execute Flow
-		String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl());
-		//Verify Error
-		String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode",processId);
-		Assert.assertEquals("200", FH_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator",processId)); 
-	}
-	
-	public String gMsoFalloutHandlerWithNotificationurl() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
-				+ "		<ns7:request-information>"
-				+ "			<ns7:request-id>1020_STUW105_5002</ns7:request-id>"
-				+ "			<ns7:request-action>requestAction</ns7:request-action>"
-				+ "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
-				+ "			<ns7:source>source</ns7:source>"
-				+ "			<ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
-				+ "			<ns7:order-number>10205000</ns7:order-number>"
-				+ "			<ns7:order-version>1</ns7:order-version>"
-				+ "		</ns7:request-information>"
-				+ "		<sdncadapterworkflow:WorkflowException>"
-				+ "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
-				+ "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
-				+ "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
-				+ "		</sdncadapterworkflow:WorkflowException>"
-				+ "</sdncadapterworkflow:FalloutHandlerRequest>";
-		
-		return xml;
 
-	}	
-	
+    Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
+
+
+    private void setupMocks() {
+        wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")).willReturn(aResponse()
+                .withStatus(200).withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+        wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")).willReturn(aResponse().withStatus(200)
+                .withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+    }
+
+    private String executeFlow(String inputRequestFile) throws InterruptedException {
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("FalloutHandlerRequest", inputRequestFile);
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        String processId = invokeSubProcess("FalloutHandler", variables);
+        waitForWorkflowToFinish(processEngine, processId);
+        logEnd();
+        return processId;
+    }
+
+    @Test
+    public void msoFalloutHandlerWithNotificationurl_200() throws Exception {
+        // Setup Mocks
+        setupMocks();
+        // Execute Flow
+        String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl());
+        // Verify Error
+        String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode", processId);
+        Assert.assertEquals("200", FH_ResponseCode);
+        Assert.assertTrue(
+                (boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator", processId));
+    }
+
+    public String gMsoFalloutHandlerWithNotificationurl() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+                + "		<ns7:request-information>" + "			<ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+                + "			<ns7:request-action>requestAction</ns7:request-action>"
+                + "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+                + "			<ns7:source>source</ns7:source>"
+                + "			<ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
+                + "			<ns7:order-number>10205000</ns7:order-number>"
+                + "			<ns7:order-version>1</ns7:order-version>" + "		</ns7:request-information>"
+                + "		<sdncadapterworkflow:WorkflowException>"
+                + "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+                + "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+                + "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+                + "		</sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+        return xml;
+
+    }
 
 
 
-	@Test		
-	public void msoFalloutHandlerWithNoNotificationurl() throws Exception{
-	
-		//Setup Mocks
-		setupMocks();
-		//Execute Flow
-		executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
-		//Verify Error
-		String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
-		Assert.assertEquals("200", FH_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); 
-	}
-	
-	public String gMsoFalloutHandlerWithNoNotificationurl() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
-				+ "		<ns7:request-information>"
-				+ "			<ns7:request-id>1020_STUW105_5002</ns7:request-id>"
-				+ "			<ns7:request-action>requestAction</ns7:request-action>"
-				+ "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
-				+ "			<ns7:source>source</ns7:source>"
-				+ "			<ns7:notification-url></ns7:notification-url>"
-				+ "			<ns7:order-number>10205000</ns7:order-number>"
-				+ "			<ns7:order-version>1</ns7:order-version>"
-				+ "		</ns7:request-information>"
-				+ "		<sdncadapterworkflow:WorkflowException>"
-				+ "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
-				+ "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
-				+ "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
-				+ "		</sdncadapterworkflow:WorkflowException>"
-				+ "</sdncadapterworkflow:FalloutHandlerRequest>";
-		
-		return xml;
-	}	
-	
-	@Test		
-	
-	public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{
-		String method = getClass().getSimpleName() + "." + new Object() {
-		}.getClass().getEnclosingMethod().getName();
-		logger.debug("STARTED TEST: {}", method);
-		//Setup Mocks
-		setupMocks();
-		//Execute Flow
-		executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
-		//Verify Error		
-		String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
-		Assert.assertEquals("200", FH_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); 
-	}
+    @Test
+    public void msoFalloutHandlerWithNoNotificationurl() throws Exception {
 
-	public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
-				+ "		<ns7:request-information>"
-				+ "			<ns7:request-id></ns7:request-id>"
-				+ "			<ns7:request-action>requestAction</ns7:request-action>"
-				+ "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
-				+ "			<ns7:source>source</ns7:source>"
-				+ "			<ns7:notification-url>www.test.com</ns7:notification-url>"
-				+ "			<ns7:order-number>10205000</ns7:order-number>"
-				+ "			<ns7:order-version>1</ns7:order-version>"
-				+ "		</ns7:request-information>"
-				+ "		<sdncadapterworkflow:WorkflowException>"
-				+ "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
-				+ "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
-				+ "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
-				+ "		</sdncadapterworkflow:WorkflowException>"
-				+ "</sdncadapterworkflow:FalloutHandlerRequest>";
-		
-		return xml;
-	}		
-	
-	@Test		
-	
-	public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{
-		String method = getClass().getSimpleName() + "." + new Object() {
-		}.getClass().getEnclosingMethod().getName();
-		logger.debug("STARTED TEST: {}", method);
-		//Setup Mocks
-		setupMocks();
-		//Execute Flow
-		executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
-		//Verify Error
-		String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
-		Assert.assertEquals("200", FH_ResponseCode);
-		Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); 
-	}	
-	
-	public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
-		//Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
-		String xml = ""
-				+ "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
-				+ "		<ns7:request-information>"
-				+ "			<ns7:request-id></ns7:request-id>"
-				+ "			<ns7:request-action>requestAction</ns7:request-action>"
-				+ "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
-				+ "			<ns7:source>source</ns7:source>"
-				+ "			<ns7:notification-url></ns7:notification-url>"
-				+ "			<ns7:order-number>10205000</ns7:order-number>"
-				+ "			<ns7:order-version>1</ns7:order-version>"
-				+ "		</ns7:request-information>"
-				+ "		<sdncadapterworkflow:WorkflowException>"
-				+ "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
-				+ "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
-				+ "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
-				+ "		</sdncadapterworkflow:WorkflowException>"
-				+ "</sdncadapterworkflow:FalloutHandlerRequest>";
-		
-		return xml;
-	}	
-	
+        // Setup Mocks
+        setupMocks();
+        // Execute Flow
+        executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
+        // Verify Error
+        String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+        Assert.assertEquals("200", FH_ResponseCode);
+        Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+    }
+
+    public String gMsoFalloutHandlerWithNoNotificationurl() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+                + "		<ns7:request-information>" + "			<ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+                + "			<ns7:request-action>requestAction</ns7:request-action>"
+                + "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+                + "			<ns7:source>source</ns7:source>" + "			<ns7:notification-url></ns7:notification-url>"
+                + "			<ns7:order-number>10205000</ns7:order-number>"
+                + "			<ns7:order-version>1</ns7:order-version>" + "		</ns7:request-information>"
+                + "		<sdncadapterworkflow:WorkflowException>"
+                + "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+                + "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+                + "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+                + "		</sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+        return xml;
+    }
+
+    @Test
+
+    public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception {
+        String method = getClass().getSimpleName() + "." + new Object() {}.getClass().getEnclosingMethod().getName();
+        logger.debug("STARTED TEST: {}", method);
+        // Setup Mocks
+        setupMocks();
+        // Execute Flow
+        executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
+        // Verify Error
+        String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+        Assert.assertEquals("200", FH_ResponseCode);
+        Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+    }
+
+    public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+                + "		<ns7:request-information>" + "			<ns7:request-id></ns7:request-id>"
+                + "			<ns7:request-action>requestAction</ns7:request-action>"
+                + "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+                + "			<ns7:source>source</ns7:source>"
+                + "			<ns7:notification-url>www.test.com</ns7:notification-url>"
+                + "			<ns7:order-number>10205000</ns7:order-number>"
+                + "			<ns7:order-version>1</ns7:order-version>" + "		</ns7:request-information>"
+                + "		<sdncadapterworkflow:WorkflowException>"
+                + "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+                + "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+                + "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+                + "		</sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+        return xml;
+    }
+
+    @Test
+
+    public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception {
+        String method = getClass().getSimpleName() + "." + new Object() {}.getClass().getEnclosingMethod().getName();
+        logger.debug("STARTED TEST: {}", method);
+        // Setup Mocks
+        setupMocks();
+        // Execute Flow
+        executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
+        // Verify Error
+        String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+        Assert.assertEquals("200", FH_ResponseCode);
+        Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+    }
+
+    public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
+        // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+        String xml = ""
+                + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+                + "		<ns7:request-information>" + "			<ns7:request-id></ns7:request-id>"
+                + "			<ns7:request-action>requestAction</ns7:request-action>"
+                + "			<ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+                + "			<ns7:source>source</ns7:source>" + "			<ns7:notification-url></ns7:notification-url>"
+                + "			<ns7:order-number>10205000</ns7:order-number>"
+                + "			<ns7:order-version>1</ns7:order-version>" + "		</ns7:request-information>"
+                + "		<sdncadapterworkflow:WorkflowException>"
+                + "			<sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+                + "			<sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+                + "			<sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+                + "		</sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+        return xml;
+    }
+
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
index 7299e06..ff0b318 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
@@ -22,10 +22,8 @@
 
 import static org.junit.Assert.assertNotNull;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-
 import java.util.HashMap;
 import java.util.Map;
-
 import org.camunda.bpm.engine.RuntimeService;
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Ignore;
@@ -37,42 +35,37 @@
  */
 
 public class GenerateVfModuleNameIT extends BaseIntegrationTest {
-	private static final String EOL = "\n";
-	
-	@Test	
-	public void  TestGenerateVfModuleNameSuvvess() {
-		// 
-		String request =
-			"<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
-			"  <request-info>" + EOL +
-			"    <action>CREATE_VF_MODULE</action>" + EOL +
-			"    <source>PORTAL</source>" + EOL +
-			"  </request-info>" + EOL +
-			"  <vnf-inputs>" + EOL +
-			"    <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
-			"    <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
-			"    <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
-			"    <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
-			"    <persona-model-version>1.0</persona-model-version>" + EOL +
-			"    <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
-			"    <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
-			"    <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
-			"  </vnf-inputs>" + EOL +
-			"  <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
-			"</vnf-request>" + EOL;
+    private static final String EOL = "\n";
 
-		MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
-		RuntimeService runtimeService = processEngine.getRuntimeService();				
-		Map<String, Object> variables = new HashMap<String, Object>();		
-		variables.put("isDebugLogEnabled","true");		
-		variables.put("vnfName", "STMTN5MMSC20");
-		variables.put("vfModuleLabel", "ModuleLabel1");
-		variables.put("personaModelId", "extrovert");
-		variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
-		
-		runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
-		String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
-		
-		assertNotNull(response);
-	}
+    @Test
+    public void TestGenerateVfModuleNameSuvvess() {
+        //
+        String request =
+                "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL + "  <request-info>" + EOL
+                        + "    <action>CREATE_VF_MODULE</action>" + EOL + "    <source>PORTAL</source>" + EOL
+                        + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL + "    <vnf-name>STMTN5MMSC22</vnf-name>"
+                        + EOL + "    <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL
+                        + "    <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL
+                        + "    <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+                        + "    <persona-model-version>1.0</persona-model-version>" + EOL
+                        + "    <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL
+                        + "    <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL
+                        + "    <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL + "  </vnf-inputs>" + EOL
+                        + "  <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL
+                        + "</vnf-request>" + EOL;
+
+        MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
+        RuntimeService runtimeService = processEngine.getRuntimeService();
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfName", "STMTN5MMSC20");
+        variables.put("vfModuleLabel", "ModuleLabel1");
+        variables.put("personaModelId", "extrovert");
+        variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
+
+        runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
+        String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
+
+        assertNotNull(response);
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
index 53d29c5..97a09d8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
@@ -23,12 +23,10 @@
 package org.onap.so.bpmn.common;
 
 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
-
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.TaskService;
 import org.camunda.bpm.engine.task.Task;
 import org.camunda.bpm.engine.task.TaskQuery;
@@ -42,58 +40,58 @@
  * Unit test for RainyDayHandler.bpmn.
  */
 public class ManualHandlingIT extends BaseIntegrationTest {
-	Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
-	
-	@Test
-	public void  TestManualHandlingSuccess() {
-		MockPostRequestDB(wireMockServer);
-		
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceType", "X");
-		variables.put("vnfType", "Y");
-		variables.put("currentActivity", "BB1");
-		variables.put("workStep", "1");
-		variables.put("failedActivity", "AAI");
-		variables.put("vnfName", "vSAMP12");
-		variables.put("errorCode", "123");
-		variables.put("errorText", "update failed");
-		variables.put("validResponses", "Rollback");
-		variables.put("vnfName", "vSAMP1");
+    Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
+
+    @Test
+    public void TestManualHandlingSuccess() {
+        MockPostRequestDB(wireMockServer);
+
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceType", "X");
+        variables.put("vnfType", "Y");
+        variables.put("currentActivity", "BB1");
+        variables.put("workStep", "1");
+        variables.put("failedActivity", "AAI");
+        variables.put("vnfName", "vSAMP12");
+        variables.put("errorCode", "123");
+        variables.put("errorText", "update failed");
+        variables.put("validResponses", "Rollback");
+        variables.put("vnfName", "vSAMP1");
 
 
-		String businessKey = UUID.randomUUID().toString();
-		invokeSubProcess("ManualHandling", businessKey, variables);
-		
-		try {
-			Thread.sleep(5);
-		} catch (Exception e) {
+        String businessKey = UUID.randomUUID().toString();
+        invokeSubProcess("ManualHandling", businessKey, variables);
 
-		}
+        try {
+            Thread.sleep(5);
+        } catch (Exception e) {
 
-		TaskService taskService = processEngine.getTaskService();
+        }
 
-		TaskQuery q = taskService.createTaskQuery();
+        TaskService taskService = processEngine.getTaskService();
 
-		List<Task> tasks = q.orderByTaskCreateTime().asc().list();
-		
-		for (Task task : tasks) {
-			logger.debug("TASK ID: {}", task.getId());
-			logger.debug("TASK NAME: {}", task.getName());
-			
-			try {
-				logger.debug("Completing the task");
-				Map<String,Object> completeVariables = new HashMap<>();
-				completeVariables.put("responseValue", "skip");
-				taskService.complete(task.getId(), completeVariables);
-			} catch(Exception e) {
-				logger.debug("GOT EXCEPTION: {}", e.getMessage());
-			}
-		}
-		
-		waitForProcessEnd(businessKey, 100000);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-	}
+        TaskQuery q = taskService.createTaskQuery();
+
+        List<Task> tasks = q.orderByTaskCreateTime().asc().list();
+
+        for (Task task : tasks) {
+            logger.debug("TASK ID: {}", task.getId());
+            logger.debug("TASK NAME: {}", task.getName());
+
+            try {
+                logger.debug("Completing the task");
+                Map<String, Object> completeVariables = new HashMap<>();
+                completeVariables.put("responseValue", "skip");
+                taskService.complete(task.getId(), completeVariables);
+            } catch (Exception e) {
+                logger.debug("GOT EXCEPTION: {}", e.getMessage());
+            }
+        }
+
+        waitForProcessEnd(businessKey, 100000);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
index 052fd5d..45ef0ad 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
@@ -23,18 +23,16 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
 import com.github.tomakehurst.wiremock.WireMockServer;
 
 public class MockAAIDeleteGenericVnf {
-	public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){
-		wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
-				.willReturn(aResponse()
-						.withStatus(200)));
-		wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
-				.willReturn(aResponse()
-						.withStatus(500)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("aaiFault.xml")));
-	}
+    public MockAAIDeleteGenericVnf(WireMockServer wireMockServer) {
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+                        .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("aaiFault.xml")));
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
index 1cbe0b9..f405fc9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
@@ -24,31 +24,30 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
 import static com.github.tomakehurst.wiremock.client.WireMock.get;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
 import com.github.tomakehurst.wiremock.WireMockServer;
 
 public class MockAAIDeleteVfModule {
-	
-	public MockAAIDeleteVfModule(WireMockServer wireMockServer)
-	{
-		wireMockServer.stubFor(delete(urlMatching(
-				"/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
-						.willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(delete(urlMatching(
-				"/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
-						.willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(delete(urlMatching(
-				"/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
-						.willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(delete(urlMatching(
-				"/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
-						.willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
-								.withBodyFile("aaiFault.xml")));
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
-				.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
-						.withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
 
-		wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
-				.willReturn(aResponse().withStatus(200)));
-	}
+    public MockAAIDeleteVfModule(WireMockServer wireMockServer) {
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(delete(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+                        .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("aaiFault.xml")));
+        wireMockServer.stubFor(
+                get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+        wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+                .willReturn(aResponse().withStatus(200)));
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
index 1d6337f..a33268e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
@@ -23,319 +23,219 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
 import static com.github.tomakehurst.wiremock.client.WireMock.get;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
 import com.github.tomakehurst.wiremock.WireMockServer;
 
 public class MockAAIGenericVnfSearch {
-	
-	private static final String EOL = "\n";
 
-	public MockAAIGenericVnfSearch(WireMockServer wireMockServer){
-		String body;
-		
-		// The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-	
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
-				.willReturn(aResponse()
-						.withStatus(500)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("aaiFault.xml")));
-	
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
-				.willReturn(aResponse()
-						.withStatus(404)
-						.withHeader("Content-Type", "text/xml")
-						.withBody("Generic VNF Not Found")));
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(404)
-						.withHeader("Content-Type", "text/xml")
-						.withBody("Generic VNF Not Found")));
-	
-		body =
-			"<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>1508691</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>1508692</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		body =
-			"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>1508691</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>1508692</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>false</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>1508692</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		// The following stubs are for DeleteAAIVfModule
-	
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(500)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("aaiFault.xml")));
-	
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(404)
-						.withHeader("Content-Type", "text/xml")
-						.withBody("Generic VNF Not Found")));
-	
-		body =
-				"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-				"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
-				"  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
-				"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-				"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-				"  <equipment-role>vMMSC</equipment-role>" + EOL +
-				"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-				"  <in-maint>false</in-maint>" + EOL +
-				"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-				"  <resource-version>0000021</resource-version>" + EOL +
-				"  <vf-modules>" + EOL +
-				"    <vf-module>" + EOL +
-				"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
-				"      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
-				"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
-				"      <persona-model-version>1.0</persona-model-version>" + EOL +
-				"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-				"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-				"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-				"      <resource-version>0000073</resource-version>" + EOL +
-				"    </vf-module>" + EOL +
-				"  </vf-modules>" + EOL +
-				"  <relationship-list/>" + EOL +
-				"  <l-interfaces/>" + EOL +
-				"  <lag-interfaces/>" + EOL +
-				"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		body =
-			"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>0000020</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000074</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>false</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000075</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		body =
-			"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>0000019</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000076</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>false</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000077</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		body =
-			"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>0000018</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000078</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-		body =
-			"<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
-			"  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
-			"  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
-			"  <vnf-type>mmsc-capacity</vnf-type>" + EOL +
-			"  <service-id>SDN-MOBILITY</service-id>" + EOL +
-			"  <equipment-role>vMMSC</equipment-role>" + EOL +
-			"  <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"  <in-maint>false</in-maint>" + EOL +
-			"  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
-			"  <resource-version>0000021</resource-version>" + EOL +
-			"  <vf-modules>" + EOL +
-			"    <vf-module>" + EOL +
-			"      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
-			"      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
-			"      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
-			"      <persona-model-version>1.0</persona-model-version>" + EOL +
-			"      <is-base-vf-module>true</is-base-vf-module>" + EOL +
-			"      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
-			"      <orchestration-status>pending-create</orchestration-status>" + EOL +
-			"      <resource-version>0000073</resource-version>" + EOL +
-			"    </vf-module>" + EOL +
-			"  </vf-modules>" + EOL +
-			"  <relationship-list/>" + EOL +
-			"  <l-interfaces/>" + EOL +
-			"  <lag-interfaces/>" + EOL +
-			"</generic-vnf>" + EOL;
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBody(body)));
-	
-	}
+    private static final String EOL = "\n";
+
+    public MockAAIGenericVnfSearch(WireMockServer wireMockServer) {
+        String body;
+
+        // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+        wireMockServer.stubFor(
+                get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+                        .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("aaiFault.xml")));
+
+        wireMockServer.stubFor(
+                get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+                        .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+                                .withBody("Generic VNF Not Found")));
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+                        .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+                                .withBody("Generic VNF Not Found")));
+
+        body = "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>1508691</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(
+                get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>1508691</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>"
+                + EOL + "      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(
+                get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        // The following stubs are for DeleteAAIVfModule
+
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+                        .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("aaiFault.xml")));
+
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+                        .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+                                .withBody("Generic VNF Not Found")));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>0000021</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000073</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>0000020</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000074</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>"
+                + EOL + "      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000075</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC19</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>0000019</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000076</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>"
+                + EOL + "      <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000077</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>0000018</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000078</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+        body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+                + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+                + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
+                + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
+                + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
+                + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+                + "  <resource-version>0000021</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
+                + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+                + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+                + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+                + "      <persona-model-version>1.0</persona-model-version>" + EOL
+                + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
+                + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+                + "      <orchestration-status>pending-create</orchestration-status>" + EOL
+                + "      <resource-version>0000073</resource-version>" + EOL + "    </vf-module>" + EOL
+                + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
+                + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+        wireMockServer.stubFor(get(urlMatching(
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
index 6a9ff2a..0154f2e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
@@ -24,12 +24,12 @@
 import org.camunda.bpm.engine.delegate.JavaDelegate;
 
 public class MockLoggerDelegate implements JavaDelegate {
-	@Override
-	public void execute(DelegateExecution execution) throws Exception {
-		System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId="
-				+ execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId()
-				+ ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId="
-				+ execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey()
-				+ ", executionId=" + execution.getId() + " \n\n");
-	}
+    @Override
+    public void execute(DelegateExecution execution) throws Exception {
+        System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId="
+                + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId()
+                + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId="
+                + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey()
+                + ", executionId=" + execution.getId() + " \n\n");
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
index 4d7a127..c128f58 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -25,14 +25,12 @@
 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
 import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
 import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -65,12 +63,12 @@
         String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf.json");
         String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json");
 
-        String oofCallbackNoSolution = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
-        String oofCallbackPolicyException = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
-        String oofCallbackServiceException = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
+        String oofCallbackNoSolution =
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
+        String oofCallbackPolicyException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
+        String oofCallbackServiceException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
 
         callbacks.put("oof", JSON, "oofResponse", oofCallback);
         callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
@@ -121,133 +119,73 @@
         VnfResource vnf = new VnfResource();
         vnf.setResourceId("testResourceIdVNF");
         vnf.setNfFunction("testVnfFunctionName");
-        vnf.getHomingSolution().setOofDirectives(
-                "{ \n" +
-                        "      \"directives\":[ \n" +
-                        "         { \n" +
-                        "            \"vnfc_directives\":[ \n" +
-                        "               { \n" +
-                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
-                        "                  \"directives\":[ \n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
-                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     },\n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
-                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
-                        "                           },\n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
-                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     }\n" +
-                        "                  ]\n" +
-                        "               }\n" +
-                        "            ]\n" +
-                        "         },\n" +
-                        "         { \n" +
-                        "            \"vnf_directives\":{ \n" +
-                        "               \"directives\":[ \n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value>\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  },\n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        },\n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  }\n" +
-                        "               ]\n" +
-                        "            }\n" +
-                        "         }\n" +
-                        "      ]\n" +
-                        "   },\n" +
-                        "   \"sdnc_directives\":{ \n" +
-                        "      \"directives\":[ \n" +
-                        "         { \n" +
-                        "            \"vnfc_directives\":[ \n" +
-                        "               { \n" +
-                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
-                        "                  \"directives\":[ \n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
-                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     },\n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
-                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
-                        "                           },\n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
-                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     }\n" +
-                        "                  ]\n" +
-                        "               }\n" +
-                        "            ]\n" +
-                        "         },\n" +
-                        "         { \n" +
-                        "            \"vnf_directives\":{ \n" +
-                        "               \"directives\":[ \n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value>\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  },\n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        },\n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  }\n" +
-                        "               ]\n" +
-                        "            }\n" +
-                        "         }\n" +
-                        "      ]\n" +
-                        "   }");
+        vnf.getHomingSolution().setOofDirectives("{ \n" + "      \"directives\":[ \n" + "         { \n"
+                + "            \"vnfc_directives\":[ \n" + "               { \n"
+                + "                  \"vnfc_id\":\"<ID of VNFC>\",\n" + "                  \"directives\":[ \n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+                + "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     },\n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+                + "                              \"attribute_value\":\"<value such as direct/normal>\"\n"
+                + "                           },\n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+                + "                              \"attribute_value\":\"<value such as physnet>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     }\n"
+                + "                  ]\n" + "               }\n" + "            ]\n" + "         },\n" + "         { \n"
+                + "            \"vnf_directives\":{ \n" + "               \"directives\":[ \n"
+                + "                  { \n" + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value>\"\n" + "                        }\n"
+                + "                     ]\n" + "                  },\n" + "                  { \n"
+                + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        },\n"
+                + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        }\n"
+                + "                     ]\n" + "                  }\n" + "               ]\n" + "            }\n"
+                + "         }\n" + "      ]\n" + "   },\n" + "   \"sdnc_directives\":{ \n" + "      \"directives\":[ \n"
+                + "         { \n" + "            \"vnfc_directives\":[ \n" + "               { \n"
+                + "                  \"vnfc_id\":\"<ID of VNFC>\",\n" + "                  \"directives\":[ \n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+                + "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     },\n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+                + "                              \"attribute_value\":\"<value such as direct/normal>\"\n"
+                + "                           },\n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+                + "                              \"attribute_value\":\"<value such as physnet>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     }\n"
+                + "                  ]\n" + "               }\n" + "            ]\n" + "         },\n" + "         { \n"
+                + "            \"vnf_directives\":{ \n" + "               \"directives\":[ \n"
+                + "                  { \n" + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value>\"\n" + "                        }\n"
+                + "                     ]\n" + "                  },\n" + "                  { \n"
+                + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        },\n"
+                + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        }\n"
+                + "                     ]\n" + "                  }\n" + "               ]\n" + "            }\n"
+                + "         }\n" + "      ]\n" + "   }");
         ModelInfo vnfModel = new ModelInfo();
         vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
         vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -264,11 +202,12 @@
         serviceDecomposition.setServiceInstance(si);
 
         // Subscriber
-        subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+        subscriber =
+                "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
         subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
     }
 
-    @Test    
+    @Test
     public void testHoming_success_2AR1Vnf() throws Exception {
 
         mockOof(wireMockServer);
@@ -283,11 +222,11 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -305,22 +244,23 @@
         expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+                "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
-                true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
         assertEquals(verifyOofRequest(), expectedOofRequest);
     }
 
-    @Test  
+    @Test
     public void testHoming_success_2AR1Vnf2Net() throws Exception {
 
         mockOof(wireMockServer);
@@ -335,11 +275,11 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -367,28 +307,27 @@
 
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+                "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),
-                "aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud","aic",
-                "testCloudRegionId3",
-                true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
-        assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
-                "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
-                "testCloudRegionIdNet",
-                null, null), resourceNetHomingString);
-        assertEquals(homingSolutionCloud("cloud", "aic",
-                "testCloudRegionIdNet2",
-                false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+        assertEquals(
+                homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet",
+                        resourceNetHoming.getVnf().getResourceId(), "aic", "testCloudRegionIdNet", null, null),
+                resourceNetHomingString);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionIdNet2", false,
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
                 resourceNetHoming2String);
         assertEquals(verifyOofRequest(), expectedOofRequest);
 
@@ -402,8 +341,7 @@
                 "/BuildingBlocks/oofCatalogResp.json");
         String busKey = UUID.randomUUID().toString();
         Map<String, Object> vars = new HashMap<>();
-        setVariablesForServiceDecomposition(vars, "testRequestId123",
-                "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
         invokeSubProcess("DecomposeService", busKey, vars);
 
         ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
@@ -438,12 +376,12 @@
         injectWorkflowMessages(callbacks, "oof3");
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
+        // Get Variables
 
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp);
 
         Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
@@ -457,26 +395,26 @@
 
         assertNull(workflowException);
 
-        //Verify request
+        // Verify request
         String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
         System.out.println("oofRequest is: " + oofRequest);
-        assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
-                replaceAll("\n", "").replaceAll("\r", "").
-                replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
-                replaceAll("\r", "").replaceAll("\t", ""));
+        assertEquals(
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").replaceAll("\n", "")
+                        .replaceAll("\r", "").replaceAll("\t", ""),
+                oofRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
 
-        //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+        // System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " +
+        // resourceVnfHoming.getVnf().getResourceId());
 
-        assertEquals(homingSolutionService("service", "service-instance-01234",
-                "MDTNJ01", "test-resource-id-000","CloudOwner",
-                "mtmnj1a",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
-                        " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
-                        " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+        assertEquals(
+                homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000",
+                        "CloudOwner", "mtmnj1a",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVnfHomingString);
     }
 
-    @Test   
+    @Test
     public void testHoming_success_existingLicense() throws Exception {
 
         mockOof(wireMockServer);
@@ -491,9 +429,11 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -511,24 +451,25 @@
         oofRequest = oofRequest.replaceAll("\\s+", "");
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                "aic", "dfwtx", "KDTNJ01",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud", "aic",
-                "testCloudRegionId3",
-                false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", false,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
         assertEquals(verifyOofRequestExistingLicense(), oofRequest);
 
     }
 
-    @Test  
+    @Test
     public void testHoming_error_inputVariable() throws Exception {
 
         String businessKey = UUID.randomUUID().toString();
@@ -539,15 +480,15 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
-                "input variable is missing or null,workStep=*]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+                + "input variable is missing or null,workStep=*]", workflowException.toString());
     }
 
-    @Test  
+    @Test
     public void testHoming_error_badResponse() throws Exception {
         mockOof_500(wireMockServer);
 
@@ -559,14 +500,16 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]",
+                workflowException.toString());
     }
 
-    @Test   
+    @Test
     public void testHoming_error_oofNoSolution() throws Exception {
         mockOof(wireMockServer);
 
@@ -580,15 +523,16 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
-                        "Response contains error: Unable to find any candidate for demand *** Response:");
-        assert(errorMatch);
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        Boolean errorMatch = workflowException.toString()
+                .contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+                        + "Response contains error: Unable to find any candidate for demand *** Response:");
+        assert (errorMatch);
     }
 
-    @Test  
+    @Test
     public void testHoming_error_oofPolicyException() throws Exception {
         mockOof(wireMockServer);
 
@@ -602,16 +546,16 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
-                "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
-                "limit]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+                + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable "
+                + "limit]", workflowException.toString());
     }
 
-    @Test   
+    @Test
     public void testHoming_error_oofServiceException() throws Exception {
         mockOof(wireMockServer);
 
@@ -623,14 +567,15 @@
         injectWorkflowMessages(callbacks, "oofServiceEx");
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
-                        "Response contains a Request Error Service Exception: OOF PlacementError: " +
-                        "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
-                        "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+                        + "Response contains a Request Error Service Exception: OOF PlacementError: "
+                        + "requests.exceptions.HTTPError: 404 Client Error: Not Found for "
+                        + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
                 workflowException.toString());
     }
 
@@ -649,7 +594,7 @@
         variables.put("cloudRegionId", "TNZED");
         variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
         variables.put("vgMuxInfraModelId", "testArModelUuid");
-        //	variables.put("mso-request-id", "testRequestId");
+        // variables.put("mso-request-id", "testRequestId");
         variables.put("msoRequestId", "testRequestId");
         variables.put("serviceInstanceId", "testServiceInstanceId123");
         variables.put("serviceInstanceName", "testServiceName");
@@ -716,7 +661,7 @@
         variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
         variables.put("vgMuxInfraModelId", "testArModelUuid");
         variables.put("isDebugLogEnabled", "true");
-        //	variables.put("mso-request-id", "testRequestId");
+        // variables.put("mso-request-id", "testRequestId");
         variables.put("msoRequestId", "testRequestId");
         variables.put("serviceInstanceId", "testServiceInstanceId123");
         variables.put("serviceInstanceName", "testServiceName");
@@ -727,11 +672,15 @@
     private void setVariablesExistingLicense(Map<String, Object> variables) {
         HomingSolution currentHomingSolution = new HomingSolution();
         serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId2");
 
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId2");
 
         variables.put("isDebugLogEnabled", "true");
         variables.put("msoRequestId", "testRequestId");
@@ -742,56 +691,52 @@
     }
 
     private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
-                                         String vnfResourceId, String cloudOwner,
-                                         String cloudRegionId, String enList,
-                                         String licenseList){
+            String vnfResourceId, String cloudOwner, String cloudRegionId, String enList, String licenseList) {
 
         String solution = "";
-        if(enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
-                    serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
-                    cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
-                    "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
-                    " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
-                    " \"rehome\" : false } }";
-        }else{
-            //language=JSON
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
-                    serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
-                    cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
-                    " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
-                    " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
-                    " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+                    + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId
+                    + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :"
+                    + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { },"
+                    + " \"rehome\" : false } }";
+        } else {
+            // language=JSON
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+                    + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :"
+                    + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :"
+                    + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :"
+                    + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList
+                    + " ] }, \"rehome\" : false } }";
         }
         return solution;
     }
 
-    private String homingSolutionCloud(String type, String cloudOwner,
-                                       String cloudRegionId, Boolean flavors, String enList,
-                                       String licenseList){
+    private String homingSolutionCloud(String type, String cloudOwner, String cloudRegionId, Boolean flavors,
+            String enList, String licenseList) {
         String solution = "";
-        if(enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"license\" : { }, \"rehome\" : false } }";
-        } else if (flavors && enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"flavors\" :  [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
-                    "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
-                    "\"license\" : { }, \"rehome\" : false } }";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { }, \"rehome\" : false } }";
+        } else if (flavors && enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId
+                    + "\", \"flavors\" :  [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+                    + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+                    + "\"license\" : { }, \"rehome\" : false } }";
         } else if (flavors) {
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
-                    "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
-                    "\"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
-                    licenseList +  " ] }, \"rehome\" : false } }";
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId
+                    + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+                    + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+                    + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ "
+                    + licenseList + " ] }, \"rehome\" : false } }";
         } else {
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
-                    licenseList +  " ] }, \"rehome\" : false } }";
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+                    + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
         }
         return solution;
     }
@@ -814,68 +759,67 @@
         variables.put("cloudRegionId", "TNZED");
 
 
-        String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
-                "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+        String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":"
+                + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
         variables.put("serviceModelInfo", serviceModelInfo);
     }
 
     private String verifyOofRequest() {
-        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
-                "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
-                "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
-                "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
-                "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
-                "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
-                "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" +
-                ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
-                "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
-                "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" +
-                "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," +
-                "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," +
-                "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
-                "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," +
-                "\"modelType\":\"\",\"modelVersion\":\"\"," +
-                "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" +
-                "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" +
-                ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" +
-                "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" +
-                ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
-                "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
-                "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
-                "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
-                "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
-                "\"}}}";
+        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+                + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\","
+                + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"],"
+                + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":"
+                + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":"
+                + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+                + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\""
+                + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":"
+                + "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\","
+                + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":"
+                + "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}},"
+                + "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\","
+                + "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\","
+                + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\","
+                + "\"modelType\":\"\",\"modelVersion\":\"\","
+                + "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\""
+                + "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\""
+                + ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\""
+                + "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\""
+                + ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":"
+                + "{\"serviceInstanceId\":\"testServiceInstanceId123\","
+                + "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":"
+                + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\","
+                + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + "\"}}}";
         return request;
     }
 
-    private String verifyOofRequestExistingLicense(){
-        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
-                "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
-                "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
-                "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
-                "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
-                "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
-                "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
-                "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
-                "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
-                "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
-                "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
-                "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
-                "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
-                "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
-                "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
-                "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
-                "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
-                "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
-                "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
-                "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
-                "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
-                "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
-                "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
-                "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
-                "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
-                "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
-                "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+    private String verifyOofRequestExistingLicense() {
+        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+                + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\","
+                + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],"
+                + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\","
+                + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":"
+                + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":"
+                + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+                + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":"
+                + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\","
+                + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\","
+                + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\","
+                + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":"
+                + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":"
+                + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":"
+                + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\","
+                + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\","
+                + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\","
+                + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":"
+                + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\","
+                + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":"
+                + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\","
+                + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\","
+                + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},"
+                + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\","
+                + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\","
+                + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":"
+                + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
         return request;
     }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 390f529..39a8995 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -38,14 +38,12 @@
 import org.onap.so.bpmn.mock.FileUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
@@ -59,7 +57,7 @@
 @Ignore
 public class OofHomingTestIT extends BaseIntegrationTest {
 
-	Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+    Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
 
     ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
     String subscriber = "";
@@ -72,12 +70,11 @@
         String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf");
         String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net");
 
-        String oofCallbackNoSolution = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
-        String oofCallbackPolicyException = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
-        String oofCallbackServiceException = FileUtil.
-                readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
+        String oofCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
+        String oofCallbackPolicyException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
+        String oofCallbackServiceException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
 
         callbacks.put("oof", JSON, "oofResponse", oofCallback);
         callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
@@ -128,133 +125,73 @@
         VnfResource vnf = new VnfResource();
         vnf.setResourceId("testResourceIdVNF");
         vnf.setResourceInstanceName("testVnfInstanceName");
-        vnf.getHomingSolution().setOofDirectives(
-                "{ \n" +
-                        "      \"directives\":[ \n" +
-                        "         { \n" +
-                        "            \"vnfc_directives\":[ \n" +
-                        "               { \n" +
-                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
-                        "                  \"directives\":[ \n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
-                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     },\n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
-                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
-                        "                           },\n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
-                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     }\n" +
-                        "                  ]\n" +
-                        "               }\n" +
-                        "            ]\n" +
-                        "         },\n" +
-                        "         { \n" +
-                        "            \"vnf_directives\":{ \n" +
-                        "               \"directives\":[ \n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value>\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  },\n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        },\n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  }\n" +
-                        "               ]\n" +
-                        "            }\n" +
-                        "         }\n" +
-                        "      ]\n" +
-                        "   },\n" +
-                        "   \"sdnc_directives\":{ \n" +
-                        "      \"directives\":[ \n" +
-                        "         { \n" +
-                        "            \"vnfc_directives\":[ \n" +
-                        "               { \n" +
-                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
-                        "                  \"directives\":[ \n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
-                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     },\n" +
-                        "                     { \n" +
-                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
-                        "                        \"attributes\":[ \n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
-                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
-                        "                           },\n" +
-                        "                           { \n" +
-                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
-                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
-                        "                           }\n" +
-                        "                        ]\n" +
-                        "                     }\n" +
-                        "                  ]\n" +
-                        "               }\n" +
-                        "            ]\n" +
-                        "         },\n" +
-                        "         { \n" +
-                        "            \"vnf_directives\":{ \n" +
-                        "               \"directives\":[ \n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value>\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  },\n" +
-                        "                  { \n" +
-                        "                     \"directive_name\":\"<Name of directive>\",\n" +
-                        "                     \"attributes\":[ \n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        },\n" +
-                        "                        { \n" +
-                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
-                        "                           \"attribute_value\":\"<value >\"\n" +
-                        "                        }\n" +
-                        "                     ]\n" +
-                        "                  }\n" +
-                        "               ]\n" +
-                        "            }\n" +
-                        "         }\n" +
-                        "      ]\n" +
-                        "   }");
+        vnf.getHomingSolution().setOofDirectives("{ \n" + "      \"directives\":[ \n" + "         { \n"
+                + "            \"vnfc_directives\":[ \n" + "               { \n"
+                + "                  \"vnfc_id\":\"<ID of VNFC>\",\n" + "                  \"directives\":[ \n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+                + "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     },\n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+                + "                              \"attribute_value\":\"<value such as direct/normal>\"\n"
+                + "                           },\n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+                + "                              \"attribute_value\":\"<value such as physnet>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     }\n"
+                + "                  ]\n" + "               }\n" + "            ]\n" + "         },\n" + "         { \n"
+                + "            \"vnf_directives\":{ \n" + "               \"directives\":[ \n"
+                + "                  { \n" + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value>\"\n" + "                        }\n"
+                + "                     ]\n" + "                  },\n" + "                  { \n"
+                + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        },\n"
+                + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        }\n"
+                + "                     ]\n" + "                  }\n" + "               ]\n" + "            }\n"
+                + "         }\n" + "      ]\n" + "   },\n" + "   \"sdnc_directives\":{ \n" + "      \"directives\":[ \n"
+                + "         { \n" + "            \"vnfc_directives\":[ \n" + "               { \n"
+                + "                  \"vnfc_id\":\"<ID of VNFC>\",\n" + "                  \"directives\":[ \n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+                + "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     },\n"
+                + "                     { \n"
+                + "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+                + "                        \"attributes\":[ \n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+                + "                              \"attribute_value\":\"<value such as direct/normal>\"\n"
+                + "                           },\n" + "                           { \n"
+                + "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+                + "                              \"attribute_value\":\"<value such as physnet>\"\n"
+                + "                           }\n" + "                        ]\n" + "                     }\n"
+                + "                  ]\n" + "               }\n" + "            ]\n" + "         },\n" + "         { \n"
+                + "            \"vnf_directives\":{ \n" + "               \"directives\":[ \n"
+                + "                  { \n" + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value>\"\n" + "                        }\n"
+                + "                     ]\n" + "                  },\n" + "                  { \n"
+                + "                     \"directive_name\":\"<Name of directive>\",\n"
+                + "                     \"attributes\":[ \n" + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        },\n"
+                + "                        { \n"
+                + "                           \"attribute_name\":\"<name of attribute>\",\n"
+                + "                           \"attribute_value\":\"<value >\"\n" + "                        }\n"
+                + "                     ]\n" + "                  }\n" + "               ]\n" + "            }\n"
+                + "         }\n" + "      ]\n" + "   }");
         ModelInfo vnfModel = new ModelInfo();
         vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
         vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -271,7 +208,8 @@
         serviceDecomposition.setServiceInstance(si);
 
         // Subscriber
-        subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+        subscriber =
+                "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
         subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
     }
 
@@ -285,17 +223,17 @@
         Map<String, Object> variables = new HashMap<>();
         setVariables(variables);
 
-       invokeSubProcess("Homing", businessKey, variables);
+        invokeSubProcess("Homing", businessKey, variables);
 
         injectWorkflowMessages(callbacks, "oof2");
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -313,17 +251,18 @@
         expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+                "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
-                true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
         assertEquals(verifyOofRequest(), expectedOofRequest);
     }
@@ -338,17 +277,17 @@
         Map<String, Object> variables = new HashMap<>();
         setVariables2(variables);
 
-       invokeSubProcess("Homing", businessKey, variables);
+        invokeSubProcess("Homing", businessKey, variables);
 
         injectWorkflowMessages(callbacks, "oof3");
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -376,28 +315,27 @@
 
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+                "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),
-                "aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud","aic",
-                "testCloudRegionId3",
-                true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
-        assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
-                "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
-                "testCloudRegionIdNet",
-                null, null), resourceNetHomingString);
-        assertEquals(homingSolutionCloud("cloud", "aic",
-                "testCloudRegionIdNet2",
-                false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+        assertEquals(
+                homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet",
+                        resourceNetHoming.getVnf().getResourceId(), "aic", "testCloudRegionIdNet", null, null),
+                resourceNetHomingString);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionIdNet2", false,
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
                 resourceNetHoming2String);
         assertEquals(verifyOofRequest(), expectedOofRequest);
 
@@ -413,12 +351,10 @@
                 "/BuildingBlocks/oofCatalogResp.json");
         String busKey = UUID.randomUUID().toString();
         Map<String, Object> vars = new HashMap<>();
-        setVariablesForServiceDecomposition(vars, "testRequestId123",
-                "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
         invokeSubProcess("DecomposeService", busKey, vars);
 
-        ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
-                "serviceDecomposition");
+        ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
         logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = {}", sd);
         List<VnfResource> vnfResourceList = sd.getVnfResources();
         vnfResourceList.get(0).setResourceId("test-resource-id-000");
@@ -450,12 +386,12 @@
         injectWorkflowMessages(callbacks, "oof3");
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
+        // Get Variables
 
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
-                "serviceDecomposition");
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         logger.debug("serviceDecompositionExp is: {}", serviceDecompositionExp);
 
         Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
@@ -469,21 +405,20 @@
 
         assertNull(workflowException);
 
-        //Verify request
+        // Verify request
         String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
         logger.debug("oofRequest is: {}", oofRequest);
-        assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
-                replaceAll("\n", "").replaceAll("\r", "").
-                replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
-                replaceAll("\r", "").replaceAll("\t", ""));
+        assertEquals(
+                FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").replaceAll("\n", "")
+                        .replaceAll("\r", "").replaceAll("\t", ""),
+                oofRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
 
-        assertEquals(homingSolutionService("service", "service-instance-01234",
-                "MDTNJ01", "test-resource-id-000","CloudOwner",
-                "mtmnj1a",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
-                        " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
-                        " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+        assertEquals(
+                homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000",
+                        "CloudOwner", "mtmnj1a",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVnfHomingString);
     }
 
     @Test
@@ -501,9 +436,11 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-        ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
         String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
 
         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -521,18 +458,19 @@
         oofRequest = oofRequest.replaceAll("\\s+", "");
 
         assertNull(workflowException);
-        assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
-                "aic", "dfwtx", "KDTNJ01",
-                "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceARHomingString);
-        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
-                resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
-                null, null), resourceARHoming2String);
-        assertEquals(homingSolutionCloud("cloud", "aic",
-                "testCloudRegionId3",
-                false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
-                "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+        assertEquals(
+                homingSolutionService("service", "testSIID2", "testVnfHostname2",
+                        resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+                resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "aic", "testCloudRegionId3", false,
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
                 resourceVNFHomingString);
         assertEquals(verifyOofRequestExistingLicense(), oofRequest);
 
@@ -549,12 +487,12 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
-                "input variable is missing or null]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+                + "input variable is missing or null]", workflowException.toString());
     }
 
     @Test
@@ -570,12 +508,12 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " +
-                "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a "
+                + "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
     }
 
     @Test
@@ -593,12 +531,12 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " +
-                "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found "
+                + "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
     }
 
     @Test
@@ -616,13 +554,13 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
-                "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
-                "limit]", workflowException.toString());
+        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+                + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable "
+                + "limit]", workflowException.toString());
     }
 
     @Test
@@ -640,14 +578,15 @@
 
         waitForProcessEnd(businessKey, 10000);
 
-        //Get Variables
-        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
-                "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-        assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
-                        "Response contains a Request Error Service Exception: OOF PlacementError: " +
-                        "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
-                        "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+                        + "Response contains a Request Error Service Exception: OOF PlacementError: "
+                        + "requests.exceptions.HTTPError: 404 Client Error: Not Found for "
+                        + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
                 workflowException.toString());
     }
 
@@ -665,7 +604,7 @@
         variables.put("cloudOwner", "amazon");
         variables.put("cloudRegionId", "TNZED");
         variables.put("isDebugLogEnabled", "true");
-        //	variables.put("mso-request-id", "testRequestId");
+        // variables.put("mso-request-id", "testRequestId");
         variables.put("msoRequestId", "testRequestId");
         variables.put("serviceInstanceId", "testServiceInstanceId");
         variables.put("serviceDecomposition", serviceDecomposition);
@@ -726,7 +665,7 @@
         variables.put("cloudOwner", "amazon");
         variables.put("cloudRegionId", "TNZED");
         variables.put("isDebugLogEnabled", "true");
-        //	variables.put("mso-request-id", "testRequestId");
+        // variables.put("mso-request-id", "testRequestId");
         variables.put("msoRequestId", "testRequestId");
         variables.put("serviceInstanceId", "testServiceInstanceId");
         variables.put("serviceDecomposition", null);
@@ -736,11 +675,15 @@
     private void setVariablesExistingLicense(Map<String, Object> variables) {
         HomingSolution currentHomingSolution = new HomingSolution();
         serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId2");
 
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
-        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId2");
 
         variables.put("isDebugLogEnabled", "true");
         variables.put("msoRequestId", "testRequestId");
@@ -751,56 +694,52 @@
     }
 
     private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
-                                         String vnfResourceId, String cloudOwner,
-                                         String cloudRegionId, String enList,
-                                         String licenseList){
+            String vnfResourceId, String cloudOwner, String cloudRegionId, String enList, String licenseList) {
 
         String solution = "";
-        if(enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
-                    serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
-                    cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
-                    "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
-                    " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
-                    " \"rehome\" : false } }";
-        }else{
-            //language=JSON
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
-                    serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
-                    cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
-                    " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
-                    " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
-                    " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+                    + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId
+                    + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :"
+                    + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { },"
+                    + " \"rehome\" : false } }";
+        } else {
+            // language=JSON
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+                    + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :"
+                    + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :"
+                    + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :"
+                    + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList
+                    + " ] }, \"rehome\" : false } }";
         }
         return solution;
     }
 
-    private String homingSolutionCloud(String type, String cloudOwner,
-                                       String cloudRegionId, Boolean flavors, String enList,
-                                       String licenseList){
+    private String homingSolutionCloud(String type, String cloudOwner, String cloudRegionId, Boolean flavors,
+            String enList, String licenseList) {
         String solution = "";
-        if(enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"license\" : { }, \"rehome\" : false } }";
-        } else if (flavors && enList == null){
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"flavors\" :  [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
-                    "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
-                    "\"license\" : { }, \"rehome\" : false } }";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { }, \"rehome\" : false } }";
+        } else if (flavors && enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId
+                    + "\", \"flavors\" :  [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+                    + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+                    + "\"license\" : { }, \"rehome\" : false } }";
         } else if (flavors) {
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
-                    "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
-                    "\"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
-                    licenseList +  " ] }, \"rehome\" : false } }";
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId
+                    + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+                    + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+                    + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ "
+                    + licenseList + " ] }, \"rehome\" : false } }";
         } else {
-            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
-                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
-                    "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
-                    licenseList +  " ] }, \"rehome\" : false } }";
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+                    + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
         }
         return solution;
     }
@@ -823,68 +762,68 @@
         variables.put("cloudRegionId", "TNZED");
 
 
-        String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
-                "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+        String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":"
+                + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
         variables.put("serviceModelInfo", serviceModelInfo);
     }
 
     private String verifyOofRequest() {
-        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
-                "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
-                "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
-                "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
-                "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
-                "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
-                "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" +
-                ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
-                "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
-                "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" +
-                "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," +
-                "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," +
-                "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
-                "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," +
-                "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," +
-                "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
-                "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
-                "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
-                "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
-                "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
-                "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" +
-                "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" +
-                "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" +
-                "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
-                "\"modelCustomizationName\":\"\"}}]}}";
+        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+                + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\","
+                + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"],"
+                + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":"
+                + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":"
+                + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+                + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\""
+                + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":"
+                + "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\","
+                + "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":"
+                + "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}},"
+                + "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\","
+                + "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\","
+                + "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\","
+                + "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\","
+                + "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":"
+                + "{\"serviceInstanceId\":\"testServiceInstanceId123\","
+                + "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":"
+                + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\","
+                + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\""
+                + "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":"
+                + "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":"
+                + "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":"
+                + "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\","
+                + "\"modelCustomizationName\":\"\"}}]}}";
         return request;
     }
 
-    private String verifyOofRequestExistingLicense(){
-        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
-                "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
-                "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
-                "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
-                "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
-                "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
-                "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
-                "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
-                "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
-                "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
-                "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
-                "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
-                "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
-                "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
-                "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
-                "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
-                "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
-                "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
-                "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
-                "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
-                "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
-                "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
-                "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
-                "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
-                "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
-                "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
-                "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+    private String verifyOofRequestExistingLicense() {
+        String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+                + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\","
+                + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],"
+                + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\","
+                + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":"
+                + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":"
+                + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+                + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":"
+                + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\","
+                + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\","
+                + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\","
+                + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":"
+                + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":"
+                + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":"
+                + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\","
+                + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\","
+                + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\","
+                + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":"
+                + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\","
+                + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":"
+                + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\","
+                + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\","
+                + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},"
+                + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\","
+                + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\","
+                + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":"
+                + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
         return request;
     }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
index c994173..ace5fdd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -27,12 +27,10 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Test;
@@ -47,164 +45,176 @@
  */
 
 public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class);
-	
-	/**
-	 * Test the happy path through the flow.
-	 */
-	@Test	
-	
-	public void happyPath() throws IOException {
-		
-		logStart();
-		
-		String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); 
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
-		MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-	variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
-		invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(200, responseCode.intValue());
-		String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
-		logger.debug("Ouput heat-stack-id:{}", heatStackId);
-		Assert.assertEquals("slowburn", heatStackId);
-		
-		logEnd();
-	}
-	
-	/**
-	 * Test the case where the GET to AAI returns a 404.
-	 */
-	@Test	
-	
-	public void badGet() throws IOException {
-		
-		logStart();
-		
-		String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); 
-		MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-	variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
-		invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		Assert.assertNotNull(workflowException);
-		logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-		
-		logEnd();
-	}
-	
-	/**
-	 * Test the case where the validation of the VF Module fails.
-	 */
-	@Test	
-	
-	public void failValidation1() throws IOException {
-		
-		logStart();
-		
-		String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm");
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-	variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
-		invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-		
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		Assert.assertNotNull(workflowException);
-		logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-		Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
-		
-		logEnd();
-	}
-	
-	/**
-	 * Test the case where the validation of the VF Module fails.
-	 */
-	@Test	
-	
-	public void failValidation2() throws IOException {
-		
-		logStart();
-		
-		String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool");
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");		
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-	variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
-		invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-			
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		Assert.assertNotNull(workflowException);
-		logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-		Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
-		
-		logEnd();
-	}
 
-	/**
-	 * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
-	 */
-	@Test	
-	
-	public void badPatch() throws IOException {
-		
-		logStart();
-		
-		String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); 
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
-		invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		Assert.assertNotNull(workflowException);
-		logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-		
-		logEnd();
-	}
+    Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class);
+
+    /**
+     * Test the happy path through the flow.
+     */
+    @Test
+
+    public void happyPath() throws IOException {
+
+        logStart();
+
+        String prepareUpdateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+        MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+        MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+        invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(200, responseCode.intValue());
+        String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
+        logger.debug("Ouput heat-stack-id:{}", heatStackId);
+        Assert.assertEquals("slowburn", heatStackId);
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI returns a 404.
+     */
+    @Test
+
+    public void badGet() throws IOException {
+
+        logStart();
+
+        String prepareUpdateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+        MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+        invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+        Assert.assertNotNull(workflowException);
+        logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the validation of the VF Module fails.
+     */
+    @Test
+
+    public void failValidation1() throws IOException {
+
+        logStart();
+
+        String prepareUpdateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml")
+                        .replaceFirst("supercool", "lukewarm");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+        invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        Assert.assertNotNull(workflowException);
+        logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+        Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the validation of the VF Module fails.
+     */
+    @Test
+
+    public void failValidation2() throws IOException {
+
+        logStart();
+
+        String prepareUpdateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml")
+                        .replaceFirst("supercool", "notsocool");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+        invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        Assert.assertNotNull(workflowException);
+        logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+        Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
+     */
+    @Test
+
+    public void badPatch() throws IOException {
+
+        logStart();
+
+        String prepareUpdateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+        MockAAIVfModuleBadPatch(wireMockServer,
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+        invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+        Assert.assertNotNull(workflowException);
+        logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+
+        logEnd();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
index 2f6d2ae..d669674 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
@@ -16,16 +16,14 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import static org.onap.so.bpmn.mock.StubResponsePolicy.MockPolicyAbort;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
@@ -35,35 +33,35 @@
  */
 
 public class RainyDayHandlerIT extends BaseIntegrationTest {
-	
-	@Test	
-	
-	public void  TestRainyDayHandlingSuccess() {
 
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled","true");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceType", "X");
-		variables.put("vnfType", "Y");
-		variables.put("currentActivity", "BB1");		
-		variables.put("workStep", "1");
-		variables.put("failedActivity", "");
-		variables.put("errorCode", "123");
-		variables.put("errorText", "update failed");
-		variables.put("vnfName", "vSAMP1");
-		
-		MockPolicyAbort(wireMockServer);
-		
-		
-		String businessKey = UUID.randomUUID().toString();
-		invokeSubProcess("RainyDayHandler", businessKey, variables);
+    @Test
 
-		waitForProcessEnd(businessKey, 10000);
+    public void TestRainyDayHandlingSuccess() {
 
-		Assert.assertTrue(isProcessEnded(businessKey));
-		
-	}
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceType", "X");
+        variables.put("vnfType", "Y");
+        variables.put("currentActivity", "BB1");
+        variables.put("workStep", "1");
+        variables.put("failedActivity", "");
+        variables.put("errorCode", "123");
+        variables.put("errorText", "update failed");
+        variables.put("vnfName", "vSAMP1");
 
-	
-	
-}
\ No newline at end of file
+        MockPolicyAbort(wireMockServer);
+
+
+        String businessKey = UUID.randomUUID().toString();
+        invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+        waitForProcessEnd(businessKey, 10000);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+
+    }
+
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
index 7f3e884..d8e3264 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
@@ -17,7 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
- 
+
 package org.onap.so.bpmn.common;
 
 import static org.junit.Assert.assertEquals;
@@ -25,12 +25,10 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -44,102 +42,85 @@
 @Ignore
 public class ReceiveWorkflowMessageTest extends WorkflowTest {
 
-	private static final String EOL = "\n";
+    private static final String EOL = "\n";
 
-	private final CallbackSet callbacks = new CallbackSet();
+    private final CallbackSet callbacks = new CallbackSet();
 
-	public ReceiveWorkflowMessageTest() throws IOException {
-		callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
-			"{" + EOL +
-			"  \"SDNCEvent\": {" + EOL +
-			"    \"eventType\": \"evenType\"," + EOL +
-			"    \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
-			"    \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
-			"    \"params\": {" + EOL +
-			"      \"success-indicator\":\"Y\"" + EOL +
-			"	 }" +EOL +
-			"  }" + EOL +
-			"}" + EOL);
+    public ReceiveWorkflowMessageTest() throws IOException {
+        callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
+                "{" + EOL + "  \"SDNCEvent\": {" + EOL + "    \"eventType\": \"evenType\"," + EOL
+                        + "    \"eventCorrelatorType\": \"HOST-NAME\"," + EOL
+                        + "    \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + "    \"params\": {" + EOL
+                        + "      \"success-indicator\":\"Y\"" + EOL + "	 }" + EOL + "  }" + EOL + "}" + EOL);
 
-		callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent",
-			"{" + EOL +
-			"  \"SDNCEvent\": {" + EOL +
-			"    \"eventType\": \"evenType\"," + EOL +
-			"    \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
-			"    \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
-			"    \"params\": {" + EOL +
-			"      \"success-indicator\":\"N\"," + EOL +
-			"      \"error-message\":\"SOMETHING BAD HAPPENED\"" + EOL +
-			"	 }" +EOL +
-			"  }" + EOL +
-			"}" + EOL);
-	}
+        callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent", "{" + EOL + "  \"SDNCEvent\": {" + EOL
+                + "    \"eventType\": \"evenType\"," + EOL + "    \"eventCorrelatorType\": \"HOST-NAME\"," + EOL
+                + "    \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + "    \"params\": {" + EOL
+                + "      \"success-indicator\":\"N\"," + EOL + "      \"error-message\":\"SOMETHING BAD HAPPENED\""
+                + EOL + "	 }" + EOL + "  }" + EOL + "}" + EOL);
+    }
 
-	/**
-	 * Test the happy path.
-	 */
-	@Test
-	@Deployment(resources = {
-		"subprocess/ReceiveWorkflowMessage.bpmn"
-		})
-	public void happyPath() throws Exception {
+    /**
+     * Test the happy path.
+     */
+    @Test
+    @Deployment(resources = {"subprocess/ReceiveWorkflowMessage.bpmn"})
+    public void happyPath() throws Exception {
 
-		logStart();
+        logStart();
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("RCVWFMSG_timeout", "PT1M");
-		variables.put("RCVWFMSG_messageType", "SDNCAEvent");
-		variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("RCVWFMSG_timeout", "PT1M");
+        variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+        variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
 
-		invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
-		injectWorkflowMessages(callbacks, "sdnc-event-success");
-		waitForProcessEnd(businessKey, 10000);
+        invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+        injectWorkflowMessages(callbacks, "sdnc-event-success");
+        waitForProcessEnd(businessKey, 10000);
 
-		String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
-		System.out.println("Response:\n" + response);
-		assertTrue(response.contains("\"SDNCEvent\""));
-		assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+        String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+        System.out.println("Response:\n" + response);
+        assertTrue(response.contains("\"SDNCEvent\""));
+        assertTrue((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
 
-		logEnd();
-	}
+        logEnd();
+    }
 
-	/**
-	 * Test the timeout scenario.
-	 */
-	@Test
-	@Deployment(resources = {
-		"subprocess/ReceiveWorkflowMessage.bpmn"
-		})
-	public void timeout() throws Exception {
+    /**
+     * Test the timeout scenario.
+     */
+    @Test
+    @Deployment(resources = {"subprocess/ReceiveWorkflowMessage.bpmn"})
+    public void timeout() throws Exception {
 
-		logStart();
+        logStart();
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("RCVWFMSG_timeout", "PT5S");
-		variables.put("RCVWFMSG_messageType", "SDNCAEvent");
-		variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("RCVWFMSG_timeout", "PT5S");
+        variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+        variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
 
-		invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+        invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
 
-		// No injection
+        // No injection
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		// There is no response from SDNC, so the flow doesn't set WorkflowResponse.
-		String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
-		assertNull(response);
-		WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		assertNotNull(wfe);
-		System.out.println(wfe.toString());
-		assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
-		assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+        // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
+        String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+        assertNull(response);
+        WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        assertNotNull(wfe);
+        System.out.println(wfe.toString());
+        assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
+        assertFalse((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
 
-		logEnd();
-	}
+        logEnd();
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
index dc5c36f..36adccd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
@@ -21,7 +21,6 @@
 package org.onap.so.bpmn.common;
 
 import javax.xml.ws.Endpoint;
-
 import org.camunda.bpm.engine.ProcessEngineServices;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
@@ -29,56 +28,54 @@
 import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
 
 /**
- * A JUnit rule that starts the SDNC Adapter Callback Service before
- * every test, and tears it down after every test.  Example:
+ * A JUnit rule that starts the SDNC Adapter Callback Service before every test, and tears it down after every test.
+ * Example:
+ * 
  * <pre>
- *     @Rule
- *     public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- *         new SDNCAdapterCallbackRule(processEngineRule);
+ * &#64;Rule
+ * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = new SDNCAdapterCallbackRule(processEngineRule);
  * </pre>
  */
 public class SDNCAdapterCallbackRule implements TestRule {
-	public static final String DEFAULT_ENDPOINT_URL =
-		"http://localhost:28080/mso/SDNCAdapterCallbackService";
+    public static final String DEFAULT_ENDPOINT_URL = "http://localhost:28080/mso/SDNCAdapterCallbackService";
 
-	private final ProcessEngineServices processEngineServices;
-	private final String endpointUrl;
+    private final ProcessEngineServices processEngineServices;
+    private final String endpointUrl;
 
-	public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
-		this(processEngineServices, DEFAULT_ENDPOINT_URL);
-	}
+    public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+        this(processEngineServices, DEFAULT_ENDPOINT_URL);
+    }
 
-	public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
-			String endpointUrl) {
-		this.processEngineServices = processEngineServices;
-		this.endpointUrl = endpointUrl;
-	}
+    public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, String endpointUrl) {
+        this.processEngineServices = processEngineServices;
+        this.endpointUrl = endpointUrl;
+    }
 
-	@Override
-	public Statement apply(final Statement baseStmt, Description description) {
-		return new Statement() {
-			@Override
-			public void evaluate() throws Throwable {
-				Endpoint endpoint = null;
+    @Override
+    public Statement apply(final Statement baseStmt, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                Endpoint endpoint = null;
 
-				try {
-					SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
-					sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
+                try {
+                    SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
+                    sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
 
-					System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
-					System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
+                    System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
+                    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
 
-					System.out.println("Publishing Endpoint - " + endpointUrl);
-					endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
+                    System.out.println("Publishing Endpoint - " + endpointUrl);
+                    endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
 
-					baseStmt.evaluate();
-				} finally {
-					if (endpoint != null) {
-						System.out.println("Stopping Endpoint - " + endpointUrl);
-						endpoint.stop();
-					}
-				}
-			}
-		};
-	}
-}
\ No newline at end of file
+                    baseStmt.evaluate();
+                } finally {
+                    if (endpoint != null) {
+                        System.out.println("Stopping Endpoint - " + endpointUrl);
+                        endpoint.stop();
+                    }
+                }
+            }
+        };
+    }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
index bf3fefd..415e809 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
@@ -25,12 +25,10 @@
 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
 import static com.github.tomakehurst.wiremock.client.WireMock.post;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -42,81 +40,78 @@
 /**
  * Unit tests for SDNCAdapterRestV2.bpmn.
  *
- * This version of SDNCAdapterRest allows for interim notifications to be sent for
- * any non-final response received from SDNC.
+ * This version of SDNCAdapterRest allows for interim notifications to be sent for any non-final response received from
+ * SDNC.
  */
 
 public class SDNCAdapterRestV2IT extends BaseIntegrationTest {
 
-	private final CallbackSet callbacks = new CallbackSet();
+    private final CallbackSet callbacks = new CallbackSet();
 
-	Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class);
+    Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class);
 
 
-	/**
-	 * Constructor. Insert callbacks.
-	 *
-	 * @throws IOException
-	 */
-	public SDNCAdapterRestV2IT() throws IOException {
-		String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
-		String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
-		callbacks.put("nonfinal", sdncCallbackNonFinal);
-		callbacks.put("final", sdncCallbackFinal);
-	}
+    /**
+     * Constructor. Insert callbacks.
+     *
+     * @throws IOException
+     */
+    public SDNCAdapterRestV2IT() throws IOException {
+        String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
+        String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
+        callbacks.put("nonfinal", sdncCallbackNonFinal);
+        callbacks.put("final", sdncCallbackFinal);
+    }
 
-	/**
-	 * Test the success path through the subflow.
-	 */
-	@Test
-	@Ignore
-	public void success() throws IOException {
-		logStart();
-		mocks();
+    /**
+     * Test the success path through the subflow.
+     */
+    @Test
+    @Ignore
+    public void success() throws IOException {
+        logStart();
+        mocks();
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<String, Object>();
-		variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
-		variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("SDNCREST_Request",
-			FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
-		variables.put("SDNCREST_InterimNotification1",
-			FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
+        variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("SDNCREST_Request", FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
+        variables.put("SDNCREST_InterimNotification1",
+                FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
 
-		invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
+        invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
 
-		injectSDNCRestCallbacks(callbacks, "nonfinal");
+        injectSDNCRestCallbacks(callbacks, "nonfinal");
 
-		// First non-final response will have done a notification
-		Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
-		Assert.assertNotNull(interimNotification);
+        // First non-final response will have done a notification
+        Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+        Assert.assertNotNull(interimNotification);
 
-		injectSDNCRestCallbacks(callbacks, "nonfinal");
+        injectSDNCRestCallbacks(callbacks, "nonfinal");
 
-		// Second non-final response will not have done a notification
-		interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
-		Assert.assertNull(interimNotification);
+        // Second non-final response will not have done a notification
+        interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+        Assert.assertNull(interimNotification);
 
-		injectSDNCRestCallbacks(callbacks, "final");
+        injectSDNCRestCallbacks(callbacks, "final");
 
-		interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
-		Assert.assertNull(interimNotification);
+        interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+        Assert.assertNull(interimNotification);
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		Assert.assertTrue(isProcessEnded(businessKey));
+        Assert.assertTrue(isProcessEnded(businessKey));
 
-		logEnd();
-	}
+        logEnd();
+    }
 
-	/**
-	 * Defines WireMock stubs needed by these tests.
-	 */
-	private void mocks() {
-		wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
-			.willReturn(aResponse()
-				.withStatus(202)
-				.withHeader("Content-Type", "application/json")));
-	}
+    /**
+     * Defines WireMock stubs needed by these tests.
+     */
+    private void mocks() {
+        wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
+                .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
index 9239889..96ea1ca 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
@@ -22,10 +22,8 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-
 import java.io.FileNotFoundException;
 import java.io.IOException;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.so.client.RestPropertiesLoader;
@@ -36,34 +34,37 @@
 
 public class SPIPropertiesTest {
 
-	@BeforeClass
-	public static void beforeClass() {
-		System.setProperty("mso.config.path", "src/test/resources");
-	}
-	
-	@Test
-	public void notEqual() {
-		DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl();
-		DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl();
-		assertNotEquals(one, two);
-	}
-	@Test
-	public void equal() {
-		DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl();
-		DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl();
-		assertEquals(one, two);
-	}
-	@Test
-	public void restNotEqual() {
-		AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
-		AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
-		assertNotEquals(one, two);
-	}
-	@Test
-	public void restEqual() {
-		AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
-		AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
-		assertEquals(one, two);
-	}
-	
+    @BeforeClass
+    public static void beforeClass() {
+        System.setProperty("mso.config.path", "src/test/resources");
+    }
+
+    @Test
+    public void notEqual() {
+        DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl();
+        DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl();
+        assertNotEquals(one, two);
+    }
+
+    @Test
+    public void equal() {
+        DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl();
+        DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl();
+        assertEquals(one, two);
+    }
+
+    @Test
+    public void restNotEqual() {
+        AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+        AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+        assertNotEquals(one, two);
+    }
+
+    @Test
+    public void restEqual() {
+        AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+        AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+        assertEquals(one, two);
+    }
+
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
index c7ba702..6b253d2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
@@ -25,14 +25,12 @@
 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
 import static org.onap.so.bpmn.mock.StubResponseSNIRO.*;
 import static org.junit.Assert.*;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -49,504 +47,588 @@
  */
 @Ignore
 public class SniroHomingV1IT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class);
-	
 
-	ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
-	String subscriber = "";
-	String subscriber2 = "";
+    Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class);
 
-	private final CallbackSet callbacks = new CallbackSet();
 
-	public SniroHomingV1IT() throws IOException {
-		String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
-		String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
-		String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
-		String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
-		String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
-		String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
-		callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
-		callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
-		callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
-		callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
-		callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
-		callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
+    ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+    String subscriber = "";
+    String subscriber2 = "";
 
-		// Service Model
-		ModelInfo sModel = new ModelInfo();
-		sModel.setModelCustomizationUuid("testModelCustomizationUuid");
-		sModel.setModelInstanceName("testModelInstanceName");
-		sModel.setModelInvariantUuid("testModelInvariantId");
-		sModel.setModelName("testModelName");
-		sModel.setModelUuid("testModelUuid");
-		sModel.setModelVersion("testModelVersion");
-		// Service Instance
-		ServiceInstance si = new ServiceInstance();
-		si.setInstanceId("testServiceInstanceId123");
-		// Allotted Resources
-		List<AllottedResource> arList = new ArrayList<AllottedResource>();
-		AllottedResource ar = new AllottedResource();
-		ar.setResourceId("testResourceIdAR");
-		ar.setResourceInstanceName("testARInstanceName");
-		ModelInfo arModel = new ModelInfo();
-		arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
-		arModel.setModelInvariantUuid("testModelInvariantIdAR");
-		arModel.setModelName("testModelNameAR");
-		arModel.setModelVersion("testModelVersionAR");
-		arModel.setModelUuid("testARModelUuid");
-		arModel.setModelType("testModelTypeAR");
-		ar.setModelInfo(arModel);
-		AllottedResource ar2 = new AllottedResource();
-		ar2.setResourceId("testResourceIdAR2");
-		ar2.setResourceInstanceName("testAR2InstanceName");
-		ModelInfo arModel2 = new ModelInfo();
-		arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
-		arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
-		arModel2.setModelName("testModelNameAR2");
-		arModel2.setModelVersion("testModelVersionAR2");
-		arModel2.setModelUuid("testAr2ModelUuid");
-		arModel2.setModelType("testModelTypeAR2");
-		ar2.setModelInfo(arModel2);
-		arList.add(ar);
-		arList.add(ar2);
-		// Vnfs
-		List<VnfResource> vnfList = new ArrayList<VnfResource>();
-		VnfResource vnf = new VnfResource();
-		vnf.setResourceId("testResourceIdVNF");
-		vnf.setResourceInstanceName("testVnfInstanceName");
-		ModelInfo vnfModel = new ModelInfo();
-		vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
-		vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
-		vnfModel.setModelName("testModelNameVNF");
-		vnfModel.setModelVersion("testModelVersionVNF");
-		vnfModel.setModelUuid("testVnfModelUuid");
-		vnfModel.setModelType("testModelTypeVNF");
-		vnf.setModelInfo(vnfModel);
-		vnfList.add(vnf);
-		logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString());
-		serviceDecomposition.setModelInfo(sModel);
-		serviceDecomposition.setAllottedResources(arList);
-		serviceDecomposition.setVnfResources(vnfList);
-		serviceDecomposition.setServiceInstance(si);
+    private final CallbackSet callbacks = new CallbackSet();
 
-		// Subscriber
-		subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
-		subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
-	}
+    public SniroHomingV1IT() throws IOException {
+        String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
+        String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
+        String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
+        String sniroCallbackNoSolution =
+                FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
+        String sniroCallbackPolicyException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
+        String sniroCallbackServiceException =
+                FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
+        callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
+        callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
+        callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
+        callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
+        callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
+        callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
 
-	@Test
-	 // 1802 merge
-	
-	public void testHoming_success_2AR1Vnf() throws Exception {
+        // Service Model
+        ModelInfo sModel = new ModelInfo();
+        sModel.setModelCustomizationUuid("testModelCustomizationUuid");
+        sModel.setModelInstanceName("testModelInstanceName");
+        sModel.setModelInvariantUuid("testModelInvariantId");
+        sModel.setModelName("testModelName");
+        sModel.setModelUuid("testModelUuid");
+        sModel.setModelVersion("testModelVersion");
+        // Service Instance
+        ServiceInstance si = new ServiceInstance();
+        si.setInstanceId("testServiceInstanceId123");
+        // Allotted Resources
+        List<AllottedResource> arList = new ArrayList<AllottedResource>();
+        AllottedResource ar = new AllottedResource();
+        ar.setResourceId("testResourceIdAR");
+        ar.setResourceInstanceName("testARInstanceName");
+        ModelInfo arModel = new ModelInfo();
+        arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+        arModel.setModelInvariantUuid("testModelInvariantIdAR");
+        arModel.setModelName("testModelNameAR");
+        arModel.setModelVersion("testModelVersionAR");
+        arModel.setModelUuid("testARModelUuid");
+        arModel.setModelType("testModelTypeAR");
+        ar.setModelInfo(arModel);
+        AllottedResource ar2 = new AllottedResource();
+        ar2.setResourceId("testResourceIdAR2");
+        ar2.setResourceInstanceName("testAR2InstanceName");
+        ModelInfo arModel2 = new ModelInfo();
+        arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+        arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+        arModel2.setModelName("testModelNameAR2");
+        arModel2.setModelVersion("testModelVersionAR2");
+        arModel2.setModelUuid("testAr2ModelUuid");
+        arModel2.setModelType("testModelTypeAR2");
+        ar2.setModelInfo(arModel2);
+        arList.add(ar);
+        arList.add(ar2);
+        // Vnfs
+        List<VnfResource> vnfList = new ArrayList<VnfResource>();
+        VnfResource vnf = new VnfResource();
+        vnf.setResourceId("testResourceIdVNF");
+        vnf.setResourceInstanceName("testVnfInstanceName");
+        ModelInfo vnfModel = new ModelInfo();
+        vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+        vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+        vnfModel.setModelName("testModelNameVNF");
+        vnfModel.setModelVersion("testModelVersionVNF");
+        vnfModel.setModelUuid("testVnfModelUuid");
+        vnfModel.setModelType("testModelTypeVNF");
+        vnf.setModelInfo(vnfModel);
+        vnfList.add(vnf);
+        logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString());
+        serviceDecomposition.setModelInfo(sModel);
+        serviceDecomposition.setAllottedResources(arList);
+        serviceDecomposition.setVnfResources(vnfList);
+        serviceDecomposition.setServiceInstance(si);
 
-		mockSNIRO(wireMockServer);
+        // Subscriber
+        subscriber =
+                "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+        subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+    }
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+    @Test
+    // 1802 merge
 
-		invokeSubProcess("Homing", businessKey, variables);
+    public void testHoming_success_2AR1Vnf() throws Exception {
 
-		injectWorkflowMessages(callbacks, "sniro");
+        mockSNIRO(wireMockServer);
 
-		waitForProcessEnd(businessKey, 10000);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
-		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+        invokeSubProcess("Homing", businessKey, variables);
 
-		Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
-		HomingSolution resourceARHoming = resourceAR.getHomingSolution();
-		Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
-		HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
-		Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
-		HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
-		String resourceARHomingString = resourceARHoming.toString();
-		resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
-		String resourceARHoming2String = resourceARHoming2.toString();
-		resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
-		String resourceVNFHomingString = resourceVNFHoming.toString();
-		resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
-		expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+        injectWorkflowMessages(callbacks, "sniro");
 
-		assertNull(workflowException);
-		assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
-		assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
-		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
-		assertEquals(verifySniroRequest(), expectedSniroRequest);
+        waitForProcessEnd(businessKey, 10000);
 
-	}
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
 
-	@Test
-	 // 1802 merge
-	
-	public void testHoming_success_2AR1Vnf2Net() throws Exception {
+        Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+        HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+        Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+        HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+        Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+        HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+        String resourceARHomingString = resourceARHoming.toString();
+        resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+        String resourceARHoming2String = resourceARHoming2.toString();
+        resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+        String resourceVNFHomingString = resourceVNFHoming.toString();
+        resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+        expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
 
-		mockSNIRO(wireMockServer);
+        assertNull(workflowException);
+        assertEquals(
+                homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceARHomingString);
+        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+                "testAicClli2", "3.0", null, null), resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVNFHomingString);
+        assertEquals(verifySniroRequest(), expectedSniroRequest);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables2(variables);
+    }
 
-		invokeSubProcess("Homing", businessKey, variables);
+    @Test
+    // 1802 merge
 
-		injectWorkflowMessages(callbacks, "sniro2");
+    public void testHoming_success_2AR1Vnf2Net() throws Exception {
 
-		waitForProcessEnd(businessKey, 10000);
+        mockSNIRO(wireMockServer);
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
-		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables2(variables);
 
-		Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
-		HomingSolution resourceARHoming = resourceAR.getHomingSolution();
-		Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
-		HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
-		Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
-		HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
-		Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
-		HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
-		Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
-		HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+        invokeSubProcess("Homing", businessKey, variables);
 
-		String resourceARHomingString = resourceARHoming.toString();
-		resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
-		String resourceARHoming2String = resourceARHoming2.toString();
-		resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
-		String resourceVNFHomingString = resourceVNFHoming.toString();
-		resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
-		String resourceNetHomingString = resourceNetHoming.toString();
-		resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
-		String resourceNetHoming2String = resourceNetHoming2.toString();
-		resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
-		expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+        injectWorkflowMessages(callbacks, "sniro2");
 
-		assertNull(workflowException);
-		assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
-		assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
-		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
-		assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
-		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
-		assertEquals(verifySniroRequest(), expectedSniroRequest);
-	}
+        waitForProcessEnd(businessKey, 10000);
 
-	@Test
-	 // 1802 merge
-	
-	public void testHoming_success_vnfResourceList() throws Exception {
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
 
-		// Create a Service Decomposition 
-		MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
-		String busKey = UUID.randomUUID().toString();
-		Map<String, Object> vars = new HashMap<>();
-		setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
-		invokeSubProcess("DecomposeService", busKey, vars);
+        Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+        HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+        Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+        HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+        Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+        HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+        Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+        HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+        Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+        HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
 
-		ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
-		List<VnfResource> vnfResourceList = sd.getVnfResources();
-		vnfResourceList.get(0).setResourceId("test-resource-id-000");
+        String resourceARHomingString = resourceARHoming.toString();
+        resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+        String resourceARHoming2String = resourceARHoming2.toString();
+        resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+        String resourceVNFHomingString = resourceVNFHoming.toString();
+        resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+        String resourceNetHomingString = resourceNetHoming.toString();
+        resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+        String resourceNetHoming2String = resourceNetHoming2.toString();
+        resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+        expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
 
-		// Invoke Homing
+        assertNull(workflowException);
+        assertEquals(
+                homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceARHomingString);
+        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+                "testAicClli2", "3.0", null, null), resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVNFHomingString);
+        assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic",
+                "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
+        assertEquals(
+                homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+                resourceNetHoming2String);
+        assertEquals(verifySniroRequest(), expectedSniroRequest);
+    }
 
-		mockSNIRO(wireMockServer);
+    @Test
+    // 1802 merge
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("homingService", "sniro");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceInstanceId", "testServiceInstanceId");
-		variables.put("serviceDecomposition", sd);
-		variables.put("subscriberInfo", subscriber2);
+    public void testHoming_success_vnfResourceList() throws Exception {
 
-		invokeSubProcess("Homing", businessKey, variables);
-		injectWorkflowMessages(callbacks, "sniro3");
-		waitForProcessEnd(businessKey, 10000);
+        // Create a Service Decomposition
+        MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+                "/BuildingBlocks/catalogResp.json");
+        String busKey = UUID.randomUUID().toString();
+        Map<String, Object> vars = new HashMap<>();
+        setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        invokeSubProcess("DecomposeService", busKey, vars);
 
-		//Get Variables
+        ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+        List<VnfResource> vnfResourceList = sd.getVnfResources();
+        vnfResourceList.get(0).setResourceId("test-resource-id-000");
 
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        // Invoke Homing
 
-		Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
-		HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+        mockSNIRO(wireMockServer);
 
-		String resourceVnfHomingString = resourceVnfHoming.toString();
-		resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("homingService", "sniro");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", sd);
+        variables.put("subscriberInfo", subscriber2);
 
-		assertNull(workflowException);
+        invokeSubProcess("Homing", businessKey, variables);
+        injectWorkflowMessages(callbacks, "sniro3");
+        waitForProcessEnd(businessKey, 10000);
+
+        // Get Variables
+
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+
+        Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+        HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+        String resourceVnfHomingString = resourceVnfHoming.toString();
+        resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+
+        assertNull(workflowException);
+
+        // Verify request
+        String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+        assertEquals(
+                FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "")
+                        .replaceAll("\r", "").replaceAll("\t", ""),
+                sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+        assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "CloudOwner", "mtmnj1a",
+                "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVnfHomingString);
+    }
+
+    @Test
+
+    public void testHoming_success_existingLicense() throws Exception {
+
+        mockSNIRO(wireMockServer);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<String, Object>();
+        setVariablesExistingLicense(variables);
 
-		//Verify request
-		String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
-		assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+        invokeSubProcess("Homing", businessKey, variables);
 
-		assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "CloudOwner", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
-	}
+        injectWorkflowMessages(callbacks, "sniro");
 
-	@Test
-	
-	public void testHoming_success_existingLicense() throws Exception {
+        waitForProcessEnd(businessKey, 10000);
 
-		mockSNIRO(wireMockServer);
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        ServiceDecomposition serviceDecompositionExp =
+                (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+        String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<String, Object>();
-		setVariablesExistingLicense(variables);
+        Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+        HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+        Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+        HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+        Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+        HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+        String resourceARHomingString = resourceARHoming.toString();
+        resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+        String resourceARHoming2String = resourceARHoming2.toString();
+        resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+        String resourceVNFHomingString = resourceVNFHoming.toString();
+        resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+        sniroRequest = sniroRequest.replaceAll("\\s+", "");
 
-		invokeSubProcess("Homing", businessKey, variables);
+        assertNull(workflowException);
+        assertEquals(
+                homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+                        "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceARHomingString);
+        assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+                "testAicClli2", "3.0", null, null), resourceARHoming2String);
+        assertEquals(
+                homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+                        "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+                        "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+                resourceVNFHomingString);
+        assertEquals(verifySniroRequest_existingLicense(), sniroRequest);
 
-		injectWorkflowMessages(callbacks, "sniro");
+    }
 
-		waitForProcessEnd(businessKey, 10000);
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
-		String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+    @Test
 
-		Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
-		HomingSolution resourceARHoming = resourceAR.getHomingSolution();
-		Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
-		HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
-		Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
-		HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
-		String resourceARHomingString = resourceARHoming.toString();
-		resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
-		String resourceARHoming2String = resourceARHoming2.toString();
-		resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
-		String resourceVNFHomingString = resourceVNFHoming.toString();
-		resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
-		sniroRequest = sniroRequest.replaceAll("\\s+", "");
+    public void testHoming_error_inputVariable() throws Exception {
 
-		assertNull(workflowException);
-		assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
-		assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
-		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
-		assertEquals(verifySniroRequest_existingLicense(), sniroRequest);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables3(variables);
 
-	}
+        invokeSubProcess("Homing", businessKey, variables);
 
+        waitForProcessEnd(businessKey, 10000);
 
-	@Test
-	
-	public void testHoming_error_inputVariable() throws Exception {
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables3(variables);
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]",
+                workflowException.toString());
+    }
 
-		invokeSubProcess("Homing", businessKey, variables);
+    @Test
 
-		waitForProcessEnd(businessKey, 10000);
+    public void testHoming_error_badResponse() throws Exception {
+        mockSNIRO_500(wireMockServer);
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
-	}
+        invokeSubProcess("Homing", businessKey, variables);
 
-	@Test
-	
-	public void testHoming_error_badResponse() throws Exception {
-		mockSNIRO_500(wireMockServer);
+        waitForProcessEnd(businessKey, 10000);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-		invokeSubProcess("Homing", businessKey, variables);
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]",
+                workflowException.toString());
+    }
 
-		waitForProcessEnd(businessKey, 10000);
+    @Test
+    // 1802 merge
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+    public void testHoming_error_sniroNoSolution() throws Exception {
+        mockSNIRO(wireMockServer);
 
-		assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString());
-	}
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-	@Test
-	 // 1802 merge
-	
-	public void testHoming_error_sniroNoSolution() throws Exception {
-		mockSNIRO(wireMockServer);
+        invokeSubProcess("Homing", businessKey, variables);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        injectWorkflowMessages(callbacks, "sniroNoSol");
 
-		invokeSubProcess("Homing", businessKey, variables);
+        waitForProcessEnd(businessKey, 10000);
 
-		injectWorkflowMessages(callbacks, "sniroNoSol");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-		waitForProcessEnd(businessKey, 10000);
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]",
+                workflowException.toString());
+    }
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+    @Test
 
-		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
-	}
+    public void testHoming_error_sniroPolicyException() throws Exception {
+        mockSNIRO(wireMockServer);
 
-	@Test
-	
-	public void testHoming_error_sniroPolicyException() throws Exception {
-		mockSNIRO(wireMockServer);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        invokeSubProcess("Homing", businessKey, variables);
 
-		invokeSubProcess("Homing", businessKey, variables);
+        injectWorkflowMessages(callbacks, "sniroPolicyEx");
 
-		injectWorkflowMessages(callbacks, "sniroPolicyEx");
+        waitForProcessEnd(businessKey, 10000);
 
-		waitForProcessEnd(businessKey, 10000);
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]",
+                workflowException.toString());
+    }
 
-		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
-	}
+    @Test
 
-	@Test
-	
-	public void testHoming_error_sniroServiceException() throws Exception {
-		mockSNIRO(wireMockServer);
+    public void testHoming_error_sniroServiceException() throws Exception {
+        mockSNIRO(wireMockServer);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariables(variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
 
-		invokeSubProcess("Homing", businessKey, variables);
+        invokeSubProcess("Homing", businessKey, variables);
 
-		injectWorkflowMessages(callbacks, "sniroServiceEx");
+        injectWorkflowMessages(callbacks, "sniroServiceEx");
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		//Get Variables
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        // Get Variables
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
 
-		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
-	}
+        assertEquals(
+                "WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+                workflowException.toString());
+    }
 
 
 
-	private void setVariables(Map<String, Object> variables) {
-		variables.put("homingService", "sniro");
-		variables.put("isDebugLogEnabled", "true");
-	//	variables.put("mso-request-id", "testRequestId");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceInstanceId", "testServiceInstanceId");
-		variables.put("serviceDecomposition", serviceDecomposition);
-		variables.put("subscriberInfo", subscriber2);
+    private void setVariables(Map<String, Object> variables) {
+        variables.put("homingService", "sniro");
+        variables.put("isDebugLogEnabled", "true");
+        // variables.put("mso-request-id", "testRequestId");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", serviceDecomposition);
+        variables.put("subscriberInfo", subscriber2);
 
-	}
+    }
 
-	private void setVariables2(Map<String, Object> variables) {
-		List<NetworkResource> netList = new ArrayList<NetworkResource>();
-		NetworkResource net = new NetworkResource();
-		net.setResourceId("testResourceIdNet");
-		ModelInfo netModel = new ModelInfo();
-		netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
-		netModel.setModelInvariantUuid("testModelInvariantIdNet");
-		netModel.setModelName("testModelNameNet");
-		netModel.setModelVersion("testModelVersionNet");
-		net.setModelInfo(netModel);
-		netList.add(net);
-		NetworkResource net2 = new NetworkResource();
-		net2.setResourceId("testResourceIdNet2");
-		ModelInfo netModel2 = new ModelInfo();
-		netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
-		netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
-		netModel2.setModelName("testModelNameNet2");
-		netModel2.setModelVersion("testModelVersionNet2");
-		net2.setModelInfo(netModel2);
-		netList.add(net2);
-		serviceDecomposition.setNetworkResources(netList);
+    private void setVariables2(Map<String, Object> variables) {
+        List<NetworkResource> netList = new ArrayList<NetworkResource>();
+        NetworkResource net = new NetworkResource();
+        net.setResourceId("testResourceIdNet");
+        ModelInfo netModel = new ModelInfo();
+        netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+        netModel.setModelInvariantUuid("testModelInvariantIdNet");
+        netModel.setModelName("testModelNameNet");
+        netModel.setModelVersion("testModelVersionNet");
+        net.setModelInfo(netModel);
+        netList.add(net);
+        NetworkResource net2 = new NetworkResource();
+        net2.setResourceId("testResourceIdNet2");
+        ModelInfo netModel2 = new ModelInfo();
+        netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+        netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+        netModel2.setModelName("testModelNameNet2");
+        netModel2.setModelVersion("testModelVersionNet2");
+        net2.setModelInfo(netModel2);
+        netList.add(net2);
+        serviceDecomposition.setNetworkResources(netList);
 
-		variables.put("homingService", "sniro");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceInstanceId", "testServiceInstanceId");
-		variables.put("serviceDecomposition", serviceDecomposition);
-		variables.put("subscriberInfo", subscriber2);
-	}
+        variables.put("homingService", "sniro");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", serviceDecomposition);
+        variables.put("subscriberInfo", subscriber2);
+    }
 
-	private void setVariables3(Map<String, Object> variables) {
-		variables.put("homingService", "sniro");
-		variables.put("isDebugLogEnabled", "true");
-	//	variables.put("mso-request-id", "testRequestId");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceInstanceId", "testServiceInstanceId");
-		variables.put("serviceDecomposition", null);
-		variables.put("subscriberInfo", subscriber2);
+    private void setVariables3(Map<String, Object> variables) {
+        variables.put("homingService", "sniro");
+        variables.put("isDebugLogEnabled", "true");
+        // variables.put("mso-request-id", "testRequestId");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", null);
+        variables.put("subscriberInfo", subscriber2);
 
-	}
+    }
 
-	private void setVariablesExistingLicense(Map<String, Object> variables) {
-		HomingSolution currentHomingSolution = new HomingSolution();
-		serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
-		serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
-		serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+    private void setVariablesExistingLicense(Map<String, Object> variables) {
+        HomingSolution currentHomingSolution = new HomingSolution();
+        serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addEntitlementPool("testEntitlementPoolId2");
 
-		serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
-		serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+                .addLicenseKeyGroup("testLicenseKeyGroupId2");
 
-		variables.put("isDebugLogEnabled", "true");
-	//	variables.put("mso-request-id", "testRequestId");
-		variables.put("msoRequestId", "testRequestId");
-		variables.put("serviceInstanceId", "testServiceInstanceId");
-		variables.put("serviceDecomposition", serviceDecomposition);
-		variables.put("subscriberInfo", subscriber2);
+        variables.put("isDebugLogEnabled", "true");
+        // variables.put("mso-request-id", "testRequestId");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", serviceDecomposition);
+        variables.put("subscriberInfo", subscriber2);
 
-	}
+    }
 
-	private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
-		String solution = "";
-		if(enList == null){
-			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
-		}else{
-			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " + licenseList +  " ] }, \"rehome\" : false } }";
-		}
-		return solution;
-	}
+    private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner,
+            String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+        String solution = "";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \""
+                    + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+                    + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+        } else {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+                    + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \""
+                    + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+                    + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ "
+                    + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+        }
+        return solution;
+    }
 
-	private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
-		String solution = "";
-		if(enList == null){
-			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
-		}else{
-			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " + licenseList +  " ] }, \"rehome\" : false } }";
-		}
-		return solution;
-	}
+    private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner,
+            String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+        String solution = "";
+        if (enList == null) {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+                    + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+        } else {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+                    + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+                    + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ "
+                    + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+        }
+        return solution;
+    }
 
-	private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
-		variables.put("homingService", "sniro");
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("mso-request-id", requestId);
-		variables.put("msoRequestId", requestId);
-		variables.put("serviceInstanceId",siId);
+    private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+        variables.put("homingService", "sniro");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", requestId);
+        variables.put("msoRequestId", requestId);
+        variables.put("serviceInstanceId", siId);
 
-		String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
-				"\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
-				"\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
-				"\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
-				"\"modelVersion\": \"5.0\"," +
-				"}";
-		variables.put("serviceModelInfo", serviceModelInfo);
-	}
+        String serviceModelInfo = "{ " + "\"modelType\": \"service\","
+                + "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\","
+                + "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\","
+                + "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," + "\"modelVersion\": \"5.0\"," + "}";
+        variables.put("serviceModelInfo", serviceModelInfo);
+    }
 
-	private String verifySniroRequest(){
-		String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
-		return request;
-	}
+    private String verifySniroRequest() {
+        String request =
+                "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+        return request;
+    }
 
-	private String verifySniroRequest_existingLicense(){
-		String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
-		return request;
-	}
+    private String verifySniroRequest_existingLicense() {
+        String request =
+                "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+        return request;
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
index 5015a13..fc991bd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -28,12 +28,10 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Ignore;
@@ -49,129 +47,134 @@
  */
 
 public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-	
-		
-	/**
-	 * Test the happy path through the flow.
-	 */
-	@Test	
-	
-	public void happyPath() throws IOException {
-		logStart();
-		
-		String updateAAIGenericVnfRequest =	FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); 
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		MockPutGenericVnf(wireMockServer, "/skask", 200);
-		MockPatchGenericVnf(wireMockServer, "skask");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
-		invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(200, responseCode.intValue());
-		
-		logEnd();
-	}
 
-	/**
-	 * Test the happy path through the flow.
-	 */
-	@Test	
-	
-	public void personaMismatch() throws IOException {
-		
-		logStart();
-		
-		String updateAAIGenericVnfRequest =	FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); 
-		updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
-		invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		logger.debug("Workflow Exception: {}", workflowException);
-		Assert.assertNotNull(workflowException);
-		
-		logEnd();
-	}
+    Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
 
-	/**
-	 * Test the case where the GET to AAI returns a 404.
-	 */
-	@Test	
-	
-	public void badGet() throws IOException {
-		
-		logStart();
-		
-		String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); 
-		
-		MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
-		invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		
-		logEnd();
-	}
 
-	/**
-	 * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
-	 */
-	@Test	
-	
-	public void badPatch() throws IOException {
-		
-		logStart();
-		
-		String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); 
-		
-		MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-		MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
-		MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
-		invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		
-		logEnd();
-	}
+    /**
+     * Test the happy path through the flow.
+     */
+    @Test
+
+    public void happyPath() throws IOException {
+        logStart();
+
+        String updateAAIGenericVnfRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+        MockPutGenericVnf(wireMockServer, "/skask", 200);
+        MockPatchGenericVnf(wireMockServer, "skask");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+        invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(200, responseCode.intValue());
+
+        logEnd();
+    }
+
+    /**
+     * Test the happy path through the flow.
+     */
+    @Test
+
+    public void personaMismatch() throws IOException {
+
+        logStart();
+
+        String updateAAIGenericVnfRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+        updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+        invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        WorkflowException workflowException =
+                (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        logger.debug("Workflow Exception: {}", workflowException);
+        Assert.assertNotNull(workflowException);
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI returns a 404.
+     */
+    @Test
+
+    public void badGet() throws IOException {
+
+        logStart();
+
+        String updateAAIGenericVnfRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+        MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+        invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+     */
+    @Test
+
+    public void badPatch() throws IOException {
+
+        logStart();
+
+        String updateAAIGenericVnfRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+        MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+        MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
+        MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+        invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+
+        logEnd();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
index 0a3931a..ebf8799 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -28,12 +28,10 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Ignore;
@@ -48,98 +46,105 @@
  */
 
 public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-	
-		
-	/**
-	 * Test the happy path through the flow.
-	 */
-	@Test	
-	
-	public void happyPath() throws IOException {
-		logStart();
-		
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); 
-		MockGetGenericVnfByIdWithPriority(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
-		MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
-		MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(200, responseCode.intValue());
-		
-		logEnd();
-	}
 
-	/**
-	 * Test the case where the GET to AAI returns a 404.
-	 */
-	@Test	
-	
-	public void badGet() throws IOException {
-		
-		logStart();
-		
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); 
-		MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		
-		logEnd();
-	}
+    Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
 
-	/**
-	 * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
-	 */
-	@Test	
-	
-	public void badPatch() throws IOException {
-		
-		logStart();
-		
-		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); 
-		MockGetGenericVnfById_404(wireMockServer, "/skask/vf-modules/vf-module/supercool");
-		MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
-		MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("isDebugLogEnabled","true");
-		variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
-		invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
-		Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
-		logger.debug("Subflow response code: {}", responseCode);
-		logger.debug("Subflow response: {}", response);
-		Assert.assertEquals(404, responseCode.intValue());
-		
-		logEnd();
-	}
+
+    /**
+     * Test the happy path through the flow.
+     */
+    @Test
+
+    public void happyPath() throws IOException {
+        logStart();
+
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+        MockGetGenericVnfByIdWithPriority(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200,
+                "VfModularity/VfModule-supercool.xml");
+        MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+        MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(200, responseCode.intValue());
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI returns a 404.
+     */
+    @Test
+
+    public void badGet() throws IOException {
+
+        logStart();
+
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+        MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml",
+                404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+
+        logEnd();
+    }
+
+    /**
+     * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+     */
+    @Test
+
+    public void badPatch() throws IOException {
+
+        logStart();
+
+        String updateAAIVfModuleRequest =
+                FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+        MockGetGenericVnfById_404(wireMockServer, "/skask/vf-modules/vf-module/supercool");
+        MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool",
+                "VfModularity/VfModule-supercool.xml", 200);
+        MockAAIVfModuleBadPatch(wireMockServer,
+                "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+        invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+        Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+        logger.debug("Subflow response code: {}", responseCode);
+        logger.debug("Subflow response: {}", response);
+        Assert.assertEquals(404, responseCode.intValue());
+
+        logEnd();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
index c0482a5..0cefdca 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -18,7 +18,7 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
@@ -29,12 +29,10 @@
 import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
 import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
 import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -48,347 +46,261 @@
  */
 
 public class VnfAdapterRestV1IT extends BaseIntegrationTest {
-	
-	Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
-	
 
-	private static final String EOL = "\n";
+    Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
 
-	private final CallbackSet callbacks = new CallbackSet();
 
-	private final String CREATE_VF_MODULE_REQUEST =
-		"<createVfModuleRequest>" + EOL +
-		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
-		"  <cloudOwner>cloudOwner</cloudOwner>" + EOL +
-		"  <tenantId>tenantId</tenantId>" + EOL +
-		"  <vnfId>vnfId</vnfId>" + EOL +
-		"  <vfModuleName>vfModuleName</vfModuleName>" + EOL +
-		"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-		"  <vnfType>vnfType</vnfType>" + EOL +
-		"  <vnfVersion>vnfVersion</vnfVersion>" + EOL +
-		"  <vfModuleType>vfModuleType</vfModuleType>" + EOL +
-		"  <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
-		"  <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
-		"  <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
-		"  <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
-		"  <skipAAI>true</skipAAI>" + EOL +
-		"  <backout>false</backout>" + EOL +
-		"  <failIfExists>true</failIfExists>" + EOL +
-		"  <vfModuleParams>" + EOL +
-		"    <entry>" + EOL +
-		"      <key>key1</key>" + EOL +
-		"      <value>value1</value>" + EOL +
-		"    </entry>" + EOL +
-		"    <entry>" + EOL +
-		"      <key>key2</key>" + EOL +
-		"      <value>value2</value>" + EOL +
-		"    </entry>" + EOL +
-		"  </vfModuleParams>" + EOL +
-		"  <msoRequest>" + EOL +
-		"    <requestId>requestId</requestId>" + EOL +
-		"    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
-		"  </msoRequest>" + EOL +
-		"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-		"  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
-		"</createVfModuleRequest>" + EOL;
+    private static final String EOL = "\n";
 
-	private final String UPDATE_VF_MODULE_REQUEST =
-		"<updateVfModuleRequest>" + EOL +
-		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
-		"  <cloudOwner>cloudOwner</cloudOwner>" + EOL +
-		"  <tenantId>tenantId</tenantId>" + EOL +
-		"  <vnfId>vnfId</vnfId>" + EOL +
-		"  <vfModuleName>vfModuleName</vfModuleName>" + EOL +
-		"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-		"  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-		"  <vnfType>vnfType</vnfType>" + EOL +
-		"  <vnfVersion>vnfVersion</vnfVersion>" + EOL +
-		"  <vfModuleType>vfModuleType</vfModuleType>" + EOL +
-		"  <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
-		"  <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
-		"  <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
-		"  <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
-		"  <skipAAI>true</skipAAI>" + EOL +
-		"  <backout>false</backout>" + EOL +
-		"  <failIfExists>true</failIfExists>" + EOL +
-		"  <vfModuleParams>" + EOL +
-		"    <entry>" + EOL +
-		"      <key>key1</key>" + EOL +
-		"      <value>value1</value>" + EOL +
-		"    </entry>" + EOL +
-		"    <entry>" + EOL +
-		"      <key>key2</key>" + EOL +
-		"      <value>value2</value>" + EOL +
-		"    </entry>" + EOL +
-		"  </vfModuleParams>" + EOL +
-		"  <msoRequest>" + EOL +
-		"    <requestId>requestId</requestId>" + EOL +
-		"    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
-		"  </msoRequest>" + EOL +
-		"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-		"  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
-		"</updateVfModuleRequest>" + EOL;
+    private final CallbackSet callbacks = new CallbackSet();
 
-	private final String DELETE_VF_MODULE_REQUEST =
-		"<deleteVfModuleRequest>" + EOL +
-		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
-		"  <cloudOwner>cloudOwner</cloudOwner>" + EOL +
-		"  <tenantId>tenantId</tenantId>" + EOL +
-		"  <vnfId>vnfId</vnfId>" + EOL +
-		"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-		"  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-		"  <skipAAI>true</skipAAI>" + EOL +
-		"  <msoRequest>" + EOL +
-		"    <requestId>requestId</requestId>" + EOL +
-		"    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
-		"  </msoRequest>" + EOL +
-		"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-		"  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
-		"</deleteVfModuleRequest>" + EOL;
+    private final String CREATE_VF_MODULE_REQUEST = "<createVfModuleRequest>" + EOL
+            + "  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + "  <cloudOwner>cloudOwner</cloudOwner>" + EOL
+            + "  <tenantId>tenantId</tenantId>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+            + "  <vfModuleName>vfModuleName</vfModuleName>" + EOL + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL
+            + "  <vnfType>vnfType</vnfType>" + EOL + "  <vnfVersion>vnfVersion</vnfVersion>" + EOL
+            + "  <vfModuleType>vfModuleType</vfModuleType>" + EOL + "  <volumeGroupId>volumeGroupId</volumeGroupId>"
+            + EOL + "  <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+            + "  <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+            + "  <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + "  <skipAAI>true</skipAAI>"
+            + EOL + "  <backout>false</backout>" + EOL + "  <failIfExists>true</failIfExists>" + EOL
+            + "  <vfModuleParams>" + EOL + "    <entry>" + EOL + "      <key>key1</key>" + EOL
+            + "      <value>value1</value>" + EOL + "    </entry>" + EOL + "    <entry>" + EOL + "      <key>key2</key>"
+            + EOL + "      <value>value2</value>" + EOL + "    </entry>" + EOL + "  </vfModuleParams>" + EOL
+            + "  <msoRequest>" + EOL + "    <requestId>requestId</requestId>" + EOL
+            + "    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + "  </msoRequest>" + EOL
+            + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+            + "  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+            + "</createVfModuleRequest>" + EOL;
 
-	private final String ROLLBACK_VF_MODULE_REQUEST =
-			"<rollbackVfModuleRequest>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
-			"  <skipAAI>true</skipAAI>" + EOL +
-			"  <vfModuleRollback>" + EOL +
-			"    <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
-		    "    <cloudOwner>cloudOwner</cloudOwner>" + EOL +
-			"    <tenantId>tenantId</tenantId>" + EOL +
-			"    <vnfId>vnfId</vnfId>" + EOL +
-			"    <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-			"    <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-			"    <msoRequest>" + EOL +
-			"      <requestId>requestId</requestId>" + EOL +
-			"      <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
-			"    </msoRequest>" + EOL +
-			"    <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"    <vfModuleCreated>true</vfModuleCreated>" + EOL +
-			"  </vfModuleRollback>" + EOL +
-			"</rollbackVfModuleRequest>" + EOL;
+    private final String UPDATE_VF_MODULE_REQUEST = "<updateVfModuleRequest>" + EOL
+            + "  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + "  <cloudOwner>cloudOwner</cloudOwner>" + EOL
+            + "  <tenantId>tenantId</tenantId>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+            + "  <vfModuleName>vfModuleName</vfModuleName>" + EOL + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL
+            + "  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + "  <vnfType>vnfType</vnfType>" + EOL
+            + "  <vnfVersion>vnfVersion</vnfVersion>" + EOL + "  <vfModuleType>vfModuleType</vfModuleType>" + EOL
+            + "  <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL
+            + "  <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+            + "  <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+            + "  <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + "  <skipAAI>true</skipAAI>"
+            + EOL + "  <backout>false</backout>" + EOL + "  <failIfExists>true</failIfExists>" + EOL
+            + "  <vfModuleParams>" + EOL + "    <entry>" + EOL + "      <key>key1</key>" + EOL
+            + "      <value>value1</value>" + EOL + "    </entry>" + EOL + "    <entry>" + EOL + "      <key>key2</key>"
+            + EOL + "      <value>value2</value>" + EOL + "    </entry>" + EOL + "  </vfModuleParams>" + EOL
+            + "  <msoRequest>" + EOL + "    <requestId>requestId</requestId>" + EOL
+            + "    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + "  </msoRequest>" + EOL
+            + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+            + "  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+            + "</updateVfModuleRequest>" + EOL;
 
-	public VnfAdapterRestV1IT() throws IOException {
-		callbacks.put("createVfModule",
-			"<createVfModuleResponse>" + EOL +
-			"  <vnfId>vnfId</vnfId>" + EOL +
-			"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-			"  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-			"  <vfModuleCreated>true</vfModuleCreated>" + EOL +
-			"  <vfModuleOutputs>" + EOL +
-			"    <entry>" + EOL +
-			"      <key>key1</key>" + EOL +
-			"      <value>value1</value>" + EOL +
-			"    </entry>" + EOL +
-			"    <entry>" + EOL +
-			"      <key>key2</key>" + EOL +
-			"      <value>value2</value>" + EOL +
-			"    </entry>" + EOL +
-			"  </vfModuleOutputs>" + EOL +
-			"  <rollback>" + EOL +
-			"    <vnfId>vnfId</vnfId>" + EOL +
-			"    <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-			"    <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-			"    <vfModuleCreated>true</vfModuleCreated>" + EOL +
-			"    <tenantId>tenantId</tenantId>" + EOL +
-		    "    <cloudOwner>cloudOwner</cloudOwner>" + EOL +
-			"    <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
-			"    <msoRequest>" + EOL +
-			"      <requestId>requestId</requestId>" + EOL +
-			"      <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
-			"    </msoRequest>" + EOL +
-			"    <messageId>messageId</messageId>" + EOL +
-			"  </rollback>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"</createVfModuleResponse>" + EOL);
+    private final String DELETE_VF_MODULE_REQUEST = "<deleteVfModuleRequest>" + EOL
+            + "  <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + "  <cloudOwner>cloudOwner</cloudOwner>" + EOL
+            + "  <tenantId>tenantId</tenantId>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+            + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL + "  <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+            + EOL + "  <skipAAI>true</skipAAI>" + EOL + "  <msoRequest>" + EOL + "    <requestId>requestId</requestId>"
+            + EOL + "    <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + "  </msoRequest>" + EOL
+            + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+            + "  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+            + "</deleteVfModuleRequest>" + EOL;
 
-		callbacks.put("updateVfModule",
-			"<updateVfModuleResponse>" + EOL +
-			"  <vnfId>vnfId</vnfId>" + EOL +
-			"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-			"  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
-			"  <vfModuleOutputs>" + EOL +
-			"    <entry>" + EOL +
-			"      <key>key1</key>" + EOL +
-			"      <value>value1</value>" + EOL +
-			"    </entry>" + EOL +
-			"    <entry>" + EOL +
-			"      <key>key2</key>" + EOL +
-			"      <value>value2</value>" + EOL +
-			"    </entry>" + EOL +
-			"  </vfModuleOutputs>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"</updateVfModuleResponse>" + EOL);
+    private final String ROLLBACK_VF_MODULE_REQUEST = "<rollbackVfModuleRequest>" + EOL
+            + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+            + "  <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+            + "  <skipAAI>true</skipAAI>" + EOL + "  <vfModuleRollback>" + EOL
+            + "    <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + "    <cloudOwner>cloudOwner</cloudOwner>" + EOL
+            + "    <tenantId>tenantId</tenantId>" + EOL + "    <vnfId>vnfId</vnfId>" + EOL
+            + "    <vfModuleId>vfModuleId</vfModuleId>" + EOL + "    <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+            + EOL + "    <msoRequest>" + EOL + "      <requestId>requestId</requestId>" + EOL
+            + "      <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + "    </msoRequest>" + EOL
+            + "    <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "    <vfModuleCreated>true</vfModuleCreated>" + EOL
+            + "  </vfModuleRollback>" + EOL + "</rollbackVfModuleRequest>" + EOL;
 
-		callbacks.put("deleteVfModule",
-			"<deleteVfModuleResponse>" + EOL +
-			"  <vnfId>vnfId</vnfId>" + EOL +
-			"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
-			"  <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"</deleteVfModuleResponse>" + EOL);
+    public VnfAdapterRestV1IT() throws IOException {
+        callbacks.put("createVfModule", "<createVfModuleResponse>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+                + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL + "  <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+                + EOL + "  <vfModuleCreated>true</vfModuleCreated>" + EOL + "  <vfModuleOutputs>" + EOL + "    <entry>"
+                + EOL + "      <key>key1</key>" + EOL + "      <value>value1</value>" + EOL + "    </entry>" + EOL
+                + "    <entry>" + EOL + "      <key>key2</key>" + EOL + "      <value>value2</value>" + EOL
+                + "    </entry>" + EOL + "  </vfModuleOutputs>" + EOL + "  <rollback>" + EOL
+                + "    <vnfId>vnfId</vnfId>" + EOL + "    <vfModuleId>vfModuleId</vfModuleId>" + EOL
+                + "    <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL
+                + "    <vfModuleCreated>true</vfModuleCreated>" + EOL + "    <tenantId>tenantId</tenantId>" + EOL
+                + "    <cloudOwner>cloudOwner</cloudOwner>" + EOL + "    <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL
+                + "    <msoRequest>" + EOL + "      <requestId>requestId</requestId>" + EOL
+                + "      <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + "    </msoRequest>" + EOL
+                + "    <messageId>messageId</messageId>" + EOL + "  </rollback>" + EOL
+                + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</createVfModuleResponse>" + EOL);
 
-		callbacks.put("rollbackVfModule",
-			"<rollbackVfModuleResponse>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"  <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
-			"</rollbackVfModuleResponse>" + EOL);
+        callbacks.put("updateVfModule",
+                "<updateVfModuleResponse>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+                        + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL
+                        + "  <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + "  <vfModuleOutputs>" + EOL
+                        + "    <entry>" + EOL + "      <key>key1</key>" + EOL + "      <value>value1</value>" + EOL
+                        + "    </entry>" + EOL + "    <entry>" + EOL + "      <key>key2</key>" + EOL
+                        + "      <value>value2</value>" + EOL + "    </entry>" + EOL + "  </vfModuleOutputs>" + EOL
+                        + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</updateVfModuleResponse>" + EOL);
 
-		callbacks.put("vfModuleException",
-			"<vfModuleException>" + EOL +
-			"  <message>message</message>" + EOL +
-			"  <category>category</category>" + EOL +
-			"  <rolledBack>false</rolledBack>" + EOL +
-			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
-			"</vfModuleException>" + EOL);
-	}
+        callbacks.put("deleteVfModule",
+                "<deleteVfModuleResponse>" + EOL + "  <vnfId>vnfId</vnfId>" + EOL
+                        + "  <vfModuleId>vfModuleId</vfModuleId>" + EOL + "  <vfModuleDeleted>true</vfModuleDeleted>"
+                        + EOL + "  <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</deleteVfModuleResponse>" + EOL);
 
-	@Test
-	
-	public void testCreateVfModuleSuccess() throws Exception {
-		logStart();
+        callbacks.put("rollbackVfModule", "<rollbackVfModuleResponse>" + EOL + "  <messageId>{{MESSAGE-ID}}</messageId>"
+                + EOL + "  <vfModuleRolledback>true</vfModuleRolledback>" + EOL + "</rollbackVfModuleResponse>" + EOL);
 
-		mockVNFPost(wireMockServer, "", 202, "vnfId");
+        callbacks.put("vfModuleException",
+                "<vfModuleException>" + EOL + "  <message>message</message>" + EOL + "  <category>category</category>"
+                        + EOL + "  <rolledBack>false</rolledBack>" + EOL + "  <messageId>{{MESSAGE-ID}}</messageId>"
+                        + EOL + "</vfModuleException>" + EOL);
+    }
 
-		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
-		String messageId = requestId + "-" + System.currentTimeMillis();
-		String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+    @Test
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", requestId);
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("vnfAdapterRestV1Request", request);
+    public void testCreateVfModuleSuccess() throws Exception {
+        logStart();
 
-		invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
-		injectVNFRestCallbacks(callbacks, "createVfModule");
-		waitForProcessEnd(businessKey, 10000);
+        mockVNFPost(wireMockServer, "", 202, "vnfId");
 
-		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
-		logger.debug("Response:\n{}", response);
-		assertTrue(response!=null && response.contains("<createVfModuleResponse>"));
-		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+        String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+        String messageId = requestId + "-" + System.currentTimeMillis();
+        String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
 
-		logEnd();
-	}
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", requestId);
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfAdapterRestV1Request", request);
 
-	@Test
-	
-	public void testUpdateVfModuleSuccess() throws Exception {
-		logStart();
+        invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+        injectVNFRestCallbacks(callbacks, "createVfModule");
+        waitForProcessEnd(businessKey, 10000);
 
-		mockVNFPut(wireMockServer, "/vfModuleId", 202);
+        String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+        logger.debug("Response:\n{}", response);
+        assertTrue(response != null && response.contains("<createVfModuleResponse>"));
+        assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
 
-		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
-		String messageId = requestId + "-" + System.currentTimeMillis();
-		String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+        logEnd();
+    }
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", requestId);
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("vnfAdapterRestV1Request", request);
+    @Test
 
-		invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
-		injectVNFRestCallbacks(callbacks, "updateVfModule");
-		waitForProcessEnd(businessKey, 10000);
+    public void testUpdateVfModuleSuccess() throws Exception {
+        logStart();
 
-		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
-		logger.debug("Response:\n{}", response);
-		assertTrue(response.contains("<updateVfModuleResponse>"));
-		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+        mockVNFPut(wireMockServer, "/vfModuleId", 202);
 
-		logEnd();
-	}
+        String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+        String messageId = requestId + "-" + System.currentTimeMillis();
+        String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
 
-	@Test
-	
-	public void testDeleteVfModuleSuccess() throws Exception {
-		logStart();
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", requestId);
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfAdapterRestV1Request", request);
 
-		mockVNFDelete(wireMockServer, "vnfId", "/vfModuleId", 202);
+        invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+        injectVNFRestCallbacks(callbacks, "updateVfModule");
+        waitForProcessEnd(businessKey, 10000);
 
-		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
-		String messageId = requestId + "-" + System.currentTimeMillis();
-		String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+        String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+        logger.debug("Response:\n{}", response);
+        assertTrue(response.contains("<updateVfModuleResponse>"));
+        assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", requestId);
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("vnfAdapterRestV1Request", request);
+        logEnd();
+    }
 
-		invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
-		injectVNFRestCallbacks(callbacks, "deleteVfModule");
-		waitForProcessEnd(businessKey, 10000);
+    @Test
 
-		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
-		logger.debug("Response:\n{}", response);
-		assertTrue(response.contains("<deleteVfModuleResponse>"));
-		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+    public void testDeleteVfModuleSuccess() throws Exception {
+        logStart();
 
-		logEnd();
-	}
+        mockVNFDelete(wireMockServer, "vnfId", "/vfModuleId", 202);
 
-	@Test
-	
-	public void testRollbackVfModuleSuccess() throws Exception {
-		logStart();
+        String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+        String messageId = requestId + "-" + System.currentTimeMillis();
+        String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
 
-		mockVNFRollbackDelete(wireMockServer, "/vfModuleId", 202);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", requestId);
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfAdapterRestV1Request", request);
 
-		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
-		String messageId = requestId + "-" + System.currentTimeMillis();
-		String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+        invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+        injectVNFRestCallbacks(callbacks, "deleteVfModule");
+        waitForProcessEnd(businessKey, 10000);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", requestId);
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("vnfAdapterRestV1Request", request);
+        String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+        logger.debug("Response:\n{}", response);
+        assertTrue(response.contains("<deleteVfModuleResponse>"));
+        assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
 
-		invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
-		injectVNFRestCallbacks(callbacks, "rollbackVfModule");
-		waitForProcessEnd(businessKey, 10000);
+        logEnd();
+    }
 
-		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
-		logger.debug("Response:\n{}", response);
-		assertTrue(response.contains("<rollbackVfModuleResponse>"));
-		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+    @Test
 
-		logEnd();
-	}
+    public void testRollbackVfModuleSuccess() throws Exception {
+        logStart();
 
-	@Test
-	
-	public void testCreateVfModuleException() throws Exception {
-		logStart();
+        mockVNFRollbackDelete(wireMockServer, "/vfModuleId", 202);
 
-		mockVNFPost(wireMockServer, "", 202, "vnfId");
+        String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+        String messageId = requestId + "-" + System.currentTimeMillis();
+        String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
 
-		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
-		String messageId = requestId + "-" + System.currentTimeMillis();
-		String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", requestId);
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfAdapterRestV1Request", request);
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("mso-request-id", requestId);
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("vnfAdapterRestV1Request", request);
+        invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+        injectVNFRestCallbacks(callbacks, "rollbackVfModule");
+        waitForProcessEnd(businessKey, 10000);
 
-		invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
-		injectVNFRestCallbacks(callbacks, "vfModuleException");
-		waitForProcessEnd(businessKey, 10000);
+        String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+        logger.debug("Response:\n{}", response);
+        assertTrue(response.contains("<rollbackVfModuleResponse>"));
+        assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
 
-		WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-		assertNotNull(wfe);
-		logger.debug(wfe.toString());
+        logEnd();
+    }
 
-		String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
-		logger.debug("Response:\n{}", response);
-		assertTrue(response.contains("<vfModuleException>"));
-		assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+    @Test
 
-		logEnd();
-	}
+    public void testCreateVfModuleException() throws Exception {
+        logStart();
+
+        mockVNFPost(wireMockServer, "", 202, "vnfId");
+
+        String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+        String messageId = requestId + "-" + System.currentTimeMillis();
+        String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("mso-request-id", requestId);
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("vnfAdapterRestV1Request", request);
+
+        invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+        injectVNFRestCallbacks(callbacks, "vfModuleException");
+        waitForProcessEnd(businessKey, 10000);
+
+        WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+        assertNotNull(wfe);
+        logger.debug(wfe.toString());
+
+        String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+        logger.debug("Response:\n{}", response);
+        assertTrue(response.contains("<vfModuleException>"));
+        assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+        logEnd();
+    }
 }
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
index a746bbb..cc2d6ab 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
@@ -16,16 +16,14 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 import static org.junit.Assert.assertEquals;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
 import org.junit.Ignore;
@@ -36,49 +34,53 @@
 @Ignore
 public class WorkflowAsyncResourceTest extends WorkflowTest {
 
-	@Test
-	@Deployment(resources = { "testAsyncResource.bpmn" })
-	public void asyncRequestSuccess() throws InterruptedException {
-		//it can be any request which asynchronously processed by the workflow
-		String request = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\">  <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\">    <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type>    <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id>    <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
+    @Test
+    @Deployment(resources = {"testAsyncResource.bpmn"})
+    public void asyncRequestSuccess() throws InterruptedException {
+        // it can be any request which asynchronously processed by the workflow
+        String request =
+                "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\">  <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\">    <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type>    <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id>    <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
 
-		Map<String,String> variables = new HashMap<>();
-		variables.put("testAsyncRequestMsg", request);
-		variables.put("mso-request-id", UUID.randomUUID().toString());
-		variables.put("mso-service-request-timeout", "5");
-		
-		WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
-		assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\">  <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\">    <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type>    <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id>    <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse());
-		assertEquals(200, workflowResponse.getMessageCode());
-	}
+        Map<String, String> variables = new HashMap<>();
+        variables.put("testAsyncRequestMsg", request);
+        variables.put("mso-request-id", UUID.randomUUID().toString());
+        variables.put("mso-service-request-timeout", "5");
 
-	private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
-		WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
-		VariableMapImpl variableMap = new VariableMapImpl();
+        WorkflowResponse workflowResponse =
+                BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
+        assertEquals(
+                "Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\">  <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\">    <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type>    <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id>    <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>",
+                workflowResponse.getResponse());
+        assertEquals(200, workflowResponse.getMessageCode());
+    }
 
-		Map<String, Object> variableValueType = new HashMap<>();
+    private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
+        WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+        VariableMapImpl variableMap = new VariableMapImpl();
 
-		Map<String, Object> requestMsg = new HashMap<>();
-		requestMsg.put("value", request);
-		requestMsg.put("type", "String");
+        Map<String, Object> variableValueType = new HashMap<>();
 
-		Map<String, Object> msorequestId = new HashMap<>();
-		msorequestId.put("type", "String");
-		msorequestId.put("value",requestId);
+        Map<String, Object> requestMsg = new HashMap<>();
+        requestMsg.put("value", request);
+        requestMsg.put("type", "String");
 
-		Map<String, Object> timeout = new HashMap<>();
-		timeout.put("type", "String");
-		timeout.put("value","5"); 
+        Map<String, Object> msorequestId = new HashMap<>();
+        msorequestId.put("type", "String");
+        msorequestId.put("value", requestId);
 
-		variableValueType.put("testAsyncRequestMsg", requestMsg);
-		variableValueType.put("mso-request-id", msorequestId);
-		variableValueType.put("mso-service-request-timeout", timeout);
+        Map<String, Object> timeout = new HashMap<>();
+        timeout.put("type", "String");
+        timeout.put("value", "5");
 
-		variableMap.put("variables", variableValueType);
-		
-		workflowResource.setProcessEngineServices4junit(processEngineRule);
-		workflowResource.startProcessInstanceByKey( processKey, variableMap);
-	}
+        variableValueType.put("testAsyncRequestMsg", requestMsg);
+        variableValueType.put("mso-request-id", msorequestId);
+        variableValueType.put("mso-service-request-timeout", timeout);
 
-	
+        variableMap.put("variables", variableValueType);
+
+        workflowResource.setProcessEngineServices4junit(processEngineRule);
+        workflowResource.startProcessInstanceByKey(processKey, variableMap);
+    }
+
+
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
index 0efecac..23f9818 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
@@ -16,14 +16,13 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common;
 
 
 
 import java.util.UUID;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
@@ -35,35 +34,35 @@
 public class WorkflowContextHolderTest {
 
 
-	@Test
-	public void testProcessCallback() throws Exception {
-		String requestId = UUID.randomUUID().toString();		
-		String message = "TEST MESSATGE";
-		String responseMessage = "Successfully processed request";
-		int testCode = 200;		
-		
-		
-		WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
-		 
-		WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
-		callbackResponse.setMessage(message);
-		callbackResponse.setResponse(responseMessage);
-		callbackResponse.setStatusCode(testCode);
-		
-		contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse);
-		
-		//same object returned
-		WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
-		if(contextFound == null)
-			throw new Exception("Expected to find Context Object");
-		
-		WorkflowResponse testResponse = contextFound.getWorkflowResponse();
-		Assert.assertEquals(200,testResponse.getMessageCode());
-		Assert.assertEquals(message, testResponse.getMessage());
-		Assert.assertEquals(responseMessage, testResponse.getResponse());
-		
-		
+    @Test
+    public void testProcessCallback() throws Exception {
+        String requestId = UUID.randomUUID().toString();
+        String message = "TEST MESSATGE";
+        String responseMessage = "Successfully processed request";
+        int testCode = 200;
 
-	}
+
+        WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+        WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+        callbackResponse.setMessage(message);
+        callbackResponse.setResponse(responseMessage);
+        callbackResponse.setStatusCode(testCode);
+
+        contextHolder.processCallback("testAsyncProcess", "process-instance-id", requestId, callbackResponse);
+
+        // same object returned
+        WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
+        if (contextFound == null)
+            throw new Exception("Expected to find Context Object");
+
+        WorkflowResponse testResponse = contextFound.getWorkflowResponse();
+        Assert.assertEquals(200, testResponse.getMessageCode());
+        Assert.assertEquals(message, testResponse.getMessage());
+        Assert.assertEquals(responseMessage, testResponse.getResponse());
+
+
+
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index eed2978..389f931 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -26,7 +26,6 @@
 import static org.junit.Assert.fail;
 import static org.onap.so.bpmn.core.json.JsonUtils.getJsonValue;
 import static org.onap.so.bpmn.core.json.JsonUtils.updJsonValue;
-
 import java.io.IOException;
 import java.io.StringReader;
 import java.lang.management.ManagementFactory;
@@ -37,7 +36,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import javax.ws.rs.core.Response;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.NamespaceContext;
@@ -50,7 +48,6 @@
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-
 import org.camunda.bpm.engine.HistoryService;
 import org.camunda.bpm.engine.ProcessEngine;
 import org.camunda.bpm.engine.ProcessEngineException;
@@ -98,2158 +95,2108 @@
 /**
  * A base class for Workflow tests.
  * <p>
- * WireMock response transformers may be specified by declaring public
- * static fields with the @WorkflowTestTransformer annotation. For example:
+ * WireMock response transformers may be specified by declaring public static fields with the @WorkflowTestTransformer
+ * annotation. For example:
+ * 
  * <pre>
- *     @WorkflowTestTransformer
- *     public static final ResponseTransformer sdncAdapterMockTransformer =
- *         new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
  * </pre>
  */
 
 public abstract class WorkflowTest {
 
-	private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class);
+    private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class);
 
-	//TODO this is not used anymore, can maybe be removed
-	@Rule
-	public ProcessEngineRule processEngineRule;
+    // TODO this is not used anymore, can maybe be removed
+    @Rule
+    public ProcessEngineRule processEngineRule;
 
-	@Autowired
-	protected WorkflowResource workflowResourceSync;
+    @Autowired
+    protected WorkflowResource workflowResourceSync;
 
-	@Autowired
-	protected ProcessEngine processEngine;
+    @Autowired
+    protected ProcessEngine processEngine;
 
-	@Autowired
-	protected RuntimeService runtimeService;
+    @Autowired
+    protected RuntimeService runtimeService;
 
-	@Autowired
-	protected HistoryService historyService;
+    @Autowired
+    protected HistoryService historyService;
 
-	@Autowired
-	private WorkflowAsyncResource workflowResource;
+    @Autowired
+    private WorkflowAsyncResource workflowResource;
 
-	@Autowired
-	private WorkflowMessageResource workflowMessageResource;
+    @Autowired
+    private WorkflowMessageResource workflowMessageResource;
 
-	@Autowired
-	SDNCAdapterCallbackServiceImpl callbackService;
-	/**
-	 * Content-Type for XML.
-	 */
-	protected static final String XML = "application/xml";
+    @Autowired
+    SDNCAdapterCallbackServiceImpl callbackService;
+    /**
+     * Content-Type for XML.
+     */
+    protected static final String XML = "application/xml";
 
-	/**
-	 * Content-Type for JSON.
-	 */
-	protected static final String JSON = "application/json; charset=UTF-8";
+    /**
+     * Content-Type for JSON.
+     */
+    protected static final String JSON = "application/json; charset=UTF-8";
 
-	private static final int timeout = 2000;
-	
-	/**
-	 * Constructor.
-	 */
-	public WorkflowTest() throws RuntimeException {
-	}
+    private static final int timeout = 2000;
 
-	/**
-	 * The current request ID.  Normally set when an "invoke" method is called.
-	 */
-	protected volatile String msoRequestId = null;
+    /**
+     * Constructor.
+     */
+    public WorkflowTest() throws RuntimeException {}
 
-	/**
-	 * The current service instance ID.  Normally set when an "invoke" method
-	 * is called.
-	 */
-	protected volatile String msoServiceInstanceId = null;
+    /**
+     * The current request ID. Normally set when an "invoke" method is called.
+     */
+    protected volatile String msoRequestId = null;
 
-	/**
-	 * Logs a test start method.
-	 */
-	protected void logStart() {
-		logger.debug("STARTED TEST");
-	}
+    /**
+     * The current service instance ID. Normally set when an "invoke" method is called.
+     */
+    protected volatile String msoServiceInstanceId = null;
 
-	/**
-	 * Logs a test end method.
-	 */
-	protected void logEnd() {
-		logger.debug("ENDED TEST");
-	}
-
-	/**
-	 * Invokes a subprocess.
-	 * @param processKey the process key
-	 * @param businessKey a unique key that will identify the process instance
-	 * @param injectedVariables variables to inject into the process
-	 */
-	protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
-		RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
-		List<String> arguments = runtimeMxBean.getInputArguments();
-		logger.debug("JVM args = {}", arguments);
-
-		msoRequestId = (String) injectedVariables.get("mso-request-id");
-		String requestId = (String) injectedVariables.get("msoRequestId");
-
-		if (msoRequestId == null && requestId == null) {
-			String msg = "mso-request-id variable was not provided";
-			logger.debug(msg);
-			fail(msg);
-		}
-
-		// Note: some scenarios don't have a service-instance-id, may be null
-		msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
-
-
-		runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
-	}
-
-	protected String invokeSubProcess(String processKey,  Map<String, Object> injectedVariables) {
-		RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
-		List<String> arguments = runtimeMxBean.getInputArguments();
-		logger.debug("JVM args = {}", arguments);
-
-		msoRequestId = (String) injectedVariables.get("mso-request-id");
-		String requestId = (String) injectedVariables.get("msoRequestId");
-
-		if (msoRequestId == null && requestId == null) {
-			String msg = "mso-request-id variable was not provided";
-			logger.debug(msg);
-			fail(msg);
-		}
-
-		// Note: some scenarios don't have a service-instance-id, may be null
-		msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
-
-
-		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables);
-		return processInstance.getId();
-	}
-
-	/**
-	 * Invokes an asynchronous process.
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param processKey the process key
-	 * @param schemaVersion the API schema version, e.g. "v1"
-	 * @param businessKey a unique key that will identify the process instance
-	 * @param request the request
-	 * @return a TestAsyncResponse object associated with the test
-	 * @throws InterruptedException
-	 */
-	protected TestAsyncResponse invokeAsyncProcess(String processKey,
-			String schemaVersion, String businessKey, String request) throws InterruptedException {
-		return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
-	}
-
-	/**
-	 * Invokes an asynchronous process.
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param processKey the process key
-	 * @param schemaVersion the API schema version, e.g. "v1"
-	 * @param businessKey a unique key that will identify the process instance
-	 * @param request the request
-	 * @param injectedVariables optional variables to inject into the process
-	 * @return a TestAsyncResponse object associated with the test
-	 * @throws InterruptedException
-	 */
-	protected TestAsyncResponse invokeAsyncProcess(String processKey,
-			String schemaVersion, String businessKey, String request,
-			Map<String, Object> injectedVariables) {
-
-		RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
-		List<String> arguments = runtimeMxBean.getInputArguments();
-		logger.debug("JVM args = {}", arguments);
-
-		Map<String, Object> variables = createVariables(schemaVersion, businessKey,
-			request, injectedVariables, false);
-		VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
-		logger.debug("Sending {} to {} process", request, processKey);
-
-		TestAsyncResponse asyncResponse = new TestAsyncResponse();
-
-		asyncResponse.setResponse(workflowResource.startProcessInstanceByKey( processKey, variableMapImpl));
-
-		return asyncResponse;
-	}
-
-	/**
-	 * Invokes an asynchronous process.
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param processKey the process key
-	 * @param schemaVersion the API schema version, e.g. "v1"
-	 * @param businessKey a unique key that will identify the process instance
-	 * @param request the request
-	 * @param injectedVariables optional variables to inject into the process
-	 * @param serviceInstantiationModel indicates whether this method is being
-	 * invoked for a flow that is designed using the service instantiation model
-	 * @return a TestAsyncResponse object associated with the test
-	 * @throws InterruptedException
-	 */
-	protected Response invokeAsyncProcess(String processKey,
-			String schemaVersion, String businessKey, String request,
-			Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
-
-		RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
-		List<String> arguments = runtimeMxBean.getInputArguments();
-		logger.debug("JVM args = {}", arguments);
-
-		Map<String, Object> variables = createVariables(schemaVersion, businessKey,
-			request, injectedVariables, serviceInstantiationModel);
-		VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
-		logger.debug("Sending {} to {} process", request, processKey);
-
-		return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl);
-
-	}
-
-	/**
-	 * Private helper method that creates a variable map for a request.
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param schemaVersion the API schema version, e.g. "v1"
-	 * @param businessKey a unique key that will identify the process instance
-	 * @param request the request
-	 * @param injectedVariables optional variables to inject into the process
-	 * @param serviceInstantiationModel indicates whether this method is being
-	 * invoked for a flow that is designed using the service instantiation model
-	 * @return a variable map
-	 */
-	private Map<String, Object> createVariables(String schemaVersion,
-			String businessKey, String request, Map<String, Object> injectedVariables,
-			boolean serviceInstantiationModel) {
-
-		Map<String, Object> variables = new HashMap<>();
-
-		// These variables may be overridded by injected variables.
-		variables.put("mso-service-request-timeout", "180");
-		variables.put("isDebugLogEnabled", "true");
-
-		// These variables may not be overridded by injected variables.
-		String[] notAllowed = new String[] {
-				"mso-schema-version",
-				"mso-business-key",
-				"bpmnRequest",
-				"mso-request-id",
-				"mso-service-instance-id"
-		};
-
-		if (injectedVariables != null) {
-			for (String key : injectedVariables.keySet()) {
-				for (String var : notAllowed) {
-					if (var.equals(key)) {
-						String msg = "Cannot specify " + var + " in injected variables";
-						logger.debug(msg);
-						fail(msg);
-					}
-				}
-
-				variables.put(key, injectedVariables.get(key));
-			}
-		}
-
-		variables.put("mso-schema-version", schemaVersion);
-		variables.put("mso-business-key", businessKey);
-		variables.put("bpmnRequest", request);
-
-		if (serviceInstantiationModel) {
-
-			/*
-			 * The request ID and the service instance ID are generated for flows
-			 * that follow the service instantiation model unless "requestId" and
-			 * "serviceInstanceId" are injected variables.
-			 */
-
-			try {
-				msoRequestId = (String) injectedVariables.get("requestId");
-				variables.put("mso-request-id", msoRequestId);
-				msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
-				variables.put("mso-service-instance-id", msoServiceInstanceId);
-			}
-			catch(Exception e) {
-			}
-			if (msoRequestId == null || msoRequestId.trim().equals("")) {
-				logger.debug("No requestId element in injectedVariables");
-				variables.put("mso-request-id", UUID.randomUUID().toString());
-			}
-			if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
-				logger.debug("No seviceInstanceId element in injectedVariables");
-				variables.put("mso-service-instance-id", UUID.randomUUID().toString());
-			}
-
-		} else {
-			msoRequestId = getXMLTextElement(request, "request-id");
-
-			if (msoRequestId == null) {
-				//check in injected variables
-				try {
-					msoRequestId = (String) injectedVariables.get("requestId");
-				}
-				catch(Exception e) {
-				}
-				if (msoRequestId == null || msoRequestId.trim().equals("")) {
-					String msg = "No request-id element in " + request;
-					logger.debug(msg);
-					fail(msg);
-				}
-			}
-
-			variables.put("mso-request-id", msoRequestId);
-
-			// Note: some request types don't have a service-instance-id
-			msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
-
-			if (msoServiceInstanceId != null) {
-				variables.put("mso-service-instance-id", msoServiceInstanceId);
-			}
-		}
-
-		return variables;
-	}
-
-	/**
-	 * Private helper method that creates a camunda VariableMapImpl from a simple
-	 * variable map.
-	 * @param variables the simple variable map
-	 * @return a VariableMap
-	 */
-	private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
-		Map<String, Object> wrappedVariables = new HashMap<>();
-
-		for (String key : variables.keySet()) {
-			Object value = variables.get(key);
-			wrappedVariables.put(key, wrapVariableValue(value));
-		}
-
-		VariableMapImpl variableMapImpl = new VariableMapImpl();
-		variableMapImpl.put("variables", wrappedVariables);
-		return variableMapImpl;
-	}
-
-	/**
-	 * Private helper method that wraps a variable value for inclusion in a
-	 * camunda VariableMapImpl.
-	 * @param value the variable value
-	 * @return the wrapped variable
-	 */
-	private Map<String, Object> wrapVariableValue(Object value) {
-		HashMap<String, Object> valueMap = new HashMap<>();
-		valueMap.put("value", value);
-		return valueMap;
-	}
-
-	/**
-	 * Receives a response from an asynchronous process.
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param businessKey the process business key
-	 * @param asyncResponse the TestAsyncResponse object associated with the test
-	 * @param timeout the timeout in milliseconds
-	 * @return the WorkflowResponse
-	 */
-	protected WorkflowResponse receiveResponse(String businessKey,
-			TestAsyncResponse asyncResponse, long timeout) {
-		logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
-
-		long now = System.currentTimeMillis() + timeout;
-		long endTime = now + timeout;
-
-		while (now <= endTime) {
-			Response response = asyncResponse.getResponse();
-
-			if (response != null) {
-				logger.debug("Received a response from process with business key {}", businessKey);
-
-				Object entity = response.getEntity();
-
-				if (!(entity instanceof WorkflowResponse)) {
-					String msg = "Response entity is " +
-						(entity == null ? "null" : entity.getClass().getName()) +
-						", expected WorkflowResponse";
-					logger.debug(msg);
-					fail(msg);
-					return null; // unreachable
-				}
-
-				return (WorkflowResponse) entity;
-			}
-
-			try {
-				Thread.sleep(200);
-			} catch (InterruptedException e) {
-				String msg = "Interrupted waiting for a response from process with business key " +
-					businessKey;
-				logger.debug(msg);
-				fail(msg);
-				return null; // unreachable
-			}
-
-			now = System.currentTimeMillis();
-		}
-
-		String msg = "No response received from process with business key " + businessKey +
-			" within " + timeout + "ms";
-		logger.debug(msg);
-		fail("Process with business key " + businessKey + " did not end within 10000ms");
-		return null; // unreachable
-	}
-
-	/**
-	 * Runs a program to inject SDNC callback data into the test environment.
-	 * A program is essentially just a list of keys that identify callback data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     reserve, assign, delete:ERR
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param callbacks an object containing callback data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String content = null;
-			String contentType = null;
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No callback defined for '" + action + "' SDNC request";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				contentType = callbackData.getContentType();
-			} else if ("ERR".equals(modifier)) {
-				content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
-				contentType = JSON;
-			} else {
-				String msg = "Invalid SDNC program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			if (contentType == null) {
-				// Default for backward compatibility with existing tests.
-				contentType = JSON;
-			}
-
-			if (!injectSDNCRestCallback(contentType, content, 10000)) {
-				fail("Failed to inject SDNC '" + action + "' callback");
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of SDNC '" + action + "' callback");
-			}
-		}
-	}
-
-	/**
-	 * Runs a program to inject SDNC events into the test environment.
-	 * A program is essentially just a list of keys that identify event data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     event1, event2
-	 * </pre>
-	 * NOTE: Each callback must have a message type associated with it, e.g.
-	 * "SDNCAEvent".
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param callbacks an object containing event data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectSDNCEvents(CallbackSet callbacks, String program) {
-		injectWorkflowMessages(callbacks, program);
-	}
-
-	/**
-	 * Runs a program to inject SDNC callback data into the test environment.
-	 * A program is essentially just a list of keys that identify callback data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     reserve, assign, delete:ERR
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * Uses the static/default timeout value for backward compatibility.
-	 * @param callbacks an object containing callback data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
-		injectSDNCCallbacks(callbacks, program, timeout);
-	}
-
-	/**
-	 * Runs a program to inject SDNC callback data into the test environment.
-	 * A program is essentially just a list of keys that identify callback data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     reserve, assign, delete:ERR
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param callbacks an object containing callback data for the program
-	 * @param program the program to execute
-	 * @param timeout a timeout value to wait for the callback
-	 */
-	protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String content = null;
-			int respCode = 200;
-			String respMsg = "OK";
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No callback defined for '" + action + "' SDNC request";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				respCode = 200;
-				respMsg = "OK";
-			} else if ("CREATED".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No callback defined for '" + action + "' SDNC request";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				respCode = 201;
-				respMsg = "Created";
-			} else if ("ERR".equals(modifier)) {
-				content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
-				respCode = 500;
-				respMsg = "SERVER ERROR";
-			} else {
-				String msg = "Invalid SDNC program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
-				fail("Failed to inject SDNC '" + action + "' callback");
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of SDNC '" + action + "' callback");
-			}
-		}
-	}
-
-	/**
-	 * Runs a program to inject VNF adapter REST callback data into the test environment.
-	 * A program is essentially just a list of keys that identify callback data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     create, rollback
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param callbacks an object containing callback data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String content = null;
-			String contentType = null;
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No callback defined for '" + action + "' VNF REST request";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				contentType = callbackData.getContentType();
-			} else if ("ERR".equals(modifier)) {
-				content = "SIMULATED ERROR FROM VNF ADAPTER";
-				contentType = "text/plain";
-			} else {
-				String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			if (contentType == null) {
-				// Default for backward compatibility with existing tests.
-				contentType = XML;
-			}
-
-			if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
-				fail("Failed to inject VNF REST '" + action + "' callback");
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of VNF REST '" + action + "' callback");
-			}
-		}
-	}
-
-	/**
-	 * Runs a program to inject VNF callback data into the test environment.
-	 * A program is essentially just a list of keys that identify callback data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     createVnf, deleteVnf
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * @param callbacks an object containing callback data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String content = null;
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No callback defined for '" + action + "' VNF request";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-			} else if ("ERR".equals(modifier)) {
-				String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			} else {
-				String msg = "Invalid VNF program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			boolean injected = false;
-
-			if (content.contains("createVnfNotification")) {
-				injected = injectCreateVNFCallback(content, 10000);
-			} else if (content.contains("deleteVnfNotification")) {
-				injected = injectDeleteVNFCallback(content, 10000);
-			} else if (content.contains("updateVnfNotification")) {
-				injected = injectUpdateVNFCallback(content, 10000);
-			}
-
-			if (!injected) {
-				String msg = "Failed to inject VNF '" + action + "' callback";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of VNF '" + action + "' callback");
-			}
-		}
-	}
-
-	/**
-	 * Waits for the number of running processes with the specified process
-	 * definition key to equal a particular count.
-	 * @param processKey the process definition key
-	 * @param count the desired count
-	 * @param timeout the timeout in milliseconds
-	 */
-	protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
-		logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
-
-		long now = System.currentTimeMillis() + timeout;
-		long endTime = now + timeout;
-		int last = -1;
-
-		while (now <= endTime) {
-			int actual = runtimeService
-				.createProcessInstanceQuery()
-				.processDefinitionKey(processKey)
-				.list().size();
-
-			if (actual != last) {
-				logger.debug("There are now {} {} instances", actual, processKey);
-				last = actual;
-			}
-
-			if (actual == count) {
-				return;
-			}
-
-			try {
-				Thread.sleep(200);
-			} catch (InterruptedException e) {
-				String msg = "Interrupted waiting for there to be " + count + " "
-					+ processKey + " instances";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			now = System.currentTimeMillis();
-		}
-
-		String msg = "Timed out waiting for there to be " + count + " "
-			+ processKey + " instances";
-		logger.debug(msg);
-		fail(msg);
-	}
-
-	/**
-	 * Waits for the specified process variable to be set.
-	 * @param processKey the process definition key
-	 * @param variable the variable name
-	 * @param timeout the timeout in milliseconds
-	 * @return the variable value, or null if it cannot be obtained
-	 *         in the specified time
-	 */
-	protected Object getProcessVariable(String processKey, String variable,
-			long timeout) {
-
-		logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set");
-
-		long now = System.currentTimeMillis() + timeout;
-		long endTime = now + timeout;
-
-		ProcessInstance processInstance = null;
-		Object value = null;
-
-		while (value == null) {
-			if (now > endTime) {
-				if (processInstance == null) {
-					logger.debug("Timed out waiting for "
-						+ processKey + " to start");
-				} else {
-					logger.debug("Timed out waiting for "
-						+ processKey + "[" + processInstance.getId()
-						+ "]." + variable + " to be set");
-				}
-
-				return null;
-			}
-
-			ProcessInstanceQuery processInstanceQuery = null;
-			if (processInstance == null) {
-				processInstanceQuery = runtimeService
-					.createProcessInstanceQuery()
-					.processDefinitionKey(processKey);
-			}
-
-			if(processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0){
-				processInstance = processInstanceQuery.singleResult();
-			}else{
-				//TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list
-				logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
-					processInstanceQuery.count());
-				List<ProcessInstance> processList = processInstanceQuery.list();
-				processInstance = processList.get((processList.size() - 1));
-			}
-
-
-			if (processInstance != null) {
-				value = runtimeService
-					.getVariable(processInstance.getId(), variable);
-			}
-
-			try {
-				Thread.sleep(200);
-			} catch (InterruptedException e) {
-				logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
-				return null;
-			}
-
-			now = System.currentTimeMillis();
-		}
-
-		logger.debug(processKey + "["
-			+ processInstance.getId() + "]." + variable + "="
-			+ value);
-
-		return value;
-	}
-
-	/**
-	 * Injects a single SDNC adapter callback request. The specified callback data
-	 * may contain the placeholder string ((REQUEST-ID)) which is replaced with
-	 * the actual SDNC request ID. Note: this is not the requestId in the original
-	 * MSO request.
-	 * @param contentType the HTTP content type for the callback
-	 * @param content the content of the callback
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 */
-	protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
-		String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
-			"SDNCAResponse_CORRELATOR", timeout);
-
-		if (sdncRequestId == null) {
-			sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2",
-				"SDNCAResponse_CORRELATOR", timeout);
-		}
-
-		if (sdncRequestId == null) {
-			return false;
-		}
-
-		content = content.replace("((REQUEST-ID))", sdncRequestId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
-		logger.debug("Injecting SDNC adapter callback");
-
-		Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
-		logger.debug("Workflow response to SDNC adapter callback: " + response);
-		return true;
-	}
-
-	/**
-	 * Injects a single SDNC adapter callback request. The specified callback data
-	 * may contain the placeholder string ((REQUEST-ID)) which is replaced with
-	 * the actual SDNC request ID. Note: this is not the requestId in the original
-	 * MSO request.
-	 * @param content the content of the callback
-	 * @param respCode the response code (normally 200)
-	 * @param respMsg the response message (normally "OK")
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 */
-	protected boolean injectSDNCCallback(int respCode, String respMsg,
-			String content, long timeout) {
-
-		String sdncRequestId = (String) getProcessVariable("sdncAdapter",
-			"SDNCA_requestId", timeout);
-
-		if (sdncRequestId == null) {
-			return false;
-		}
-
-		content = content.replace("((REQUEST-ID))", sdncRequestId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
-		// TODO this needs to be fixed. It is causing double tags and content
-		// Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents.
-
-		logger.debug("Injecting SDNC adapter callback");
-		CallbackHeader callbackHeader = new CallbackHeader();
-		callbackHeader.setRequestId(sdncRequestId);
-		callbackHeader.setResponseCode(String.valueOf(respCode));
-		callbackHeader.setResponseMessage(respMsg);
-		SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
-		sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
-		sdncAdapterCallbackRequest.setRequestData(content);
-		SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
-		logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
-
-		return true;
-	}
-
-	/**
-	 * Injects a single VNF adapter callback request. The specified callback data
-	 * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
-	 * the actual message ID. Note: this is not the requestId in the original
-	 * MSO request.
-	 * @param contentType the HTTP content type for the callback
-	 * @param content the content of the callback
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 */
-	protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
-		String messageId = (String) getProcessVariable("vnfAdapterRestV1",
-			"VNFAResponse_CORRELATOR", timeout);
-
-		if (messageId == null) {
-			return false;
-		}
-
-		content = content.replace("((MESSAGE-ID))", messageId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{MESSAGE-ID}}", messageId);
-
-		logger.debug("Injecting VNF adapter callback");
-
-		Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
-		logger.debug("Workflow response to VNF adapter callback: {}", response);
-		return true;
-	}
-
-	/**
-	 * Injects a Create VNF adapter callback request. The specified callback data
-	 * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
-	 * the actual message ID.  It may also contain the placeholder string
-	 * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
-	 * @param content the content of the callback
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 * @throws JAXBException if the content does not adhere to the schema
-	 */
-	protected boolean injectCreateVNFCallback(String content, long timeout) {
-
-		String messageId = (String) getProcessVariable("vnfAdapterCreateV1",
-			"VNFC_messageId", timeout);
-
-		if (messageId == null) {
-			return false;
-		}
-
-		content = content.replace("((MESSAGE-ID))", messageId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{MESSAGE-ID}}", messageId);
-
-		if(content.contains("((REQUEST-ID))")){
-			content = content.replace("((REQUEST-ID))", msoRequestId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-			content = content.replace("{{REQUEST-ID}}", msoRequestId);
-		}
-
-		logger.debug("Injecting VNF adapter callback");
-
-		// Is it possible to unmarshal this with JAXB?  I couldn't.
-
-		CreateVnfNotification createVnfNotification = new CreateVnfNotification();
-		XPathTool xpathTool = new VnfNotifyXPathTool();
-		xpathTool.setXML(content);
-
-		try {
-			String completed = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:completed/text()");
-			createVnfNotification.setCompleted("true".equals(completed));
-
-			String vnfId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:vnfId/text()");
-			createVnfNotification.setVnfId(vnfId);
-
-			NodeList entries = (NodeList) xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:outputs/tns:entry",
-				XPathConstants.NODESET);
-
-			CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
-
-			for (int i = 0; i < entries.getLength(); i++) {
-				Node node = entries.item(i);
-
-				if (node.getNodeType() == Node.ELEMENT_NODE) {
-					Element entry = (Element) node;
-					String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
-					String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
-					outputs.add(key, value);
-				}
-			}
-
-			createVnfNotification.setOutputs(outputs);
-
-			VnfRollback rollback = new VnfRollback();
-
-			String cloudSiteId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
-			rollback.setCloudSiteId(cloudSiteId);
-
-			String cloudOwner = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
-			rollback.setCloudOwner(cloudOwner);
-
-			String requestId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
-			String serviceInstanceId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
-			if (requestId != null || serviceInstanceId != null) {
-				MsoRequest msoRequest = new MsoRequest();
-				msoRequest.setRequestId(requestId);
-				msoRequest.setServiceInstanceId(serviceInstanceId);
-				rollback.setMsoRequest(msoRequest);
-			}
-
-			String tenantCreated = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
-			rollback.setTenantCreated("true".equals(tenantCreated));
-
-			String tenantId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
-			rollback.setTenantId(tenantId);
-
-			String vnfCreated = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
-			rollback.setVnfCreated("true".equals(vnfCreated));
-
-			String rollbackVnfId = xpathTool.evaluate(
-				"/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
-			rollback.setVnfId(rollbackVnfId);
-
-			createVnfNotification.setRollback(rollback);
-
-		} catch (Exception e) {
-			logger.debug("Failed to unmarshal VNF callback content:");
-			logger.debug(content);
-			return false;
-		}
-
-		VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
-		notifyService.createVnfNotification(
-			messageId,
-			createVnfNotification.isCompleted(),
-			createVnfNotification.getException(),
-			createVnfNotification.getErrorMessage(),
-			createVnfNotification.getVnfId(),
-			createVnfNotification.getOutputs(),
-			createVnfNotification.getRollback());
-
-		return true;
-	}
-
-	/**
-	 * Injects a Delete VNF adapter callback request. The specified callback data
-	 * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
-	 * the actual message ID.  It may also contain the placeholder string
-	 * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
-	 * @param content the content of the callback
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 * @throws JAXBException if the content does not adhere to the schema
-	 */
-	protected boolean injectDeleteVNFCallback(String content, long timeout) {
-
-		String messageId = (String) getProcessVariable("vnfAdapterDeleteV1",
-			"VNFDEL_uuid", timeout);
-
-		if (messageId == null) {
-			return false;
-		}
-
-		content = content.replace("((MESSAGE-ID))", messageId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{MESSAGE-ID}}", messageId);
-
-		logger.debug("Injecting VNF adapter delete callback");
-
-		// Is it possible to unmarshal this with JAXB?  I couldn't.
-
-		DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
-		XPathTool xpathTool = new VnfNotifyXPathTool();
-		xpathTool.setXML(content);
-
-		try {
-			String completed = xpathTool.evaluate(
-				"/tns:deleteVnfNotification/tns:completed/text()");
-			deleteVnfNotification.setCompleted("true".equals(completed));
-			// if notification failure, set the exception and error message
-			if (deleteVnfNotification.isCompleted() == false) {
-				deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
-				deleteVnfNotification.setErrorMessage(xpathTool.evaluate(
-						"/tns:deleteVnfNotification/tns:errorMessage/text()")) ;
-			}
-
-		} catch (Exception e) {
-			logger.debug("Failed to unmarshal VNF Delete callback content:");
-			logger.debug(content);
-			return false;
-		}
-
-		VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
-		notifyService.deleteVnfNotification(
-			messageId,
-			deleteVnfNotification.isCompleted(),
-			deleteVnfNotification.getException(),
-			deleteVnfNotification.getErrorMessage());
-
-		return true;
-	}
-
-	/**
-	 * Injects a Update VNF adapter callback request. The specified callback data
-	 * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
-	 * the actual message ID.  It may also contain the placeholder string
-	 * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
-	 * @param content the content of the callback
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the callback could be injected, false otherwise
-	 * @throws JAXBException if the content does not adhere to the schema
-	 */
-	protected boolean injectUpdateVNFCallback(String content, long timeout) {
-
-		String messageId = (String) getProcessVariable("vnfAdapterUpdate",
-			"VNFU_messageId", timeout);
-
-		if (messageId == null) {
-			return false;
-		}
-
-		content = content.replace("((MESSAGE-ID))", messageId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{MESSAGE-ID}}", messageId);
-
-		content = content.replace("((REQUEST-ID))", msoRequestId);
-		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
-		content = content.replace("{{REQUEST-ID}}", msoRequestId);
-
-		logger.debug("Injecting VNF adapter callback");
-
-		// Is it possible to unmarshal this with JAXB?  I couldn't.
-
-		UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
-		XPathTool xpathTool = new VnfNotifyXPathTool();
-		xpathTool.setXML(content);
-
-		try {
-			String completed = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:completed/text()");
-			updateVnfNotification.setCompleted("true".equals(completed));
-
-			NodeList entries = (NodeList) xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:outputs/tns:entry",
-				XPathConstants.NODESET);
-
-			UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
-
-			for (int i = 0; i < entries.getLength(); i++) {
-				Node node = entries.item(i);
-
-				if (node.getNodeType() == Node.ELEMENT_NODE) {
-					Element entry = (Element) node;
-					String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
-					String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
-					outputs.add(key, value);
-				}
-			}
-
-			updateVnfNotification.setOutputs(outputs);
-
-			VnfRollback rollback = new VnfRollback();
-
-			String cloudSiteId = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
-			rollback.setCloudSiteId(cloudSiteId);
-
-			String cloudOwner = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
-			rollback.setCloudOwner(cloudOwner);
-
-			String requestId = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
-			String serviceInstanceId = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
-			if (requestId != null || serviceInstanceId != null) {
-				MsoRequest msoRequest = new MsoRequest();
-				msoRequest.setRequestId(requestId);
-				msoRequest.setServiceInstanceId(serviceInstanceId);
-				rollback.setMsoRequest(msoRequest);
-			}
-
-			String tenantCreated = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
-			rollback.setTenantCreated("true".equals(tenantCreated));
-
-			String tenantId = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
-			rollback.setTenantId(tenantId);
-
-			String vnfCreated = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
-			rollback.setVnfCreated("true".equals(vnfCreated));
-
-			String rollbackVnfId = xpathTool.evaluate(
-				"/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
-			rollback.setVnfId(rollbackVnfId);
-
-			updateVnfNotification.setRollback(rollback);
-
-		} catch (Exception e) {
-			logger.debug("Failed to unmarshal VNF callback content:");
-			logger.debug(content);
-			return false;
-		}
-
-		VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
-		notifyService.updateVnfNotification(
-			messageId,
-			updateVnfNotification.isCompleted(),
-			updateVnfNotification.getException(),
-			updateVnfNotification.getErrorMessage(),
-			updateVnfNotification.getOutputs(),
-			updateVnfNotification.getRollback());
-
-		return true;
-	}
-
-	/**
-	 * Runs a program to inject workflow messages into the test environment.
-	 * A program is essentially just a list of keys that identify event data
-	 * to be injected, in sequence. An example program:
-	 * <pre>
-	 *     event1, event2
-	 * </pre>
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * NOTE: Each callback must have a workflow message type associated with it.
-	 * @param callbacks an object containing event data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String messageType = null;
-			String content = null;
-			String contentType = null;
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No '" + action + "' workflow message callback is defined";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				messageType = callbackData.getMessageType();
-
-				if (messageType == null || messageType.trim().equals("")) {
-					String msg = "No workflow message type is defined in the '" + action + "' callback";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				contentType = callbackData.getContentType();
-			} else {
-				String msg = "Invalid workflow message program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
-				fail("Failed to inject '" + action + "' workflow message");
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of '" + action + "' workflow message");
-			}
-		}
-	}
-
-	/**
-	 * Injects a workflow message. The specified callback data may contain the
-	 * placeholder string ((CORRELATOR)) which is replaced with the actual
-	 * correlator value.
-	 * @param contentType the HTTP contentType for the message (possibly null)
-	 * @param messageType the message type
-	 * @param content the message content (possibly null)
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the message could be injected, false otherwise
-	 */
-	protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
-		String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
-			messageType + "_CORRELATOR", timeout);
-
-		if (correlator == null) {
-			return false;
-		}
-
-		if (content != null) {
-			content = content.replace("((CORRELATOR))", correlator);
-		}
-
-		logger.debug("Injecting " + messageType + " message");
-
-		Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
-		logger.debug("Workflow response to {} message: {}", messageType, response);
-		return true;
-	}
-
-	/**
-	 * Runs a program to inject sniro workflow messages into the test environment.
-	 * A program is essentially just a list of keys that identify event data
-	 * to be injected, in sequence. For more details, see
-	 * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout)
-	 *
-	 * Errors are handled with junit assertions and will cause the test to fail.
-	 * NOTE: Each callback must have a workflow message type associated with it.
-	 *
-	 * @param callbacks an object containing event data for the program
-	 * @param program the program to execute
-	 */
-	protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
-
-		String[] cmds = program.replaceAll("\\s+", "").split(",");
-
-		for (String cmd : cmds) {
-			String action = cmd;
-			String modifier = "STD";
-
-			if (cmd.contains(":")) {
-				String[] parts = cmd.split(":");
-				action = parts[0];
-				modifier = parts[1];
-			}
-
-			String messageType = null;
-			String content = null;
-			String contentType = null;
-
-			if ("STD".equals(modifier)) {
-				CallbackData callbackData = callbacks.get(action);
-
-				if (callbackData == null) {
-					String msg = "No '" + action + "' workflow message callback is defined";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				messageType = callbackData.getMessageType();
-
-				if (messageType == null || messageType.trim().equals("")) {
-					String msg = "No workflow message type is defined in the '" + action + "' callback";
-					logger.debug(msg);
-					fail(msg);
-				}
-
-				content = callbackData.getContent();
-				contentType = callbackData.getContentType();
-			} else {
-				String msg = "Invalid workflow message program modifier: '" + modifier + "'";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
-				fail("Failed to inject '" + action + "' workflow message");
-			}
-
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				fail("Interrupted after injection of '" + action + "' workflow message");
-			}
-		}
-	}
-
-	/**
-	 * Injects a sniro workflow message. The specified callback response may
-	 * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID))
-	 * The ((CORRELATOR)) is replaced with the actual correlator value from the
-	 * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId
-	 * value from the sniro request. Currently this only works with sniro request
-	 * that contain only 1 resource.
-	 *
-	 * @param contentType the HTTP contentType for the message (possibly null)
-	 * @param messageType the message type
-	 * @param content the message content (possibly null)
-	 * @param timeout the timeout in milliseconds
-	 * @return true if the message could be injected, false otherwise
-	 */
-	protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
-		String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
-			messageType + "_CORRELATOR", timeout);
-
-		if (correlator == null) {
-			return false;
-		}
-		if (content != null) {
-			content = content.replace("((CORRELATOR))", correlator);
-			if(messageType.equalsIgnoreCase("SNIROResponse")){
-				ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
-				List<Resource> resourceList = decomp.getServiceResources();
-				if(resourceList.size() == 1){
-					String resourceId = "";
-					for(Resource resource:resourceList){
-						resourceId = resource.getResourceId();
-					}
-					String homingList = getJsonValue(content, "solutionInfo.placementInfo");
-					JSONArray placementArr = null;
-					try {
-						placementArr = new JSONArray(homingList);
-					}
-					catch (Exception e) {
-						return false;
-					}
-					if(placementArr.length() == 1){
-						content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
-					}
-					String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
-					JSONArray licenseArr = null;
-					try {
-						licenseArr = new JSONArray(licenseInfoList);
-					}
-					catch (Exception e) {
-						return false;
-					}
-					if(licenseArr.length() == 1){
-						content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
-					}
-				}
-				else {
-					try {
-						String homingList = getJsonValue(content, "solutionInfo.placementInfo");
-						String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
-						JSONArray placementArr = new JSONArray(homingList);
-						JSONArray licenseArr = new JSONArray(licenseInfoList);
-						for (Resource resource: resourceList) {
-							String resourceModuleName = resource.getModelInfo().getModelInstanceName();
-							String resourceId = resource.getResourceId();
-
-							for (int i=0; i<placementArr.length(); i++) {
-								JSONObject placementObj = placementArr.getJSONObject(i);
-								String placementModuleName = placementObj.getString("resourceModuleName");
-								if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
-									String placementString = placementObj.toString();
-									placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
-									JSONObject newPlacementObj = new JSONObject(placementString);
-									placementArr.put(i, newPlacementObj);
-								}
-							}
-
-							for (int i=0; i<licenseArr.length(); i++) {
-								JSONObject licenseObj = licenseArr.getJSONObject(i);
-								String licenseModuleName = licenseObj.getString("resourceModuleName");
-								if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
-									String licenseString = licenseObj.toString();
-									licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
-									JSONObject newLicenseObj = new JSONObject(licenseString);
-									licenseArr.put(i, newLicenseObj);
-								}
-							}
-						}
-						String newPlacementInfos = placementArr.toString();
-						String newLicenseInfos = licenseArr.toString();
-						content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
-						content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
-					}
-					catch(Exception e) {
-						return false;
-					}
-
-				}
-			}
-		}
-		logger.debug("Injecting " + messageType + " message");
-
-		Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
-		logger.debug("Workflow response to {} message: {}", messageType, response);
-		return true;
-	}
-
-
-	/**
-	 * Wait for the process to end.
-	 * @param businessKey the process business key
-	 * @param timeout the amount of time to wait, in milliseconds
-	 */
-	protected void waitForProcessEnd(String businessKey, long timeout) {
-		logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
-		long now = System.currentTimeMillis() + timeout;
-		long endTime = now + timeout;
-
-		while (now <= endTime) {
-			if (isProcessEnded(businessKey)) {
-				logger.debug("Process with business key {} has ended", businessKey);
-				return;
-			}
-
-			try {
-				Thread.sleep(200);
-			} catch (InterruptedException e) {
-				String msg = "Interrupted waiting for process with business key " +
-					businessKey + " to end";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			now = System.currentTimeMillis();
-		}
-
-		String msg = "Process with business key " + businessKey +
-			" did not end within " + timeout + "ms";
-		logger.debug(msg);
-		fail(msg);
-	}
-
-	/**
-	 * Wait for the process to end. Must be used when multiple process instances exist with
-	 * this same business key such as when its passed to subflows or shared across multiple
-	 * processes.
-	 *
-	 * @param businessKey the process business key
-	 * @param processName the process definition name
-	 * @param timeout the amount of time to wait, in milliseconds
-	 * @author cb645j
-	 */
-	protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
-		logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
-		long now = System.currentTimeMillis() + timeout;
-		long endTime = now + timeout;
-
-		while (now <= endTime) {
-			if (isProcessEnded(businessKey, processName)) {
-				logger.debug("Process with business key {} has ended", businessKey);
-				return;
-			}
-
-			try {
-				Thread.sleep(200);
-			} catch (InterruptedException e) {
-				String msg = "Interrupted waiting for process with business key " +
-					businessKey + " to end";
-				logger.debug(msg);
-				fail(msg);
-			}
-
-			now = System.currentTimeMillis();
-		}
-
-		String msg = "Process with business key " + businessKey +
-			" did not end within " + timeout + "ms";
-		logger.debug(msg);
-		fail(msg);
-	}
-
-	/**
-	 * Verifies that the specified historic process variable has the specified value.
-	 * If the variable does not have the specified value, the test is failed.
-	 *
-	 * @param businessKey the process business key
-	 * @param variable the variable name
-	 * @param value the expected variable value
-	 */
-	protected void checkVariable(String businessKey, String variable, Object value) {
-		if (!isProcessEnded(businessKey)) {
-			fail("Cannot get historic variable " + variable + " because process with business key " +
-				businessKey + " has not ended");
-		}
-
-		Object variableValue = getVariableFromHistory(businessKey, variable);
-		assertEquals(value, variableValue);
-	}
-
-	/**
-	 * Checks to see if the specified process is ended.
-	 * @param businessKey the process business Key
-	 * @return true if the process is ended
-	 */
-	protected boolean isProcessEnded(String businessKey) {
-		HistoricProcessInstance processInstance = historyService
-			.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
-		return processInstance != null && processInstance.getEndTime() != null;
-	}
-
-	/**
-	 * Checks to see if the specified process is ended.
-	 *
-	 * @param processInstanceId the process Instance Id
-	 * @return true if the process is ended
-	 */
-	protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
-		HistoricProcessInstance processInstance = historyService
-				.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
-		return processInstance != null && processInstance.getEndTime() != null;
-	}
-
-	/**
-	 * Checks to see if the specified process is ended.
-	 *
-	 * @author cb645j
-	 */
-	//TODO combine into 1
-	private boolean isProcessEnded(String businessKey, String processName) {
-		HistoricProcessInstance processInstance = historyService
-			.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
-		return processInstance != null && processInstance.getEndTime() != null;
-	}
-
-	/**
-	 * Gets a variable value from a historical process instance. The business key must be unique.
-	 *
-	 * @param businessKey the process business key
-	 * @param variableName the variable name
-	 * @return the variable value or null if the variable does not exist
-	 */
-	protected Object getVariableFromHistory(String businessKey, String variableName) {
-		try {
-			HistoricProcessInstance processInstance = historyService
-				.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
-
-			if (processInstance == null) {
-				return null;
-			}
-
-			HistoricVariableInstance v = historyService
-				.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
-				.variableName(variableName).singleResult();
-			return v == null ? null : v.getValue();
-		} catch (Exception e) {
-			logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName, businessKey,
-					e);
-			return null;
-		}
-	}
-
-	/**
-	 * Gets a variable value from a process instance based on businessKey and process name.
-	 * Must be used when multiple instances exist with the same business key such as when
-	 * business key is passed to subflows or shared across multiple processes. This method
-	 * can obtain variables from mainflows and from subflows.
-	 *
-	 * @param businessKey the process business key
-	 * @param processName the process definition name
-	 * @param variableName the variable name
-	 * @return the variable value or null if the variable does not exist
-	 * @author cb645j
-	 */
-	protected Object getVariableFromHistory(String businessKey, String processName, String variableName){
-		try{
-			HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
-					.singleResult();
-
-			if(processInstance == null){
-				return null;
-			}
-			HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
-
-			return variable == null ? null : variable.getValue();
-		}catch(ProcessEngineException e){
-			logger.debug("Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
-				+ "index as a parameter.", processName, businessKey);
-			return null;
-		}catch(Exception e){
-			logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
-				variableName, processName, businessKey, e);
-			return null;
-		}
-	}
-
-	/**
-	 * Gets the value of a process variable from x instance of y process. Must be used when
-	 * multiple instances exist with the same business key AND process name. This method
-	 * shall be used primarily for obtaining subflow variables when the business key is
-	 * passed to the subflow AND the subflow is called multiple times in a given flow.
-	 *
-	 * @param businessKey the process business key
-	 * @param processName the name of the subflow that contains the variable
-	 * @param variableName the variable name
-	 * @param processInstanceIndex the instance in which the subprocess was called
-	 * @return the variable value or null if the variable does not exist
-	 * @author cb645j
-	 */
-	protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName, String variableName){
-		try{
-			List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
-					.list();
-
-			if(processInstanceList == null){
-				return null;
-			}
-			processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
-			HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
-			HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
-					.variableName(variableName).singleResult();
-
-			return variable == null ? null : variable.getValue();
-		}catch(Exception e) {
-			logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
-				variableName, processName, businessKey, e);
-			return null;
-		}
-	}
-
-
-	/**
-	 * Gets the value of a subflow variable from the specified subflow's
-	 * historical process instance.
-	 *
-	 * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead
-	 *
-	 * @param subflowName - the name of the subflow that contains the variable
-	 * @param variableName the variable name
-	 *
-	 * @return the variable value, or null if the variable could not be obtained
-	 *
-	 */
-	@Deprecated
-	protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
-		try {
-			List<HistoricProcessInstance> processInstanceList = historyService
-					.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
-			if (processInstanceList == null) {
-				return null;
-			}
-
-			processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
-			HistoricProcessInstance processInstance = processInstanceList.get(0);
-
-			HistoricVariableInstance v = historyService
-				.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
-				.variableName(variableName).singleResult();
-			return v == null ? null : v.getValue();
-		} catch (Exception e) {
-			logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName, e);
-			return null;
-		}
-	}
-
-	/**
-	 * Gets the value of a subflow variable from the subflow's
-	 * historical process x instance.
-	 *
-	 * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName) instead
-	 *
-	 * @param subflowName - the name of the subflow that contains the variable
-	 * @param variableName the variable name
-	 * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow)
-	 *
-	 * @return the variable value, or null if the variable could not be obtained
-	 */
-	@Deprecated
-	protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
-		try {
-			List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
-			if (processInstanceList == null) {
-				return null;
-			}
-
-			processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
-			HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
-
-			HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
-				.variableName(variableName).singleResult();
-			return v == null ? null : v.getValue();
-		} catch (Exception e) {
-			logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ", variableName,
-				subflowInstanceIndex, subflowName, e);
-			return null;
-		}
-	}
-
-	/**
-	 * Extracts text from an XML element. This method is not namespace aware
-	 * (namespaces are ignored).  The first matching element is selected.
-	 * @param xml the XML document or fragment
-	 * @param tag the desired element, e.g. "<name>"
-	 * @return the element text, or null if the element was not found
-	 */
-	protected String getXMLTextElement(String xml, String tag) {
-		xml = removeXMLNamespaces(xml);
-
-		if (!tag.startsWith("<")) {
-			tag = "<" + tag + ">";
-		}
-
-		int start = xml.indexOf(tag);
-
-		if (start == -1) {
-			return null;
-		}
-
-		int end = xml.indexOf('<', start + tag.length());
-
-		if (end == -1) {
-			return null;
-		}
-
-		return xml.substring(start + tag.length(), end);
-	}
-
-	/**
-	 * Removes namespace definitions and prefixes from XML, if any.
-	 */
-	private String removeXMLNamespaces(String xml) {
-		// remove xmlns declaration
-		xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
-
-		// remove opening tag prefix
-		xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
-
-		// remove closing tags prefix
-		xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
-
-		// remove extra spaces left when xmlns declarations are removed
-		xml = xml.replaceAll("\\s+>", ">");
-
-		return xml;
-	}
-
-	/**
-	 * Asserts that two XML documents are semantically equivalent.  Differences
-	 * in whitespace or in namespace usage do not affect the comparison.
-	 * @param expected the expected XML
-	 * @param actual the XML to test
-	 * @throws SAXException
-	 * @throws IOException
-	 */
-    public static void assertXMLEquals(String expected, String actual)
-    		throws SAXException, IOException {
-    	XMLUnit.setIgnoreWhitespace(true);
-    	XMLUnit.setIgnoreAttributeOrder(true);
-    	DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
-    	List<?> allDifferences = diff.getAllDifferences();
-    	assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+    /**
+     * Logs a test start method.
+     */
+    protected void logStart() {
+        logger.debug("STARTED TEST");
     }
 
-	/**
-	 * A test implementation of AsynchronousResponse.
-	 */
-	public class TestAsyncResponse {
-		Response response = null;
+    /**
+     * Logs a test end method.
+     */
+    protected void logEnd() {
+        logger.debug("ENDED TEST");
+    }
 
-		/**
-		 * {@inheritDoc}
-		 */
-		public synchronized void setResponse(Response response) {
-			this.response = response;
-		}
+    /**
+     * Invokes a subprocess.
+     * 
+     * @param processKey the process key
+     * @param businessKey a unique key that will identify the process instance
+     * @param injectedVariables variables to inject into the process
+     */
+    protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
+        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+        List<String> arguments = runtimeMxBean.getInputArguments();
+        logger.debug("JVM args = {}", arguments);
 
-		/**
-		 * Gets the response.
-		 * @return the response, or null if none has been produced yet
-		 */
-		public synchronized Response getResponse() {
-			return response;
-		}
-	}
+        msoRequestId = (String) injectedVariables.get("mso-request-id");
+        String requestId = (String) injectedVariables.get("msoRequestId");
 
-	/**
-	 * An object that contains callback data for a "program".
-	 */
-	public class CallbackSet {
-		private final Map<String, CallbackData> map = new HashMap<>();
+        if (msoRequestId == null && requestId == null) {
+            String msg = "mso-request-id variable was not provided";
+            logger.debug(msg);
+            fail(msg);
+        }
 
-		/**
-		 * Add untyped callback data to the set.
-		 * @param action the action with which the data is associated
-		 * @param content the callback data
-		 */
-		public void put(String action, String content) {
-			map.put(action, new CallbackData(null, null, content));
-		}
+        // Note: some scenarios don't have a service-instance-id, may be null
+        msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
 
-		/**
-		 * Add callback data to the set.
-		 * @param action the action with which the data is associated
-		 * @param messageType the callback message type
-		 * @param content the callback data
-		 */
-		public void put(String action, String messageType, String content) {
-			map.put(action, new CallbackData(null, messageType, content));
-		}
 
-		/**
-		 * Add callback data to the set.
-		 * @param action the action with which the data is associated
-		 * @param contentType the callback HTTP content type
-		 * @param messageType the callback message type
-		 * @param content the callback data
-		 */
-		public void put(String action, String contentType, String messageType, String content) {
-			map.put(action, new CallbackData(contentType, messageType, content));
-		}
+        runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
+    }
 
-		/**
-		 * Retrieve callback data from the set.
-		 * @param action the action with which the data is associated
-		 * @return the callback data, or null if there is none for the specified operation
-		 */
-		public CallbackData get(String action) {
-			return map.get(action);
-		}
-	}
+    protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) {
+        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+        List<String> arguments = runtimeMxBean.getInputArguments();
+        logger.debug("JVM args = {}", arguments);
 
-	/**
-	 * Represents a callback data item.
-	 */
-	public class CallbackData {
-		private final String contentType;
-		private final String messageType;
-		private final String content;
+        msoRequestId = (String) injectedVariables.get("mso-request-id");
+        String requestId = (String) injectedVariables.get("msoRequestId");
 
-		/**
-		 * Constructor
-		 * @param contentType the HTTP content type (optional)
-		 * @param messageType the callback message type (optional)
-		 * @param content the content
-		 */
-		public CallbackData(String contentType, String messageType, String content) {
-			this.contentType = contentType;
-			this.messageType = messageType;
-			this.content = content;
-		}
+        if (msoRequestId == null && requestId == null) {
+            String msg = "mso-request-id variable was not provided";
+            logger.debug(msg);
+            fail(msg);
+        }
 
-		/**
-		 * Gets the callback HTTP content type, possibly null.
-		 */
-		public String getContentType() {
-			return contentType;
-		}
+        // Note: some scenarios don't have a service-instance-id, may be null
+        msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
 
-		/**
-		 * Gets the callback message type, possibly null.
-		 */
-		public String getMessageType() {
-			return messageType;
-		}
 
-		/**
-		 * Gets the callback content.
-		 */
-		public String getContent() {
-			return content;
-		}
-	}
+        ProcessInstance processInstance =
+                runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables);
+        return processInstance.getId();
+    }
 
-	/**
-	 * A tool for evaluating XPath expressions.
-	 */
-	protected class XPathTool {
-		private final DocumentBuilderFactory factory;
-		private final SimpleNamespaceContext context = new SimpleNamespaceContext();
-		private final XPath xpath = XPathFactory.newInstance().newXPath();
-		private String xml = null;
-		private Document doc = null;
+    /**
+     * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param processKey the process key
+     * @param schemaVersion the API schema version, e.g. "v1"
+     * @param businessKey a unique key that will identify the process instance
+     * @param request the request
+     * @return a TestAsyncResponse object associated with the test
+     * @throws InterruptedException
+     */
+    protected TestAsyncResponse invokeAsyncProcess(String processKey, String schemaVersion, String businessKey,
+            String request) throws InterruptedException {
+        return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
+    }
 
-		/**
-		 * Constructor.
-		 */
-		public XPathTool() {
-			factory = DocumentBuilderFactory.newInstance();
-			factory.setNamespaceAware(true);
-			xpath.setNamespaceContext(context);
-		}
+    /**
+     * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param processKey the process key
+     * @param schemaVersion the API schema version, e.g. "v1"
+     * @param businessKey a unique key that will identify the process instance
+     * @param request the request
+     * @param injectedVariables optional variables to inject into the process
+     * @return a TestAsyncResponse object associated with the test
+     * @throws InterruptedException
+     */
+    protected TestAsyncResponse invokeAsyncProcess(String processKey, String schemaVersion, String businessKey,
+            String request, Map<String, Object> injectedVariables) {
 
-		/**
-		 * Adds a namespace.
-		 * @param prefix the namespace prefix
-		 * @param uri the namespace uri
-		 */
-		public synchronized void addNamespace(String prefix, String uri) {
-			context.add(prefix, uri);
-		}
+        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+        List<String> arguments = runtimeMxBean.getInputArguments();
+        logger.debug("JVM args = {}", arguments);
 
-		/**
-		 * Sets the XML content to be operated on.
-		 * @param xml the XML content
-		 */
-		public synchronized void setXML(String xml) {
-			this.xml = xml;
-			this.doc = null;
-		}
+        Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, false);
+        VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
 
-		/**
-		 * Returns the document object.
-		 * @return the document object, or null if XML has not been set
-		 * @throws SAXException
-		 * @throws IOException
-		 * @throws ParserConfigurationException
-		 */
-		public synchronized Document getDocument()
-				throws ParserConfigurationException, IOException, SAXException {
-			if (xml == null) {
-				return null;
-			}
+        logger.debug("Sending {} to {} process", request, processKey);
 
-			buildDocument();
-			return doc;
-		}
+        TestAsyncResponse asyncResponse = new TestAsyncResponse();
 
-		/**
-		 * Evaluates the specified XPath expression and returns a string result.
-		 * This method throws exceptions on error.
-		 * @param expression the expression
-		 * @return the result object
-		 * @throws ParserConfigurationException
-		 * @throws IOException
-		 * @throws SAXException
-		 * @throws XPathExpressionException on error
-		 */
-		public synchronized String evaluate(String expression)
-				throws ParserConfigurationException, SAXException,
-				IOException, XPathExpressionException {
-			return (String) evaluate(expression, XPathConstants.STRING);
-		}
+        asyncResponse.setResponse(workflowResource.startProcessInstanceByKey(processKey, variableMapImpl));
 
-		/**
-		 * Evaluates the specified XPath expression.
-		 * This method throws exceptions on error.
-		 * @param expression the expression
-		 * @param returnType the return type
-		 * @return the result object
-		 * @throws ParserConfigurationException
-		 * @throws IOException
-		 * @throws SAXException
-		 * @throws XPathExpressionException on error
-		 */
-		public synchronized Object evaluate(String expression, QName returnType)
-				throws ParserConfigurationException, SAXException,
-				IOException, XPathExpressionException {
+        return asyncResponse;
+    }
 
-			buildDocument();
-			XPathExpression expr = xpath.compile(expression);
-			return expr.evaluate(doc, returnType);
-		}
+    /**
+     * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param processKey the process key
+     * @param schemaVersion the API schema version, e.g. "v1"
+     * @param businessKey a unique key that will identify the process instance
+     * @param request the request
+     * @param injectedVariables optional variables to inject into the process
+     * @param serviceInstantiationModel indicates whether this method is being invoked for a flow that is designed using
+     *        the service instantiation model
+     * @return a TestAsyncResponse object associated with the test
+     * @throws InterruptedException
+     */
+    protected Response invokeAsyncProcess(String processKey, String schemaVersion, String businessKey, String request,
+            Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
 
-		/**
-		 * Private helper method that builds the document object.
-		 * Assumes the calling method is synchronized.
-		 * @throws ParserConfigurationException
-		 * @throws IOException
-		 * @throws SAXException
-		 */
-		private void buildDocument() throws ParserConfigurationException,
-				IOException, SAXException {
-			if (doc == null) {
-				if (xml == null) {
-					throw new IOException("XML input is null");
-				}
+        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+        List<String> arguments = runtimeMxBean.getInputArguments();
+        logger.debug("JVM args = {}", arguments);
 
-				DocumentBuilder builder = factory.newDocumentBuilder();
-				InputSource source = new InputSource(new StringReader(xml));
-				doc = builder.parse(source);
-			}
-		}
-	}
+        Map<String, Object> variables =
+                createVariables(schemaVersion, businessKey, request, injectedVariables, serviceInstantiationModel);
+        VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
 
-	/**
-	 * A NamespaceContext class based on a Map.
-	 */
-	private class SimpleNamespaceContext implements NamespaceContext {
-		private Map<String, String> prefixMap = new HashMap<>();
-		private Map<String, String> uriMap = new HashMap<>();
+        logger.debug("Sending {} to {} process", request, processKey);
 
-		public synchronized void add(String prefix, String uri) {
-			prefixMap.put(prefix, uri);
-			uriMap.put(uri, prefix);
-		}
+        return workflowResource.startProcessInstanceByKey(processKey, variableMapImpl);
 
-		@Override
-		public synchronized String getNamespaceURI(String prefix) {
-			return prefixMap.get(prefix);
-		}
+    }
 
-		@Override
-		public Iterator<String> getPrefixes(String uri) {
-			List<String> list = new ArrayList<>();
-			String prefix = uriMap.get(uri);
-			if (prefix != null) {
-				list.add(prefix);
-			}
-			return list.iterator();
-		}
+    /**
+     * Private helper method that creates a variable map for a request. Errors are handled with junit assertions and
+     * will cause the test to fail.
+     * 
+     * @param schemaVersion the API schema version, e.g. "v1"
+     * @param businessKey a unique key that will identify the process instance
+     * @param request the request
+     * @param injectedVariables optional variables to inject into the process
+     * @param serviceInstantiationModel indicates whether this method is being invoked for a flow that is designed using
+     *        the service instantiation model
+     * @return a variable map
+     */
+    private Map<String, Object> createVariables(String schemaVersion, String businessKey, String request,
+            Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
 
-		@Override
-		public String getPrefix(String uri) {
-			return uriMap.get(uri);
-		}
-	}
+        Map<String, Object> variables = new HashMap<>();
 
-	/**
-	 * A VnfNotify XPathTool.
-	 */
-	protected class VnfNotifyXPathTool extends XPathTool {
-		public VnfNotifyXPathTool() {
-			addNamespace("tns", "http://org.onap.so/vnfNotify");
-		}
-	}
+        // These variables may be overridded by injected variables.
+        variables.put("mso-service-request-timeout", "180");
+        variables.put("isDebugLogEnabled", "true");
 
-	/**
-	 * Helper class to make it easier to create this type.
-	 */
-	private static class CreateVnfNotificationOutputs
-			extends CreateVnfNotification.Outputs {
-		public void add(String key, String value) {
-			Entry entry = new Entry();
-			entry.setKey(key);
-			entry.setValue(value);
-			getEntry().add(entry);
-		}
-	}
+        // These variables may not be overridded by injected variables.
+        String[] notAllowed = new String[] {"mso-schema-version", "mso-business-key", "bpmnRequest", "mso-request-id",
+                "mso-service-instance-id"};
 
-	/**
-	 * Helper class to make it easier to create this type.
-	 */
-	private static class UpdateVnfNotificationOutputs
-			extends UpdateVnfNotification.Outputs {
-		public void add(String key, String value) {
-			Entry entry = new Entry();
-			entry.setKey(key);
-			entry.setValue(value);
-			getEntry().add(entry);
-		}
-	}
+        if (injectedVariables != null) {
+            for (String key : injectedVariables.keySet()) {
+                for (String var : notAllowed) {
+                    if (var.equals(key)) {
+                        String msg = "Cannot specify " + var + " in injected variables";
+                        logger.debug(msg);
+                        fail(msg);
+                    }
+                }
+
+                variables.put(key, injectedVariables.get(key));
+            }
+        }
+
+        variables.put("mso-schema-version", schemaVersion);
+        variables.put("mso-business-key", businessKey);
+        variables.put("bpmnRequest", request);
+
+        if (serviceInstantiationModel) {
+
+            /*
+             * The request ID and the service instance ID are generated for flows that follow the service instantiation
+             * model unless "requestId" and "serviceInstanceId" are injected variables.
+             */
+
+            try {
+                msoRequestId = (String) injectedVariables.get("requestId");
+                variables.put("mso-request-id", msoRequestId);
+                msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+                variables.put("mso-service-instance-id", msoServiceInstanceId);
+            } catch (Exception e) {
+            }
+            if (msoRequestId == null || msoRequestId.trim().equals("")) {
+                logger.debug("No requestId element in injectedVariables");
+                variables.put("mso-request-id", UUID.randomUUID().toString());
+            }
+            if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+                logger.debug("No seviceInstanceId element in injectedVariables");
+                variables.put("mso-service-instance-id", UUID.randomUUID().toString());
+            }
+
+        } else {
+            msoRequestId = getXMLTextElement(request, "request-id");
+
+            if (msoRequestId == null) {
+                // check in injected variables
+                try {
+                    msoRequestId = (String) injectedVariables.get("requestId");
+                } catch (Exception e) {
+                }
+                if (msoRequestId == null || msoRequestId.trim().equals("")) {
+                    String msg = "No request-id element in " + request;
+                    logger.debug(msg);
+                    fail(msg);
+                }
+            }
+
+            variables.put("mso-request-id", msoRequestId);
+
+            // Note: some request types don't have a service-instance-id
+            msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
+
+            if (msoServiceInstanceId != null) {
+                variables.put("mso-service-instance-id", msoServiceInstanceId);
+            }
+        }
+
+        return variables;
+    }
+
+    /**
+     * Private helper method that creates a camunda VariableMapImpl from a simple variable map.
+     * 
+     * @param variables the simple variable map
+     * @return a VariableMap
+     */
+    private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
+        Map<String, Object> wrappedVariables = new HashMap<>();
+
+        for (String key : variables.keySet()) {
+            Object value = variables.get(key);
+            wrappedVariables.put(key, wrapVariableValue(value));
+        }
+
+        VariableMapImpl variableMapImpl = new VariableMapImpl();
+        variableMapImpl.put("variables", wrappedVariables);
+        return variableMapImpl;
+    }
+
+    /**
+     * Private helper method that wraps a variable value for inclusion in a camunda VariableMapImpl.
+     * 
+     * @param value the variable value
+     * @return the wrapped variable
+     */
+    private Map<String, Object> wrapVariableValue(Object value) {
+        HashMap<String, Object> valueMap = new HashMap<>();
+        valueMap.put("value", value);
+        return valueMap;
+    }
+
+    /**
+     * Receives a response from an asynchronous process. Errors are handled with junit assertions and will cause the
+     * test to fail.
+     * 
+     * @param businessKey the process business key
+     * @param asyncResponse the TestAsyncResponse object associated with the test
+     * @param timeout the timeout in milliseconds
+     * @return the WorkflowResponse
+     */
+    protected WorkflowResponse receiveResponse(String businessKey, TestAsyncResponse asyncResponse, long timeout) {
+        logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
+
+        long now = System.currentTimeMillis() + timeout;
+        long endTime = now + timeout;
+
+        while (now <= endTime) {
+            Response response = asyncResponse.getResponse();
+
+            if (response != null) {
+                logger.debug("Received a response from process with business key {}", businessKey);
+
+                Object entity = response.getEntity();
+
+                if (!(entity instanceof WorkflowResponse)) {
+                    String msg = "Response entity is " + (entity == null ? "null" : entity.getClass().getName())
+                            + ", expected WorkflowResponse";
+                    logger.debug(msg);
+                    fail(msg);
+                    return null; // unreachable
+                }
+
+                return (WorkflowResponse) entity;
+            }
+
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                String msg = "Interrupted waiting for a response from process with business key " + businessKey;
+                logger.debug(msg);
+                fail(msg);
+                return null; // unreachable
+            }
+
+            now = System.currentTimeMillis();
+        }
+
+        String msg = "No response received from process with business key " + businessKey + " within " + timeout + "ms";
+        logger.debug(msg);
+        fail("Process with business key " + businessKey + " did not end within 10000ms");
+        return null; // unreachable
+    }
+
+    /**
+     * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+     * keys that identify callback data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     reserve, assign, delete:ERR
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param callbacks an object containing callback data for the program
+     * @param program the program to execute
+     */
+    protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String content = null;
+            String contentType = null;
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No callback defined for '" + action + "' SDNC request";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                contentType = callbackData.getContentType();
+            } else if ("ERR".equals(modifier)) {
+                content =
+                        "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
+                contentType = JSON;
+            } else {
+                String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            if (contentType == null) {
+                // Default for backward compatibility with existing tests.
+                contentType = JSON;
+            }
+
+            if (!injectSDNCRestCallback(contentType, content, 10000)) {
+                fail("Failed to inject SDNC '" + action + "' callback");
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of SDNC '" + action + "' callback");
+            }
+        }
+    }
+
+    /**
+     * Runs a program to inject SDNC events into the test environment. A program is essentially just a list of keys that
+     * identify event data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     event1, event2
+     * </pre>
+     * 
+     * NOTE: Each callback must have a message type associated with it, e.g. "SDNCAEvent". Errors are handled with junit
+     * assertions and will cause the test to fail.
+     * 
+     * @param callbacks an object containing event data for the program
+     * @param program the program to execute
+     */
+    protected void injectSDNCEvents(CallbackSet callbacks, String program) {
+        injectWorkflowMessages(callbacks, program);
+    }
+
+    /**
+     * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+     * keys that identify callback data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     reserve, assign, delete:ERR
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail. Uses the static/default timeout value
+     * for backward compatibility.
+     * 
+     * @param callbacks an object containing callback data for the program
+     * @param program the program to execute
+     */
+    protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+        injectSDNCCallbacks(callbacks, program, timeout);
+    }
+
+    /**
+     * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+     * keys that identify callback data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     reserve, assign, delete:ERR
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param callbacks an object containing callback data for the program
+     * @param program the program to execute
+     * @param timeout a timeout value to wait for the callback
+     */
+    protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String content = null;
+            int respCode = 200;
+            String respMsg = "OK";
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No callback defined for '" + action + "' SDNC request";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                respCode = 200;
+                respMsg = "OK";
+            } else if ("CREATED".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No callback defined for '" + action + "' SDNC request";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                respCode = 201;
+                respMsg = "Created";
+            } else if ("ERR".equals(modifier)) {
+                content =
+                        "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
+                respCode = 500;
+                respMsg = "SERVER ERROR";
+            } else {
+                String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
+                fail("Failed to inject SDNC '" + action + "' callback");
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of SDNC '" + action + "' callback");
+            }
+        }
+    }
+
+    /**
+     * Runs a program to inject VNF adapter REST callback data into the test environment. A program is essentially just
+     * a list of keys that identify callback data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     create, rollback
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param callbacks an object containing callback data for the program
+     * @param program the program to execute
+     */
+    protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String content = null;
+            String contentType = null;
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No callback defined for '" + action + "' VNF REST request";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                contentType = callbackData.getContentType();
+            } else if ("ERR".equals(modifier)) {
+                content = "SIMULATED ERROR FROM VNF ADAPTER";
+                contentType = "text/plain";
+            } else {
+                String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            if (contentType == null) {
+                // Default for backward compatibility with existing tests.
+                contentType = XML;
+            }
+
+            if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
+                fail("Failed to inject VNF REST '" + action + "' callback");
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of VNF REST '" + action + "' callback");
+            }
+        }
+    }
+
+    /**
+     * Runs a program to inject VNF callback data into the test environment. A program is essentially just a list of
+     * keys that identify callback data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     createVnf, deleteVnf
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail.
+     * 
+     * @param callbacks an object containing callback data for the program
+     * @param program the program to execute
+     */
+    protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String content = null;
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No callback defined for '" + action + "' VNF request";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+            } else if ("ERR".equals(modifier)) {
+                String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            } else {
+                String msg = "Invalid VNF program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            boolean injected = false;
+
+            if (content.contains("createVnfNotification")) {
+                injected = injectCreateVNFCallback(content, 10000);
+            } else if (content.contains("deleteVnfNotification")) {
+                injected = injectDeleteVNFCallback(content, 10000);
+            } else if (content.contains("updateVnfNotification")) {
+                injected = injectUpdateVNFCallback(content, 10000);
+            }
+
+            if (!injected) {
+                String msg = "Failed to inject VNF '" + action + "' callback";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of VNF '" + action + "' callback");
+            }
+        }
+    }
+
+    /**
+     * Waits for the number of running processes with the specified process definition key to equal a particular count.
+     * 
+     * @param processKey the process definition key
+     * @param count the desired count
+     * @param timeout the timeout in milliseconds
+     */
+    protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
+        logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
+
+        long now = System.currentTimeMillis() + timeout;
+        long endTime = now + timeout;
+        int last = -1;
+
+        while (now <= endTime) {
+            int actual = runtimeService.createProcessInstanceQuery().processDefinitionKey(processKey).list().size();
+
+            if (actual != last) {
+                logger.debug("There are now {} {} instances", actual, processKey);
+                last = actual;
+            }
+
+            if (actual == count) {
+                return;
+            }
+
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                String msg = "Interrupted waiting for there to be " + count + " " + processKey + " instances";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            now = System.currentTimeMillis();
+        }
+
+        String msg = "Timed out waiting for there to be " + count + " " + processKey + " instances";
+        logger.debug(msg);
+        fail(msg);
+    }
+
+    /**
+     * Waits for the specified process variable to be set.
+     * 
+     * @param processKey the process definition key
+     * @param variable the variable name
+     * @param timeout the timeout in milliseconds
+     * @return the variable value, or null if it cannot be obtained in the specified time
+     */
+    protected Object getProcessVariable(String processKey, String variable, long timeout) {
+
+        logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set");
+
+        long now = System.currentTimeMillis() + timeout;
+        long endTime = now + timeout;
+
+        ProcessInstance processInstance = null;
+        Object value = null;
+
+        while (value == null) {
+            if (now > endTime) {
+                if (processInstance == null) {
+                    logger.debug("Timed out waiting for " + processKey + " to start");
+                } else {
+                    logger.debug("Timed out waiting for " + processKey + "[" + processInstance.getId() + "]." + variable
+                            + " to be set");
+                }
+
+                return null;
+            }
+
+            ProcessInstanceQuery processInstanceQuery = null;
+            if (processInstance == null) {
+                processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey(processKey);
+            }
+
+            if (processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0) {
+                processInstance = processInstanceQuery.singleResult();
+            } else {
+                // TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why
+                // happening and best way to get correct one from list
+                logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
+                        processInstanceQuery.count());
+                List<ProcessInstance> processList = processInstanceQuery.list();
+                processInstance = processList.get((processList.size() - 1));
+            }
+
+
+            if (processInstance != null) {
+                value = runtimeService.getVariable(processInstance.getId(), variable);
+            }
+
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
+                return null;
+            }
+
+            now = System.currentTimeMillis();
+        }
+
+        logger.debug(processKey + "[" + processInstance.getId() + "]." + variable + "=" + value);
+
+        return value;
+    }
+
+    /**
+     * Injects a single SDNC adapter callback request. The specified callback data may contain the placeholder string
+     * ((REQUEST-ID)) which is replaced with the actual SDNC request ID. Note: this is not the requestId in the original
+     * MSO request.
+     * 
+     * @param contentType the HTTP content type for the callback
+     * @param content the content of the callback
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     */
+    protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
+        String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", "SDNCAResponse_CORRELATOR", timeout);
+
+        if (sdncRequestId == null) {
+            sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2", "SDNCAResponse_CORRELATOR", timeout);
+        }
+
+        if (sdncRequestId == null) {
+            return false;
+        }
+
+        content = content.replace("((REQUEST-ID))", sdncRequestId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+        logger.debug("Injecting SDNC adapter callback");
+
+        Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+        logger.debug("Workflow response to SDNC adapter callback: " + response);
+        return true;
+    }
+
+    /**
+     * Injects a single SDNC adapter callback request. The specified callback data may contain the placeholder string
+     * ((REQUEST-ID)) which is replaced with the actual SDNC request ID. Note: this is not the requestId in the original
+     * MSO request.
+     * 
+     * @param content the content of the callback
+     * @param respCode the response code (normally 200)
+     * @param respMsg the response message (normally "OK")
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     */
+    protected boolean injectSDNCCallback(int respCode, String respMsg, String content, long timeout) {
+
+        String sdncRequestId = (String) getProcessVariable("sdncAdapter", "SDNCA_requestId", timeout);
+
+        if (sdncRequestId == null) {
+            return false;
+        }
+
+        content = content.replace("((REQUEST-ID))", sdncRequestId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+        // TODO this needs to be fixed. It is causing double tags and content
+        // Need to parse content before setting below since content includes not just RequestData or modify callback
+        // files to only contain RequestData contents.
+
+        logger.debug("Injecting SDNC adapter callback");
+        CallbackHeader callbackHeader = new CallbackHeader();
+        callbackHeader.setRequestId(sdncRequestId);
+        callbackHeader.setResponseCode(String.valueOf(respCode));
+        callbackHeader.setResponseMessage(respMsg);
+        SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+        sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+        sdncAdapterCallbackRequest.setRequestData(content);
+        SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+        logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
+
+        return true;
+    }
+
+    /**
+     * Injects a single VNF adapter callback request. The specified callback data may contain the placeholder string
+     * ((MESSAGE-ID)) which is replaced with the actual message ID. Note: this is not the requestId in the original MSO
+     * request.
+     * 
+     * @param contentType the HTTP content type for the callback
+     * @param content the content of the callback
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     */
+    protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
+        String messageId = (String) getProcessVariable("vnfAdapterRestV1", "VNFAResponse_CORRELATOR", timeout);
+
+        if (messageId == null) {
+            return false;
+        }
+
+        content = content.replace("((MESSAGE-ID))", messageId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{MESSAGE-ID}}", messageId);
+
+        logger.debug("Injecting VNF adapter callback");
+
+        Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+        logger.debug("Workflow response to VNF adapter callback: {}", response);
+        return true;
+    }
+
+    /**
+     * Injects a Create VNF adapter callback request. The specified callback data may contain the placeholder string
+     * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+     * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+     * 
+     * @param content the content of the callback
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     * @throws JAXBException if the content does not adhere to the schema
+     */
+    protected boolean injectCreateVNFCallback(String content, long timeout) {
+
+        String messageId = (String) getProcessVariable("vnfAdapterCreateV1", "VNFC_messageId", timeout);
+
+        if (messageId == null) {
+            return false;
+        }
+
+        content = content.replace("((MESSAGE-ID))", messageId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{MESSAGE-ID}}", messageId);
+
+        if (content.contains("((REQUEST-ID))")) {
+            content = content.replace("((REQUEST-ID))", msoRequestId);
+            // Deprecated usage. All test code should switch to the (( ... )) syntax.
+            content = content.replace("{{REQUEST-ID}}", msoRequestId);
+        }
+
+        logger.debug("Injecting VNF adapter callback");
+
+        // Is it possible to unmarshal this with JAXB? I couldn't.
+
+        CreateVnfNotification createVnfNotification = new CreateVnfNotification();
+        XPathTool xpathTool = new VnfNotifyXPathTool();
+        xpathTool.setXML(content);
+
+        try {
+            String completed = xpathTool.evaluate("/tns:createVnfNotification/tns:completed/text()");
+            createVnfNotification.setCompleted("true".equals(completed));
+
+            String vnfId = xpathTool.evaluate("/tns:createVnfNotification/tns:vnfId/text()");
+            createVnfNotification.setVnfId(vnfId);
+
+            NodeList entries = (NodeList) xpathTool.evaluate("/tns:createVnfNotification/tns:outputs/tns:entry",
+                    XPathConstants.NODESET);
+
+            CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
+
+            for (int i = 0; i < entries.getLength(); i++) {
+                Node node = entries.item(i);
+
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    Element entry = (Element) node;
+                    String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+                    String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+                    outputs.add(key, value);
+                }
+            }
+
+            createVnfNotification.setOutputs(outputs);
+
+            VnfRollback rollback = new VnfRollback();
+
+            String cloudSiteId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+            rollback.setCloudSiteId(cloudSiteId);
+
+            String cloudOwner = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
+            rollback.setCloudOwner(cloudOwner);
+
+            String requestId =
+                    xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+            String serviceInstanceId = xpathTool
+                    .evaluate("/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+            if (requestId != null || serviceInstanceId != null) {
+                MsoRequest msoRequest = new MsoRequest();
+                msoRequest.setRequestId(requestId);
+                msoRequest.setServiceInstanceId(serviceInstanceId);
+                rollback.setMsoRequest(msoRequest);
+            }
+
+            String tenantCreated =
+                    xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
+            rollback.setTenantCreated("true".equals(tenantCreated));
+
+            String tenantId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
+            rollback.setTenantId(tenantId);
+
+            String vnfCreated = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
+            rollback.setVnfCreated("true".equals(vnfCreated));
+
+            String rollbackVnfId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
+            rollback.setVnfId(rollbackVnfId);
+
+            createVnfNotification.setRollback(rollback);
+
+        } catch (Exception e) {
+            logger.debug("Failed to unmarshal VNF callback content:");
+            logger.debug(content);
+            return false;
+        }
+
+        VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+        notifyService.createVnfNotification(messageId, createVnfNotification.isCompleted(),
+                createVnfNotification.getException(), createVnfNotification.getErrorMessage(),
+                createVnfNotification.getVnfId(), createVnfNotification.getOutputs(),
+                createVnfNotification.getRollback());
+
+        return true;
+    }
+
+    /**
+     * Injects a Delete VNF adapter callback request. The specified callback data may contain the placeholder string
+     * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+     * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+     * 
+     * @param content the content of the callback
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     * @throws JAXBException if the content does not adhere to the schema
+     */
+    protected boolean injectDeleteVNFCallback(String content, long timeout) {
+
+        String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", "VNFDEL_uuid", timeout);
+
+        if (messageId == null) {
+            return false;
+        }
+
+        content = content.replace("((MESSAGE-ID))", messageId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{MESSAGE-ID}}", messageId);
+
+        logger.debug("Injecting VNF adapter delete callback");
+
+        // Is it possible to unmarshal this with JAXB? I couldn't.
+
+        DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
+        XPathTool xpathTool = new VnfNotifyXPathTool();
+        xpathTool.setXML(content);
+
+        try {
+            String completed = xpathTool.evaluate("/tns:deleteVnfNotification/tns:completed/text()");
+            deleteVnfNotification.setCompleted("true".equals(completed));
+            // if notification failure, set the exception and error message
+            if (deleteVnfNotification.isCompleted() == false) {
+                deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
+                deleteVnfNotification
+                        .setErrorMessage(xpathTool.evaluate("/tns:deleteVnfNotification/tns:errorMessage/text()"));
+            }
+
+        } catch (Exception e) {
+            logger.debug("Failed to unmarshal VNF Delete callback content:");
+            logger.debug(content);
+            return false;
+        }
+
+        VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+        notifyService.deleteVnfNotification(messageId, deleteVnfNotification.isCompleted(),
+                deleteVnfNotification.getException(), deleteVnfNotification.getErrorMessage());
+
+        return true;
+    }
+
+    /**
+     * Injects a Update VNF adapter callback request. The specified callback data may contain the placeholder string
+     * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+     * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+     * 
+     * @param content the content of the callback
+     * @param timeout the timeout in milliseconds
+     * @return true if the callback could be injected, false otherwise
+     * @throws JAXBException if the content does not adhere to the schema
+     */
+    protected boolean injectUpdateVNFCallback(String content, long timeout) {
+
+        String messageId = (String) getProcessVariable("vnfAdapterUpdate", "VNFU_messageId", timeout);
+
+        if (messageId == null) {
+            return false;
+        }
+
+        content = content.replace("((MESSAGE-ID))", messageId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{MESSAGE-ID}}", messageId);
+
+        content = content.replace("((REQUEST-ID))", msoRequestId);
+        // Deprecated usage. All test code should switch to the (( ... )) syntax.
+        content = content.replace("{{REQUEST-ID}}", msoRequestId);
+
+        logger.debug("Injecting VNF adapter callback");
+
+        // Is it possible to unmarshal this with JAXB? I couldn't.
+
+        UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
+        XPathTool xpathTool = new VnfNotifyXPathTool();
+        xpathTool.setXML(content);
+
+        try {
+            String completed = xpathTool.evaluate("/tns:updateVnfNotification/tns:completed/text()");
+            updateVnfNotification.setCompleted("true".equals(completed));
+
+            NodeList entries = (NodeList) xpathTool.evaluate("/tns:updateVnfNotification/tns:outputs/tns:entry",
+                    XPathConstants.NODESET);
+
+            UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
+
+            for (int i = 0; i < entries.getLength(); i++) {
+                Node node = entries.item(i);
+
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    Element entry = (Element) node;
+                    String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+                    String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+                    outputs.add(key, value);
+                }
+            }
+
+            updateVnfNotification.setOutputs(outputs);
+
+            VnfRollback rollback = new VnfRollback();
+
+            String cloudSiteId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+            rollback.setCloudSiteId(cloudSiteId);
+
+            String cloudOwner = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
+            rollback.setCloudOwner(cloudOwner);
+
+            String requestId =
+                    xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+            String serviceInstanceId = xpathTool
+                    .evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+            if (requestId != null || serviceInstanceId != null) {
+                MsoRequest msoRequest = new MsoRequest();
+                msoRequest.setRequestId(requestId);
+                msoRequest.setServiceInstanceId(serviceInstanceId);
+                rollback.setMsoRequest(msoRequest);
+            }
+
+            String tenantCreated =
+                    xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
+            rollback.setTenantCreated("true".equals(tenantCreated));
+
+            String tenantId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
+            rollback.setTenantId(tenantId);
+
+            String vnfCreated = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
+            rollback.setVnfCreated("true".equals(vnfCreated));
+
+            String rollbackVnfId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
+            rollback.setVnfId(rollbackVnfId);
+
+            updateVnfNotification.setRollback(rollback);
+
+        } catch (Exception e) {
+            logger.debug("Failed to unmarshal VNF callback content:");
+            logger.debug(content);
+            return false;
+        }
+
+        VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+        notifyService.updateVnfNotification(messageId, updateVnfNotification.isCompleted(),
+                updateVnfNotification.getException(), updateVnfNotification.getErrorMessage(),
+                updateVnfNotification.getOutputs(), updateVnfNotification.getRollback());
+
+        return true;
+    }
+
+    /**
+     * Runs a program to inject workflow messages into the test environment. A program is essentially just a list of
+     * keys that identify event data to be injected, in sequence. An example program:
+     * 
+     * <pre>
+     *     event1, event2
+     * </pre>
+     * 
+     * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
+     * workflow message type associated with it.
+     * 
+     * @param callbacks an object containing event data for the program
+     * @param program the program to execute
+     */
+    protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String messageType = null;
+            String content = null;
+            String contentType = null;
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No '" + action + "' workflow message callback is defined";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                messageType = callbackData.getMessageType();
+
+                if (messageType == null || messageType.trim().equals("")) {
+                    String msg = "No workflow message type is defined in the '" + action + "' callback";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                contentType = callbackData.getContentType();
+            } else {
+                String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
+                fail("Failed to inject '" + action + "' workflow message");
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of '" + action + "' workflow message");
+            }
+        }
+    }
+
+    /**
+     * Injects a workflow message. The specified callback data may contain the placeholder string ((CORRELATOR)) which
+     * is replaced with the actual correlator value.
+     * 
+     * @param contentType the HTTP contentType for the message (possibly null)
+     * @param messageType the message type
+     * @param content the message content (possibly null)
+     * @param timeout the timeout in milliseconds
+     * @return true if the message could be injected, false otherwise
+     */
+    protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
+        String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
+
+        if (correlator == null) {
+            return false;
+        }
+
+        if (content != null) {
+            content = content.replace("((CORRELATOR))", correlator);
+        }
+
+        logger.debug("Injecting " + messageType + " message");
+
+        Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+        logger.debug("Workflow response to {} message: {}", messageType, response);
+        return true;
+    }
+
+    /**
+     * Runs a program to inject sniro workflow messages into the test environment. A program is essentially just a list
+     * of keys that identify event data to be injected, in sequence. For more details, see injectSNIROCallbacks(String
+     * contentType, String messageType, String content, long timeout)
+     *
+     * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
+     * workflow message type associated with it.
+     *
+     * @param callbacks an object containing event data for the program
+     * @param program the program to execute
+     */
+    protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
+
+        String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+        for (String cmd : cmds) {
+            String action = cmd;
+            String modifier = "STD";
+
+            if (cmd.contains(":")) {
+                String[] parts = cmd.split(":");
+                action = parts[0];
+                modifier = parts[1];
+            }
+
+            String messageType = null;
+            String content = null;
+            String contentType = null;
+
+            if ("STD".equals(modifier)) {
+                CallbackData callbackData = callbacks.get(action);
+
+                if (callbackData == null) {
+                    String msg = "No '" + action + "' workflow message callback is defined";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                messageType = callbackData.getMessageType();
+
+                if (messageType == null || messageType.trim().equals("")) {
+                    String msg = "No workflow message type is defined in the '" + action + "' callback";
+                    logger.debug(msg);
+                    fail(msg);
+                }
+
+                content = callbackData.getContent();
+                contentType = callbackData.getContentType();
+            } else {
+                String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
+                fail("Failed to inject '" + action + "' workflow message");
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                fail("Interrupted after injection of '" + action + "' workflow message");
+            }
+        }
+    }
+
+    /**
+     * Injects a sniro workflow message. The specified callback response may contain the placeholder strings
+     * ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) The ((CORRELATOR)) is replaced with the actual correlator value from
+     * the request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId value from the sniro
+     * request. Currently this only works with sniro request that contain only 1 resource.
+     *
+     * @param contentType the HTTP contentType for the message (possibly null)
+     * @param messageType the message type
+     * @param content the message content (possibly null)
+     * @param timeout the timeout in milliseconds
+     * @return true if the message could be injected, false otherwise
+     */
+    protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
+        String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
+
+        if (correlator == null) {
+            return false;
+        }
+        if (content != null) {
+            content = content.replace("((CORRELATOR))", correlator);
+            if (messageType.equalsIgnoreCase("SNIROResponse")) {
+                ServiceDecomposition decomp =
+                        (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
+                List<Resource> resourceList = decomp.getServiceResources();
+                if (resourceList.size() == 1) {
+                    String resourceId = "";
+                    for (Resource resource : resourceList) {
+                        resourceId = resource.getResourceId();
+                    }
+                    String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+                    JSONArray placementArr = null;
+                    try {
+                        placementArr = new JSONArray(homingList);
+                    } catch (Exception e) {
+                        return false;
+                    }
+                    if (placementArr.length() == 1) {
+                        content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+                    }
+                    String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+                    JSONArray licenseArr = null;
+                    try {
+                        licenseArr = new JSONArray(licenseInfoList);
+                    } catch (Exception e) {
+                        return false;
+                    }
+                    if (licenseArr.length() == 1) {
+                        content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+                    }
+                } else {
+                    try {
+                        String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+                        String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+                        JSONArray placementArr = new JSONArray(homingList);
+                        JSONArray licenseArr = new JSONArray(licenseInfoList);
+                        for (Resource resource : resourceList) {
+                            String resourceModuleName = resource.getModelInfo().getModelInstanceName();
+                            String resourceId = resource.getResourceId();
+
+                            for (int i = 0; i < placementArr.length(); i++) {
+                                JSONObject placementObj = placementArr.getJSONObject(i);
+                                String placementModuleName = placementObj.getString("resourceModuleName");
+                                if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
+                                    String placementString = placementObj.toString();
+                                    placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+                                    JSONObject newPlacementObj = new JSONObject(placementString);
+                                    placementArr.put(i, newPlacementObj);
+                                }
+                            }
+
+                            for (int i = 0; i < licenseArr.length(); i++) {
+                                JSONObject licenseObj = licenseArr.getJSONObject(i);
+                                String licenseModuleName = licenseObj.getString("resourceModuleName");
+                                if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
+                                    String licenseString = licenseObj.toString();
+                                    licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+                                    JSONObject newLicenseObj = new JSONObject(licenseString);
+                                    licenseArr.put(i, newLicenseObj);
+                                }
+                            }
+                        }
+                        String newPlacementInfos = placementArr.toString();
+                        String newLicenseInfos = licenseArr.toString();
+                        content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
+                        content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
+                    } catch (Exception e) {
+                        return false;
+                    }
+
+                }
+            }
+        }
+        logger.debug("Injecting " + messageType + " message");
+
+        Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+        logger.debug("Workflow response to {} message: {}", messageType, response);
+        return true;
+    }
+
+
+    /**
+     * Wait for the process to end.
+     * 
+     * @param businessKey the process business key
+     * @param timeout the amount of time to wait, in milliseconds
+     */
+    protected void waitForProcessEnd(String businessKey, long timeout) {
+        logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+        long now = System.currentTimeMillis() + timeout;
+        long endTime = now + timeout;
+
+        while (now <= endTime) {
+            if (isProcessEnded(businessKey)) {
+                logger.debug("Process with business key {} has ended", businessKey);
+                return;
+            }
+
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            now = System.currentTimeMillis();
+        }
+
+        String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+        logger.debug(msg);
+        fail(msg);
+    }
+
+    /**
+     * Wait for the process to end. Must be used when multiple process instances exist with this same business key such
+     * as when its passed to subflows or shared across multiple processes.
+     *
+     * @param businessKey the process business key
+     * @param processName the process definition name
+     * @param timeout the amount of time to wait, in milliseconds
+     * @author cb645j
+     */
+    protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
+        logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+        long now = System.currentTimeMillis() + timeout;
+        long endTime = now + timeout;
+
+        while (now <= endTime) {
+            if (isProcessEnded(businessKey, processName)) {
+                logger.debug("Process with business key {} has ended", businessKey);
+                return;
+            }
+
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+                logger.debug(msg);
+                fail(msg);
+            }
+
+            now = System.currentTimeMillis();
+        }
+
+        String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+        logger.debug(msg);
+        fail(msg);
+    }
+
+    /**
+     * Verifies that the specified historic process variable has the specified value. If the variable does not have the
+     * specified value, the test is failed.
+     *
+     * @param businessKey the process business key
+     * @param variable the variable name
+     * @param value the expected variable value
+     */
+    protected void checkVariable(String businessKey, String variable, Object value) {
+        if (!isProcessEnded(businessKey)) {
+            fail("Cannot get historic variable " + variable + " because process with business key " + businessKey
+                    + " has not ended");
+        }
+
+        Object variableValue = getVariableFromHistory(businessKey, variable);
+        assertEquals(value, variableValue);
+    }
+
+    /**
+     * Checks to see if the specified process is ended.
+     * 
+     * @param businessKey the process business Key
+     * @return true if the process is ended
+     */
+    protected boolean isProcessEnded(String businessKey) {
+        HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+                .processInstanceBusinessKey(businessKey).singleResult();
+        return processInstance != null && processInstance.getEndTime() != null;
+    }
+
+    /**
+     * Checks to see if the specified process is ended.
+     *
+     * @param processInstanceId the process Instance Id
+     * @return true if the process is ended
+     */
+    protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
+        HistoricProcessInstance processInstance =
+                historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+        return processInstance != null && processInstance.getEndTime() != null;
+    }
+
+    /**
+     * Checks to see if the specified process is ended.
+     *
+     * @author cb645j
+     */
+    // TODO combine into 1
+    private boolean isProcessEnded(String businessKey, String processName) {
+        HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+                .processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
+        return processInstance != null && processInstance.getEndTime() != null;
+    }
+
+    /**
+     * Gets a variable value from a historical process instance. The business key must be unique.
+     *
+     * @param businessKey the process business key
+     * @param variableName the variable name
+     * @return the variable value or null if the variable does not exist
+     */
+    protected Object getVariableFromHistory(String businessKey, String variableName) {
+        try {
+            HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+                    .processInstanceBusinessKey(businessKey).singleResult();
+
+            if (processInstance == null) {
+                return null;
+            }
+
+            HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+                    .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+            return v == null ? null : v.getValue();
+        } catch (Exception e) {
+            logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName,
+                    businessKey, e);
+            return null;
+        }
+    }
+
+    /**
+     * Gets a variable value from a process instance based on businessKey and process name. Must be used when multiple
+     * instances exist with the same business key such as when business key is passed to subflows or shared across
+     * multiple processes. This method can obtain variables from mainflows and from subflows.
+     *
+     * @param businessKey the process business key
+     * @param processName the process definition name
+     * @param variableName the variable name
+     * @return the variable value or null if the variable does not exist
+     * @author cb645j
+     */
+    protected Object getVariableFromHistory(String businessKey, String processName, String variableName) {
+        try {
+            HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+                    .processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
+
+            if (processInstance == null) {
+                return null;
+            }
+            HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery()
+                    .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+
+            return variable == null ? null : variable.getValue();
+        } catch (ProcessEngineException e) {
+            logger.debug(
+                    "Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
+                            + "index as a parameter.",
+                    processName, businessKey);
+            return null;
+        } catch (Exception e) {
+            logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+                    variableName, processName, businessKey, e);
+            return null;
+        }
+    }
+
+    /**
+     * Gets the value of a process variable from x instance of y process. Must be used when multiple instances exist
+     * with the same business key AND process name. This method shall be used primarily for obtaining subflow variables
+     * when the business key is passed to the subflow AND the subflow is called multiple times in a given flow.
+     *
+     * @param businessKey the process business key
+     * @param processName the name of the subflow that contains the variable
+     * @param variableName the variable name
+     * @param processInstanceIndex the instance in which the subprocess was called
+     * @return the variable value or null if the variable does not exist
+     * @author cb645j
+     */
+    protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName,
+            String variableName) {
+        try {
+            List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery()
+                    .processInstanceBusinessKey(businessKey).processDefinitionName(processName).list();
+
+            if (processInstanceList == null) {
+                return null;
+            }
+            processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+            HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+            HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery()
+                    .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+
+            return variable == null ? null : variable.getValue();
+        } catch (Exception e) {
+            logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+                    variableName, processName, businessKey, e);
+            return null;
+        }
+    }
+
+
+    /**
+     * Gets the value of a subflow variable from the specified subflow's historical process instance.
+     *
+     * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead
+     *
+     * @param subflowName - the name of the subflow that contains the variable
+     * @param variableName the variable name
+     *
+     * @return the variable value, or null if the variable could not be obtained
+     *
+     */
+    @Deprecated
+    protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
+        try {
+            List<HistoricProcessInstance> processInstanceList =
+                    historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+            if (processInstanceList == null) {
+                return null;
+            }
+
+            processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+            HistoricProcessInstance processInstance = processInstanceList.get(0);
+
+            HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+                    .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+            return v == null ? null : v.getValue();
+        } catch (Exception e) {
+            logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName,
+                    e);
+            return null;
+        }
+    }
+
+    /**
+     * Gets the value of a subflow variable from the subflow's historical process x instance.
+     *
+     * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName)
+     * instead
+     *
+     * @param subflowName - the name of the subflow that contains the variable
+     * @param variableName the variable name
+     * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from
+     *        mainflow)
+     *
+     * @return the variable value, or null if the variable could not be obtained
+     */
+    @Deprecated
+    protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
+        try {
+            List<HistoricProcessInstance> processInstanceList =
+                    historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+            if (processInstanceList == null) {
+                return null;
+            }
+
+            processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+            HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+
+            HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+                    .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+            return v == null ? null : v.getValue();
+        } catch (Exception e) {
+            logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ",
+                    variableName, subflowInstanceIndex, subflowName, e);
+            return null;
+        }
+    }
+
+    /**
+     * Extracts text from an XML element. This method is not namespace aware (namespaces are ignored). The first
+     * matching element is selected.
+     * 
+     * @param xml the XML document or fragment
+     * @param tag the desired element, e.g. "<name>"
+     * @return the element text, or null if the element was not found
+     */
+    protected String getXMLTextElement(String xml, String tag) {
+        xml = removeXMLNamespaces(xml);
+
+        if (!tag.startsWith("<")) {
+            tag = "<" + tag + ">";
+        }
+
+        int start = xml.indexOf(tag);
+
+        if (start == -1) {
+            return null;
+        }
+
+        int end = xml.indexOf('<', start + tag.length());
+
+        if (end == -1) {
+            return null;
+        }
+
+        return xml.substring(start + tag.length(), end);
+    }
+
+    /**
+     * Removes namespace definitions and prefixes from XML, if any.
+     */
+    private String removeXMLNamespaces(String xml) {
+        // remove xmlns declaration
+        xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
+
+        // remove opening tag prefix
+        xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
+
+        // remove closing tags prefix
+        xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
+
+        // remove extra spaces left when xmlns declarations are removed
+        xml = xml.replaceAll("\\s+>", ">");
+
+        return xml;
+    }
+
+    /**
+     * Asserts that two XML documents are semantically equivalent. Differences in whitespace or in namespace usage do
+     * not affect the comparison.
+     * 
+     * @param expected the expected XML
+     * @param actual the XML to test
+     * @throws SAXException
+     * @throws IOException
+     */
+    public static void assertXMLEquals(String expected, String actual) throws SAXException, IOException {
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreAttributeOrder(true);
+        DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
+        List<?> allDifferences = diff.getAllDifferences();
+        assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+    }
+
+    /**
+     * A test implementation of AsynchronousResponse.
+     */
+    public class TestAsyncResponse {
+        Response response = null;
+
+        /**
+         * {@inheritDoc}
+         */
+        public synchronized void setResponse(Response response) {
+            this.response = response;
+        }
+
+        /**
+         * Gets the response.
+         * 
+         * @return the response, or null if none has been produced yet
+         */
+        public synchronized Response getResponse() {
+            return response;
+        }
+    }
+
+    /**
+     * An object that contains callback data for a "program".
+     */
+    public class CallbackSet {
+        private final Map<String, CallbackData> map = new HashMap<>();
+
+        /**
+         * Add untyped callback data to the set.
+         * 
+         * @param action the action with which the data is associated
+         * @param content the callback data
+         */
+        public void put(String action, String content) {
+            map.put(action, new CallbackData(null, null, content));
+        }
+
+        /**
+         * Add callback data to the set.
+         * 
+         * @param action the action with which the data is associated
+         * @param messageType the callback message type
+         * @param content the callback data
+         */
+        public void put(String action, String messageType, String content) {
+            map.put(action, new CallbackData(null, messageType, content));
+        }
+
+        /**
+         * Add callback data to the set.
+         * 
+         * @param action the action with which the data is associated
+         * @param contentType the callback HTTP content type
+         * @param messageType the callback message type
+         * @param content the callback data
+         */
+        public void put(String action, String contentType, String messageType, String content) {
+            map.put(action, new CallbackData(contentType, messageType, content));
+        }
+
+        /**
+         * Retrieve callback data from the set.
+         * 
+         * @param action the action with which the data is associated
+         * @return the callback data, or null if there is none for the specified operation
+         */
+        public CallbackData get(String action) {
+            return map.get(action);
+        }
+    }
+
+    /**
+     * Represents a callback data item.
+     */
+    public class CallbackData {
+        private final String contentType;
+        private final String messageType;
+        private final String content;
+
+        /**
+         * Constructor
+         * 
+         * @param contentType the HTTP content type (optional)
+         * @param messageType the callback message type (optional)
+         * @param content the content
+         */
+        public CallbackData(String contentType, String messageType, String content) {
+            this.contentType = contentType;
+            this.messageType = messageType;
+            this.content = content;
+        }
+
+        /**
+         * Gets the callback HTTP content type, possibly null.
+         */
+        public String getContentType() {
+            return contentType;
+        }
+
+        /**
+         * Gets the callback message type, possibly null.
+         */
+        public String getMessageType() {
+            return messageType;
+        }
+
+        /**
+         * Gets the callback content.
+         */
+        public String getContent() {
+            return content;
+        }
+    }
+
+    /**
+     * A tool for evaluating XPath expressions.
+     */
+    protected class XPathTool {
+        private final DocumentBuilderFactory factory;
+        private final SimpleNamespaceContext context = new SimpleNamespaceContext();
+        private final XPath xpath = XPathFactory.newInstance().newXPath();
+        private String xml = null;
+        private Document doc = null;
+
+        /**
+         * Constructor.
+         */
+        public XPathTool() {
+            factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+            xpath.setNamespaceContext(context);
+        }
+
+        /**
+         * Adds a namespace.
+         * 
+         * @param prefix the namespace prefix
+         * @param uri the namespace uri
+         */
+        public synchronized void addNamespace(String prefix, String uri) {
+            context.add(prefix, uri);
+        }
+
+        /**
+         * Sets the XML content to be operated on.
+         * 
+         * @param xml the XML content
+         */
+        public synchronized void setXML(String xml) {
+            this.xml = xml;
+            this.doc = null;
+        }
+
+        /**
+         * Returns the document object.
+         * 
+         * @return the document object, or null if XML has not been set
+         * @throws SAXException
+         * @throws IOException
+         * @throws ParserConfigurationException
+         */
+        public synchronized Document getDocument() throws ParserConfigurationException, IOException, SAXException {
+            if (xml == null) {
+                return null;
+            }
+
+            buildDocument();
+            return doc;
+        }
+
+        /**
+         * Evaluates the specified XPath expression and returns a string result. This method throws exceptions on error.
+         * 
+         * @param expression the expression
+         * @return the result object
+         * @throws ParserConfigurationException
+         * @throws IOException
+         * @throws SAXException
+         * @throws XPathExpressionException on error
+         */
+        public synchronized String evaluate(String expression)
+                throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
+            return (String) evaluate(expression, XPathConstants.STRING);
+        }
+
+        /**
+         * Evaluates the specified XPath expression. This method throws exceptions on error.
+         * 
+         * @param expression the expression
+         * @param returnType the return type
+         * @return the result object
+         * @throws ParserConfigurationException
+         * @throws IOException
+         * @throws SAXException
+         * @throws XPathExpressionException on error
+         */
+        public synchronized Object evaluate(String expression, QName returnType)
+                throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
+
+            buildDocument();
+            XPathExpression expr = xpath.compile(expression);
+            return expr.evaluate(doc, returnType);
+        }
+
+        /**
+         * Private helper method that builds the document object. Assumes the calling method is synchronized.
+         * 
+         * @throws ParserConfigurationException
+         * @throws IOException
+         * @throws SAXException
+         */
+        private void buildDocument() throws ParserConfigurationException, IOException, SAXException {
+            if (doc == null) {
+                if (xml == null) {
+                    throw new IOException("XML input is null");
+                }
+
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                InputSource source = new InputSource(new StringReader(xml));
+                doc = builder.parse(source);
+            }
+        }
+    }
+
+    /**
+     * A NamespaceContext class based on a Map.
+     */
+    private class SimpleNamespaceContext implements NamespaceContext {
+        private Map<String, String> prefixMap = new HashMap<>();
+        private Map<String, String> uriMap = new HashMap<>();
+
+        public synchronized void add(String prefix, String uri) {
+            prefixMap.put(prefix, uri);
+            uriMap.put(uri, prefix);
+        }
+
+        @Override
+        public synchronized String getNamespaceURI(String prefix) {
+            return prefixMap.get(prefix);
+        }
+
+        @Override
+        public Iterator<String> getPrefixes(String uri) {
+            List<String> list = new ArrayList<>();
+            String prefix = uriMap.get(uri);
+            if (prefix != null) {
+                list.add(prefix);
+            }
+            return list.iterator();
+        }
+
+        @Override
+        public String getPrefix(String uri) {
+            return uriMap.get(uri);
+        }
+    }
+
+    /**
+     * A VnfNotify XPathTool.
+     */
+    protected class VnfNotifyXPathTool extends XPathTool {
+        public VnfNotifyXPathTool() {
+            addNamespace("tns", "http://org.onap.so/vnfNotify");
+        }
+    }
+
+    /**
+     * Helper class to make it easier to create this type.
+     */
+    private static class CreateVnfNotificationOutputs extends CreateVnfNotification.Outputs {
+        public void add(String key, String value) {
+            Entry entry = new Entry();
+            entry.setKey(key);
+            entry.setValue(value);
+            getEntry().add(entry);
+        }
+    }
+
+    /**
+     * Helper class to make it easier to create this type.
+     */
+    private static class UpdateVnfNotificationOutputs extends UpdateVnfNotification.Outputs {
+        public void add(String key, String value) {
+            Entry entry = new Entry();
+            entry.setKey(key);
+            entry.setValue(value);
+            getEntry().add(entry);
+        }
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
index dbad35a..794e772 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
@@ -26,16 +26,15 @@
 import java.lang.annotation.Target;
 
 /**
- * Allows a subclass of WorkflowTest to specify one or more WireMock
- * response transformers.  A transformer must be declared as a public
- * static field in the subclass.  For example:
+ * Allows a subclass of WorkflowTest to specify one or more WireMock response transformers. A transformer must be
+ * declared as a public static field in the subclass. For example:
+ * 
  * <pre>
- *     @WorkflowTestTransformer
- *     public static final ResponseTransformer sdncAdapterMockTransformer =
- *         new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
  * </pre>
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
 public @interface WorkflowTestTransformer {
-}
\ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
index bdc4839..d95a588 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
@@ -20,7 +20,6 @@
 package org.onap.so.bpmn.common.adapter.sdnc;
 
 import static org.junit.Assert.assertEquals;
-
 import org.junit.Before;
 import org.junit.Test;
 
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
index 051107b..c58af6b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
@@ -23,7 +23,6 @@
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
index ff5e18c..62b582e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
@@ -16,20 +16,17 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  * ============LICENSE_END========================================================= 
- */ 
+ */
 
 package org.onap.so.bpmn.common.workflow.service;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import javax.ws.rs.core.Response;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
 import org.junit.Test;
@@ -38,41 +35,41 @@
 
 public class WorkflowAsyncResourceExceptionHandlingTest {
 
-	@Test
-	@Deployment(resources = { "testAsyncResource.bpmn" })
-	public void asyncRequestSuccess() throws InterruptedException {
-		VariableMapImpl variableMap = new VariableMapImpl();
+    @Test
+    @Deployment(resources = {"testAsyncResource.bpmn"})
+    public void asyncRequestSuccess() throws InterruptedException {
+        VariableMapImpl variableMap = new VariableMapImpl();
 
-		Map<String, Object> variableValueType = new HashMap<>();
+        Map<String, Object> variableValueType = new HashMap<>();
 
-		Map<String, Object> requestMsg = new HashMap<>();
-		requestMsg.put("value", "");
-		requestMsg.put("type", "String");
+        Map<String, Object> requestMsg = new HashMap<>();
+        requestMsg.put("value", "");
+        requestMsg.put("type", "String");
 
-		Map<String, Object> msorequestId = new HashMap<>();
-		msorequestId.put("type", "String");
-		msorequestId.put("value",UUID.randomUUID().toString());
+        Map<String, Object> msorequestId = new HashMap<>();
+        msorequestId.put("type", "String");
+        msorequestId.put("value", UUID.randomUUID().toString());
 
-		Map<String, Object> timeout = new HashMap<>();
-		timeout.put("type", "String");
-		timeout.put("value","5");
+        Map<String, Object> timeout = new HashMap<>();
+        timeout.put("type", "String");
+        timeout.put("value", "5");
 
-		variableValueType.put("testAsyncRequestMsg", requestMsg);
-		variableValueType.put("mso-request-id", msorequestId);
-		variableValueType.put("mso-service-request-timeout", timeout);
+        variableValueType.put("testAsyncRequestMsg", requestMsg);
+        variableValueType.put("mso-request-id", msorequestId);
+        variableValueType.put("mso-service-request-timeout", timeout);
 
-		variableMap.put("variables", variableValueType);
-		WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
-		workflowAsyncResource.setProcessor(new WorkflowProcessor());
-		Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
-		assertEquals(500,res.getStatus());
-		WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
-		assertNotNull(workflowResponse);
-		assertEquals(500, workflowResponse.getMessageCode());
-		assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
-		assertEquals("Fail", workflowResponse.getMessage());
+        variableMap.put("variables", variableValueType);
+        WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+        workflowAsyncResource.setProcessor(new WorkflowProcessor());
+        Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+        assertEquals(500, res.getStatus());
+        WorkflowResponse workflowResponse = (WorkflowResponse) res.getEntity();
+        assertNotNull(workflowResponse);
+        assertEquals(500, workflowResponse.getMessageCode());
+        assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+        assertEquals("Fail", workflowResponse.getMessage());
 
 
-	}
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
index 5b5e17c..1c3583d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
@@ -21,5 +21,5 @@
 package org.onap.so.bpmn.infrastructure;
 
 public interface FlakyTests {
-	 /* category marker */ 
+    /* category marker */
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 5cc0281..3734510 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -25,10 +25,8 @@
 import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
 import java.util.HashMap;
 import java.util.Map;
-
 import java.util.UUID;
 import org.assertj.core.api.Assertions;
 import org.assertj.core.data.MapEntry;
@@ -64,25 +62,17 @@
         // given
         variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
         // when
-        ProcessInstance instance = runtimeService
-                .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+        ProcessInstance instance =
+                runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
         assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
         dmaapClientTestImpl.sendMessage();
 
         // then
-        assertThat(instance).isEnded().hasPassedInOrder(
-                "CreateAndActivatePnf_StartEvent",
-                "CheckInputs",
-                "CheckAiiForPnfCorrelationId",
-                "DoesAaiContainInfoAboutPnf",
-                "AaiEntryExists",
-                "InformDmaapClient",
-                "WaitForDmaapPnfReadyNotification",
-                "CreateRelationId",
-                "AaiEntryUpdated"
-        );
-        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
-                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
+        assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+                "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "AaiEntryExists", "InformDmaapClient",
+                "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
+        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+                .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
     }
 
     @Test
@@ -90,26 +80,17 @@
         // given
         variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
         // when
-        ProcessInstance instance = runtimeService
-                .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+        ProcessInstance instance =
+                runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
         assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
         dmaapClientTestImpl.sendMessage();
 
         // then
-        assertThat(instance).isEnded().hasPassedInOrder(
-                "CreateAndActivatePnf_StartEvent",
-                "CheckInputs",
-                "CheckAiiForPnfCorrelationId",
-                "DoesAaiContainInfoAboutPnf",
-                "CreatePnfEntryInAai",
-                "AaiEntryExists",
-                "InformDmaapClient",
-                "WaitForDmaapPnfReadyNotification",
-                "CreateRelationId",
-                "AaiEntryUpdated"
-        );
+        assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+                "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "CreatePnfEntryInAai", "AaiEntryExists",
+                "InformDmaapClient", "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
         Assertions.assertThat(pnfManagementTest.getCreated()).containsOnlyKeys(PnfManagementTestImpl.ID_WITHOUT_ENTRY);
-        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
-                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
+        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+                .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
     }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 6a5f9fa..e7ff69a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -21,7 +21,6 @@
 package org.onap.so.bpmn.infrastructure.pnf.delegate;
 
 import java.util.Objects;
-
 import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
index 8c31a02..65b1962 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -22,26 +17,25 @@
 
 import org.onap.so.BaseIntegrationTest;
 import org.onap.so.bpmn.infrastructure.FlakyTests;
-
 import groovy.lang.Category;
 
 
 @Category(FlakyTests.class)
 public class AbstractTestBase extends BaseIntegrationTest {
-	
-	
-	public static final String CUST = "SDN-ETHERNET-INTERNET";
-	public static final String SVC = "123456789";
-	public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
-	public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
-	public static final String ARID = "arId-1";
-	public static final String ARVERS = "1490627351232";
 
-	public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
-	public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
 
-	public static final String VAR_SUCCESS_IND = "SuccessIndicator";
-	public static final String VAR_WFEX = "SavedWorkflowException1";
-	public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
-	public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
+    public static final String CUST = "SDN-ETHERNET-INTERNET";
+    public static final String SVC = "123456789";
+    public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
+    public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
+    public static final String ARID = "arId-1";
+    public static final String ARVERS = "1490627351232";
+
+    public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
+    public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
+
+    public static final String VAR_SUCCESS_IND = "SuccessIndicator";
+    public static final String VAR_WFEX = "SavedWorkflowException1";
+    public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
+    public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
index aa65474..bdc2487 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -50,12 +45,10 @@
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
 import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
 import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.so.bpmn.common.BPMNUtil;
@@ -65,58 +58,68 @@
 
 public class CreateVcpeResCustServiceIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "CreateVcpeResCustService";
-	private static final String Prefix = "CVRCS_";
-	
-	private final CallbackSet callbacks = new CallbackSet();
-	private final String request;
-	
-	@Before
-	public void init(){
-		BPMNUtil.cleanHistory(processEngine);
-	}
-	
-	public CreateVcpeResCustServiceIT() throws IOException {
+    private static final String PROCNAME = "CreateVcpeResCustService";
+    private static final String Prefix = "CVRCS_";
 
-        callbacks.put("oof", JSON, "oofResponse", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json"));
-		callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
-		callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
-		callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
-		callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
-		callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    private final CallbackSet callbacks = new CallbackSet();
+    private final String request;
 
-		callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml"));
-		callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
-		callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
-		callbacks.put("queryModule", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
-		callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+    @Before
+    public void init() {
+        BPMNUtil.cleanHistory(processEngine);
+    }
 
-		request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
-	}
-	
-	@Test
-	public void testCreateVcpeResCustService_Success() throws Exception {
-		System.out.println("starting:  testCreateVcpeResCustService_Success\n");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-		StubResponseOof.mockOof(wireMockServer);
-		// TODO: the SI should NOT have to be URL-encoded yet again!
-		MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+    public CreateVcpeResCustServiceIT() throws IOException {
+
+        callbacks.put("oof", JSON, "oofResponse",
+                FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json"));
+        callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+        callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+        callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+        callbacks.put("queryTXC",
+                FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
+        callbacks.put("queryBRG",
+                FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+        callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+        callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+        callbacks.put("queryModuleNoVnf",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+        callbacks.put("queryModule",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+        callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+
+        request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
+    }
+
+    @Test
+    public void testCreateVcpeResCustService_Success() throws Exception {
+        System.out.println("starting:  testCreateVcpeResCustService_Success\n");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+        StubResponseOof.mockOof(wireMockServer);
+        // TODO: the SI should NOT have to be URL-encoded yet again!
+        MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
         MockGetGenericVnfByIdWithDepth(wireMockServer, ".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml");
 
-		MockPutGenericVnf(wireMockServer, ".*");
+        MockPutGenericVnf(wireMockServer, ".*");
         MockPatchGenericVnf(wireMockServer, ".*");
 
         MockGetGenericVnfByIdWithPriority(wireMockServer, ".*", ".*", 200, "VfModularity/VfModule-new.xml", 5);
@@ -124,46 +127,52 @@
         MockPutVfModuleIdNoResponse(wireMockServer, ".*", "PCRF", ".*");
         MockPutNetwork(wireMockServer, ".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
 
-		MockGetNetworkPolicyfqdn(wireMockServer, ".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200);
-		MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
+        MockGetNetworkPolicyfqdn(wireMockServer, ".*",
+                "CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200);
+        MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
 
-		mockVNFPost(wireMockServer, "", 202, ".*");
+        mockVNFPost(wireMockServer, "", 202, ".*");
 
-        wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202)));
-		wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
-		wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
-		MockPostRequestDB(wireMockServer);	
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		mockSDNCAdapter(wireMockServer, 200);
-		
-		Map<String, Object> variables = setupVariables();
+        wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules"))
+                .willReturn(aResponse().withStatus(202)));
+        wireMockServer
+                .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+                .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(
+                ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+        MockPostRequestDB(wireMockServer);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        mockSDNCAdapter(wireMockServer, 200);
 
-		String businessKey = UUID.randomUUID().toString();
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        Map<String, Object> variables = setupVariables();
+
+        String businessKey = UUID.randomUUID().toString();
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
         injectWorkflowMessages(callbacks, "oof");
-		// for SI
-		injectSDNCCallbacks(callbacks, "assign");
-		// for TXC
-		injectSDNCCallbacks(callbacks, "assign");
-		injectSDNCCallbacks(callbacks, "create");
-		injectSDNCCallbacks(callbacks, "activate");
-		injectSDNCCallbacks(callbacks, "queryTXC");
+        // for SI
+        injectSDNCCallbacks(callbacks, "assign");
+        // for TXC
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "create");
+        injectSDNCCallbacks(callbacks, "activate");
+        injectSDNCCallbacks(callbacks, "queryTXC");
 
         // For VNF
         injectSDNCCallbacks(callbacks, "assign");
         injectSDNCCallbacks(callbacks, "assign");
         injectSDNCCallbacks(callbacks, "queryModule");
         injectSDNCCallbacks(callbacks, "activate");
-        //VF Module
+        // VF Module
         injectSDNCCallbacks(callbacks, "queryModule");
         injectSDNCCallbacks(callbacks, "assign");
         injectSDNCCallbacks(callbacks, "queryModule");
         injectSDNCCallbacks(callbacks, "queryModule");
-		injectSDNCCallbacks(callbacks, "assign");
-		injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
         injectVNFRestCallbacks(callbacks, "vnfCreate");
         injectSDNCCallbacks(callbacks, "activate");
 
@@ -173,208 +182,233 @@
         injectSDNCCallbacks(callbacks, "activate");
         injectSDNCCallbacks(callbacks, "queryBRG");
 
-		waitForProcessEnd(businessKey, 10000);
+        waitForProcessEnd(businessKey, 10000);
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
-		
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertEquals(null, workflowException);
-		assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
-		assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
-		assertTrue(completionReq.indexOf("source>VID<") >= 0);
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
-	}
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertEquals(null, workflowException);
+        assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+        assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+        assertTrue(completionReq.indexOf("source>VID<") >= 0);
 
-	@Test
-	public void testCreateVcpeResCustService_NoParts() throws Exception {
-		System.out.println("starting: testCreateVcpeResCustService_NoParts\n"  );
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
-		MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-		
-		// TODO: the SI should NOT have to be URL-encoded yet again!
-		MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		
-		// TODO: should these really be PARENT_INST, or should they be INST?
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "VnfsCreatedCount"));
+    }
 
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+    @Test
+    public void testCreateVcpeResCustService_NoParts() throws Exception {
+        System.out.println("starting: testCreateVcpeResCustService_NoParts\n");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+        MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+        // TODO: the SI should NOT have to be URL-encoded yet again!
+        MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+
+        // TODO: should these really be PARENT_INST, or should they be INST?
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
         StubResponseOof.mockOof(wireMockServer);
-        wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
-        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
-        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+        wireMockServer
+                .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+                .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(
+                ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+                        .willReturn(aResponse().withStatus(200)));
         wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
         MockPostRequestDB(wireMockServer);
         mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		Map<String, Object> variables = setupVariables();
 
-		String businessKey = UUID.randomUUID().toString();
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        Map<String, Object> variables = setupVariables();
+
+        String businessKey = UUID.randomUUID().toString();
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
         injectWorkflowMessages(callbacks, "oof");
-		// for SI
-		injectSDNCCallbacks(callbacks, "assign");
-		
-		waitForProcessEnd(businessKey, 10000);
+        // for SI
+        injectSDNCCallbacks(callbacks, "assign");
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        waitForProcessEnd(businessKey, 10000);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
-		
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertEquals(null, workflowException);
-		assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
-		assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
-		assertTrue(completionReq.indexOf("source>VID<") >= 0);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
-	}
-	
-	@Test
-	public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
-		System.out.println("starting:  testCreateVcpeResCustService_Fault_NoRollback\n");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-		
-		// TODO: the SI should NOT have to be URL-encoded yet again!
-		MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		mockSDNCAdapter(wireMockServer, 404);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertEquals(null, workflowException);
+        assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+        assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+        assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+        assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "VnfsCreatedCount"));
+    }
+
+    @Test
+    public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
+        System.out.println("starting:  testCreateVcpeResCustService_Fault_NoRollback\n");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+        // TODO: the SI should NOT have to be URL-encoded yet again!
+        MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+        mockSDNCAdapter(wireMockServer, 404);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
         StubResponseOof.mockOof(wireMockServer);
-        wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
-        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
-        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+        wireMockServer
+                .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+                .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(
+                ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+                        .willReturn(aResponse().withStatus(200)));
         wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
         MockPostRequestDB(wireMockServer);
-		
-		Map<String, Object> variables = setupVariables();
 
-		String businessKey = UUID.randomUUID().toString();
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        Map<String, Object> variables = setupVariables();
+
+        String businessKey = UUID.randomUUID().toString();
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
         injectWorkflowMessages(callbacks, "oof");
-		
-		waitForProcessEnd(businessKey, 100000);
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        waitForProcessEnd(businessKey, 100000);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
-		
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertNotNull(workflowException);
-		
-		BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback");
-		BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback");
-		BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback");
-	}
-	
-	@Test
-	public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
-		System.out.println("starting:  testCreateVcpeResCustService_Fault_Rollback\n");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
-		MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-		
-		// TODO: the SI should NOT have to be URL-encoded yet again!
-		MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-		
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		StubResponseOof.mockOof(wireMockServer);
-		wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
-		wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
-		wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
-		MockPostRequestDB(wireMockServer);
-		String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertNotNull(workflowException);
 
-		Map<String, Object> variables = setupVariables();
+        BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback");
+        BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback");
+        BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback");
+    }
 
-		String businessKey = UUID.randomUUID().toString();
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
+    @Test
+    public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
+        System.out.println("starting:  testCreateVcpeResCustService_Fault_Rollback\n");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+                "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+        MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
 
-		injectWorkflowMessages(callbacks, "oof");
-		// for SI
-		injectSDNCCallbacks(callbacks, "assign");
-		
-		// for TXC
-		injectSDNCCallbacks(callbacks, "assign");
-		injectSDNCCallbacks(callbacks, "create");
-		
-		waitForProcessEnd(businessKey, 10000);
+        // TODO: the SI should NOT have to be URL-encoded yet again!
+        MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+                "GenericFlows/getServiceInstance.xml");
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID,
+                "VCPE/CreateVcpeResCustService/arGetById.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
-		
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertEquals(null, completionReq);
-		assertNotNull(workflowException);
-		
-		BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback");
-	}
-	
-	// *****************
-	// Utility Section
-	// *****************
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-	// Success Scenario
-	private Map<String, Object> setupVariables() {
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("requestId", "testRequestId");
-		variables.put("request-id", "testRequestId");
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("allottedResourceId", ARID);
-		variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S");
-		return variables;
+        StubResponseOof.mockOof(wireMockServer);
+        wireMockServer
+                .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+                .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(
+                ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+                        .willReturn(aResponse().withStatus(200)));
+        wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+        MockPostRequestDB(wireMockServer);
+        String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
 
-	}
+        Map<String, Object> variables = setupVariables();
+
+        String businessKey = UUID.randomUUID().toString();
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
+
+        injectWorkflowMessages(callbacks, "oof");
+        // for SI
+        injectSDNCCallbacks(callbacks, "assign");
+
+        // for TXC
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "create");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
+
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
+
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertEquals(null, completionReq);
+        assertNotNull(workflowException);
+
+        BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback");
+    }
+
+    // *****************
+    // Utility Section
+    // *****************
+
+    // Success Scenario
+    private Map<String, Object> setupVariables() {
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("requestId", "testRequestId");
+        variables.put("request-id", "testRequestId");
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("allottedResourceId", ARID);
+        variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S");
+        return variables;
+
+    }
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
index aaabf59..4a03aa9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -37,255 +32,244 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
 import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.mock.FileUtil;
-
 import com.github.tomakehurst.wiremock.stubbing.Scenario;
 
 public class DeleteVcpeResCustServiceIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DeleteVcpeResCustService";
-	private static final String Prefix = "DVRCS_";
-	private static final String AR_BRG_ID = "ar-brgB";
-	private static final String AR_TXC_ID = "ar-txcA";
+    private static final String PROCNAME = "DeleteVcpeResCustService";
+    private static final String Prefix = "DVRCS_";
+    private static final String AR_BRG_ID = "ar-brgB";
+    private static final String AR_TXC_ID = "ar-txcA";
 
-	private final CallbackSet callbacks = new CallbackSet();
-	private final String request;
+    private final CallbackSet callbacks = new CallbackSet();
+    private final String request;
 
-	public DeleteVcpeResCustServiceIT() throws IOException {
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    public DeleteVcpeResCustServiceIT() throws IOException {
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
 
-		request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
-	}
+        request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+    }
 
-	@Before
-	public void init(){
-		BPMNUtil.cleanHistory(processEngine);
-	}
+    @Before
+    public void init() {
+        BPMNUtil.cleanHistory(processEngine);
+    }
 
-	@Test
-	public void testDeleteVcpeResCustService_Success() throws Exception {
-		logStart();
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+    @Test
+    public void testDeleteVcpeResCustService_Success() throws Exception {
+        logStart();
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
 
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * Seems to be a bug as they
-		 * fail to URL-encode the SI id before performing the query so we'll
-		 * add a stub for that case, too.
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        // TODO: use INST instead of DEC_INST
+        /*
+         * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+         * that case, too.
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
 
-		/*
-		 * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return
-		 * different responses as we traverse through the flow
-		 */
+        /*
+         * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return different responses as we
+         * traverse through the flow
+         */
 
-		// initially, the SI includes the ARs
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
-				.inScenario("SI retrieval")
-				.whenScenarioStateIs(Scenario.STARTED)
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
-				.willSetStateTo("ARs Deleted"));
+        // initially, the SI includes the ARs
+        wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST
+                + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+                        .inScenario("SI retrieval").whenScenarioStateIs(Scenario.STARTED)
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
+                        .willSetStateTo("ARs Deleted"));
 
-		// once the ARs have been deleted, the SI should be empty
-		wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
-				.inScenario("SI retrieval")
-				.whenScenarioStateIs("ARs Deleted")
-				.willReturn(aResponse()
-						.withStatus(200)
-						.withHeader("Content-Type", "text/xml")
-						.withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
+        // once the ARs have been deleted, the SI should be empty
+        wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST
+                + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+                        .inScenario("SI retrieval").whenScenarioStateIs("ARs Deleted")
+                        .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+                                .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
 
-		// for BRG
-		MockQueryAllottedResourceById(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
+        // for BRG
+        MockQueryAllottedResourceById(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID,
+                "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
 
-		// for TXC
-		MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
+        // for TXC
+        MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID,
+                "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
 
-        //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+        // MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
-                .willReturn(aResponse()
-                        .withStatus(200)
-                        .withHeader("Content-Type", "text/xml")
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
                         .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
 
 
-		wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
-				.willReturn(aResponse()
-						.withStatus(204)
-						.withHeader("Content-Type", "text/xml")));
+        wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+                .willReturn(aResponse().withStatus(204).withHeader("Content-Type", "text/xml")));
 
-        MockDeleteServiceInstance(wireMockServer, CUST,SVC,INST,SVC);
+        MockDeleteServiceInstance(wireMockServer, CUST, SVC, INST, SVC);
 
         mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = setupVariables(businessKey);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = setupVariables(businessKey);
 
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
-		// for BRG
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+        // for BRG
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		// for VNF1
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "unassign");
+        // for VNF1
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		// for VNF2
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "unassign");
+        // for VNF2
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		// for TXC
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+        // for TXC
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		// for SI
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
+        // for SI
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
 
-		waitForProcessEnd(businessKey, 70000);
-		assertTrue(isProcessEnded(businessKey));
+        waitForProcessEnd(businessKey, 70000);
+        assertTrue(isProcessEnded(businessKey));
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertNull(workflowException);
-		assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
-		assertTrue(completionReq.contains("<action>DELETE<"));
-		assertTrue(completionReq.contains("<source>VID<"));
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertNull(workflowException);
+        assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+        assertTrue(completionReq.contains("<action>DELETE<"));
+        assertTrue(completionReq.contains("<source>VID<"));
 
-		assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+        assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
 
-		BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
-		logEnd();
-	}
+        BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
+        logEnd();
+    }
 
-	@Test
-	public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
-		logStart();
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+    @Test
+    public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+        logStart();
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
 
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * Seems to be a bug  as they
-		 * fail to URL-encode the SI id before performing the query so we'll
-		 * add a stub for that case, too.
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        // TODO: use INST instead of DEC_INST
+        /*
+         * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+         * that case, too.
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
 
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
 
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = setupVariables(businessKey);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = setupVariables(businessKey);
 
 
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
-		// for SI
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
+        // for SI
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
 
-		waitForProcessEnd(businessKey, 70000);
+        waitForProcessEnd(businessKey, 70000);
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertNull( workflowException);
-		assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
-		assertTrue(completionReq.contains("<action>DELETE<"));
-		assertTrue(completionReq.contains("<source>VID<"));
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertNull(workflowException);
+        assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+        assertTrue(completionReq.contains("<action>DELETE<"));
+        assertTrue(completionReq.contains("<source>VID<"));
 
-		assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+        assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
 
-		BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
-		logEnd();
-	}
+        BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
+        logEnd();
+    }
 
-	@Test
-	public void testDeleteVcpeResCustService_Fault() throws Exception {
-		logStart();
-		MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+    @Test
+    public void testDeleteVcpeResCustService_Fault() throws Exception {
+        logStart();
+        MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
 
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * Seems to be a bug as they
-		 * fail to URL-encode the SI id before performing the query so we'll
-		 * add a stub for that case, too.
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        // TODO: use INST instead of DEC_INST
+        /*
+         * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+         * that case, too.
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
 
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
 
-		// generate failure
-		mockSDNCAdapter(wireMockServer, 404);
+        // generate failure
+        mockSDNCAdapter(wireMockServer, 404);
 
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = setupVariables(businessKey);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = setupVariables(businessKey);
 
-		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+        invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
 
-		waitForProcessEnd(businessKey, 70000);
+        waitForProcessEnd(businessKey, 70000);
 
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
 
-		String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
-		System.out.println("completionReq:\n" + completionReq);
+        String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+        System.out.println("completionReq:\n" + completionReq);
 
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
-		assertNotNull(workflowException);
-		logEnd();
-	}
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+        assertNotNull(workflowException);
+        logEnd();
+    }
 
-	private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
-		Map<String, Object> variables = new HashMap<>();
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("requestId", requestId);
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("sdncVersion", "1802");
-		variables.put("serviceInstanceName", "some-junk-name");
-		return variables;
-	}
+    private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("requestId", requestId);
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("sdncVersion", "1802");
+        variables.put("serviceInstanceName", "some-junk-name");
+        return variables;
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
index da9b45c..291613b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -29,10 +24,8 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
 import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
 import java.util.HashMap;
 import java.util.Map;
-
 import org.junit.Test;
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.mock.FileUtil;
@@ -40,227 +33,223 @@
 
 public class DoCreateAllottedResourceBRGIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoCreateAllottedResourceBRG";
-	private final CallbackSet callbacks = new CallbackSet();
+    private static final String PROCNAME = "DoCreateAllottedResourceBRG";
+    private final CallbackSet callbacks = new CallbackSet();
 
-	public DoCreateAllottedResourceBRGIT() {
-		callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
-		callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
-		callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
-		callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException {
-		logStart();
+    public DoCreateAllottedResourceBRGIT() {
+        callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+        callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+        callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+        callbacks.put("query",
+                FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
+    }
 
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+    @Test
+    public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException {
+        logStart();
 
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables,"testRequestId123");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "assign");
-		injectSDNCCallbacks(callbacks, "create");
-		injectSDNCCallbacks(callbacks, "activate");
-		injectSDNCCallbacks(callbacks, "query");
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
 
-		waitForWorkflowToFinish(processEngine,processId);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNull(workflowException);
-		
-		assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "create");
+        injectSDNCCallbacks(callbacks, "activate");
+        injectSDNCCallbacks(callbacks, "query");
 
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables,"testRequestId124");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		waitForWorkflowToFinish(processEngine,processId);
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNull(workflowException);
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
-		
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertEquals("namefromrequest",
+                BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables,"testRequestId125");
+    @Test
+    public void testDoCreateAllottedResourceBRG_NoSI() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		variables.put("failExists", "false");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId124");
 
-		
-		
-		injectSDNCCallbacks(callbacks, "query");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		waitForWorkflowToFinish(processEngine,processId);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNull( workflowException);
-		
-		assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
 
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables,"testRequestId126");
+    @Test
+    public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId125");
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
-		
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 404);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        variables.put("failExists", "false");
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables,"testRequestId127");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		String processId = invokeSubProcess(PROCNAME, variables);
 
-		waitForWorkflowToFinish(processEngine,processId);
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
+        injectSDNCCallbacks(callbacks, "query");
 
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
+        waitForWorkflowToFinish(processEngine, processId);
 
-	private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failExists", "true");
-		variables.put("disableRollback", "true");
-		variables.put("msoRequestId", requestId);
-		variables.put("mso-request-id", "requestId");
-		variables.put("sourceNetworkId", "snId");
-		variables.put("sourceNetworkRole", "snRole");
-		variables.put("allottedResourceRole", "txc");
-		variables.put("allottedResourceType", "BRG");
-		variables.put("allottedResourceId", ARID);
-		variables.put("vni", "BRG");
-		variables.put("vgmuxBearerIP", "bearerip");
-		variables.put("brgWanMacAddress", "wanmac");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNull(workflowException);
 
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-		
-		variables.put("serviceChainServiceInstanceId", "scsiId");
-		
-		String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
-				"\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
-				"\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
-				"\"modelName\": \"vSAMP12\"," +
-				"\"modelVersion\": \"1.0\"," +
-				"\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
-				"}";
-		variables.put("allottedResourceModelInfo", arModelInfo);
-	}
+        assertEquals("namefromrequest",
+                BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId126");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
+
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 404);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId127");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
+
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
+
+    private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failExists", "true");
+        variables.put("disableRollback", "true");
+        variables.put("msoRequestId", requestId);
+        variables.put("mso-request-id", "requestId");
+        variables.put("sourceNetworkId", "snId");
+        variables.put("sourceNetworkRole", "snRole");
+        variables.put("allottedResourceRole", "txc");
+        variables.put("allottedResourceType", "BRG");
+        variables.put("allottedResourceId", ARID);
+        variables.put("vni", "BRG");
+        variables.put("vgmuxBearerIP", "bearerip");
+        variables.put("brgWanMacAddress", "wanmac");
+
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+        variables.put("serviceChainServiceInstanceId", "scsiId");
+
+        String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\","
+                + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\","
+                + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"vSAMP12\","
+                + "\"modelVersion\": \"1.0\"," + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + "}";
+        variables.put("allottedResourceModelInfo", arModelInfo);
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
index f0d275c..cd7004e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -24,12 +19,10 @@
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.core.RollbackData;
 import org.onap.so.bpmn.mock.FileUtil;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -43,281 +36,295 @@
 
 public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
-	private static final String RbType = "DCARBRG_";
-	private final CallbackSet callbacks = new CallbackSet();
+    private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
+    private static final String RbType = "DCARBRG_";
+    private final CallbackSet callbacks = new CallbackSet();
 
-	public DoCreateAllottedResourceBRGRollbackIT() throws IOException {
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
+    public DoCreateAllottedResourceBRGRollbackIT() throws IOException {
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
         logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
-		
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		rollbackData.put(RbType, "rollbackAAI", "false");
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
-		logStart();
-	    MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		// this will cause "rollbackSDNC" to be set to false
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-	    logEnd();
-	}
+        waitForWorkflowToFinish(processEngine, processId);
 
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
+        rollbackData.put(RbType, "rollbackAAI", "false");
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
 
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "unassign");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		/*
-		 * Note: if assign == false then the flow/script will set
-		 * "skipRollback" to false, which will cause ALL of the SDNC steps
-		 * to be skipped, not just the unassign step.
-		 */
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-	    logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        // this will cause "rollbackSDNC" to be set to false
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
 
-		mockSDNCAdapter(wireMockServer, 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-	    logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		variables.put("rollbackData", "string instead of rollback data");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-	    logEnd();
-	}
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-	private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failNotFound", "true");
-		variables.put("msoRequestId", requestId);
-		variables.put("mso-request-id", "requestId");
-		variables.put("allottedResourceId", ARID);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
 
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-		
-		RollbackData rollbackData = new RollbackData();
+        rollbackData.put(RbType, "rollbackSDNCactivate", "false");
 
-		rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
-		rollbackData.put(RbType, "serviceSubscriptionType", SVC);
-		rollbackData.put(RbType, "disablerollback", "false");
-		rollbackData.put(RbType, "rollbackAAI", "true");
-		rollbackData.put(RbType, "rollbackSDNCassign", "true");
-		rollbackData.put(RbType, "rollbackSDNCactivate", "true");
-		rollbackData.put(RbType, "rollbackSDNCcreate", "true");
-		rollbackData.put(RbType, "aaiARPath", "business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-		
-		rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
-		rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); 
-		rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
-		
-		variables.put("rollbackData",rollbackData);
-		
-		return rollbackData;
-	}
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+        rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "unassign");
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+        /*
+         * Note: if assign == false then the flow/script will set "skipRollback" to false, which will cause ALL of the
+         * SDNC steps to be skipped, not just the unassign step.
+         */
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        mockSDNCAdapter(wireMockServer, 404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
+
+        variables.put("rollbackData", "string instead of rollback data");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failNotFound", "true");
+        variables.put("msoRequestId", requestId);
+        variables.put("mso-request-id", "requestId");
+        variables.put("allottedResourceId", ARID);
+
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+        RollbackData rollbackData = new RollbackData();
+
+        rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+        rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+        rollbackData.put(RbType, "disablerollback", "false");
+        rollbackData.put(RbType, "rollbackAAI", "true");
+        rollbackData.put(RbType, "rollbackSDNCassign", "true");
+        rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+        rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+        rollbackData.put(RbType, "aaiARPath",
+                "business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC
+                        + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/"
+                        + ARID);
+
+        rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
+        rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
+        rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
+
+        variables.put("rollbackData", rollbackData);
+
+        return rollbackData;
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
index 6ecec32..80c3fa1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -31,12 +26,10 @@
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
 import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Ignore;
@@ -46,231 +39,227 @@
 
 public class DoCreateAllottedResourceTXCIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoCreateAllottedResourceTXC";
-	private final CallbackSet callbacks = new CallbackSet();
+    private static final String PROCNAME = "DoCreateAllottedResourceTXC";
+    private final CallbackSet callbacks = new CallbackSet();
 
-	public DoCreateAllottedResourceTXCIT() throws IOException {
-		callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
-		callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
-		callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
-		callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXC_Success() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+    public DoCreateAllottedResourceTXCIT() throws IOException {
+        callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+        callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+        callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+        callbacks.put("query",
+                FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
+    }
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123");
+    @Test
+    public void testDoCreateAllottedResourceTXC_Success() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "assign");
-		injectSDNCCallbacks(callbacks, "create");
-		injectSDNCCallbacks(callbacks, "activate");
-		injectSDNCCallbacks(callbacks, "query");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertEquals(null, workflowException);
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
 
-		assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
-		assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
-		assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123");
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "create");
+        injectSDNCCallbacks(callbacks, "activate");
+        injectSDNCCallbacks(callbacks, "query");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
-		
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123");
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertEquals(null, workflowException);
 
-		variables.put("failExists", "false");
+        assertEquals("namefromrequest",
+                BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni", processId));
+        assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP", processId));
+        assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP", processId));
+        logEnd();
+    }
 
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "query");
+    @Test
+    public void testDoCreateAllottedResourceTXC_NoSI() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		assertEquals(null, workflowException);
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
-		assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
-		assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		waitForWorkflowToFinish(processEngine,processId);
+        Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
-		
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{
-		logStart();
-		// TODO: use INST instead of DEC_INST
-		/*
-		 * should be INST instead of DEC_INST, but AAI utilities appear to
-		 * have a bug in that they don't URL-encode the SI id before using
-		 * it in the query
-		 */
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-		MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-		
-		MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
-		MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-		MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-		mockSDNCAdapter(wireMockServer, 404);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
 
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, "testRequestId123");
+    @Test
+    public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
 
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		assertNotNull(workflowException);
-		
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
-		logEnd();
-	}
+        variables.put("failExists", "false");
 
-	private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
-		// TODO: need all of these?
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failExists", "true");
-		variables.put("disableRollback", "true");
-		variables.put("msoRequestId", requestId);
-		variables.put("mso-request-id", "requestId");
-		variables.put("sourceNetworkId", "snId");
-		variables.put("sourceNetworkRole", "snRole");
-		variables.put("allottedResourceRole", "brg");
-		variables.put("allottedResourceType", "TXC");
-		variables.put("allottedResourceId", ARID);
-		variables.put("brgWanMacAddress", "wanmac");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-		
-		variables.put("serviceChainServiceInstanceId", "scsiId");
-		
-		String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
-				"\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
-				"\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
-				"\"modelName\": \"vSAMP12\"," +
-				"\"modelVersion\": \"1.0\"," +
-				"\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
-				"}";
-		variables.put("allottedResourceModelInfo", arModelInfo);
-	}
+        injectSDNCCallbacks(callbacks, "query");
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        assertEquals(null, workflowException);
+
+        assertEquals("namefromrequest",
+                BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni", processId));
+        assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP", processId));
+        assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
+
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception {
+        logStart();
+        // TODO: use INST instead of DEC_INST
+        /*
+         * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+         * SI id before using it in the query
+         */
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+        MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+        MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+        MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+        MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+        mockSDNCAdapter(wireMockServer, 404);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, "testRequestId123");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        assertNotNull(workflowException);
+
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+        logEnd();
+    }
+
+    private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+        // TODO: need all of these?
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failExists", "true");
+        variables.put("disableRollback", "true");
+        variables.put("msoRequestId", requestId);
+        variables.put("mso-request-id", "requestId");
+        variables.put("sourceNetworkId", "snId");
+        variables.put("sourceNetworkRole", "snRole");
+        variables.put("allottedResourceRole", "brg");
+        variables.put("allottedResourceType", "TXC");
+        variables.put("allottedResourceId", ARID);
+        variables.put("brgWanMacAddress", "wanmac");
+
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+        variables.put("serviceChainServiceInstanceId", "scsiId");
+
+        String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\","
+                + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\","
+                + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"vSAMP12\","
+                + "\"modelVersion\": \"1.0\"," + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + "}";
+        variables.put("allottedResourceModelInfo", arModelInfo);
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
index 4f81a4f..0b64f49 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -24,12 +19,10 @@
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.core.RollbackData;
 import org.onap.so.bpmn.mock.FileUtil;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -43,281 +36,295 @@
 
 public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
-	private static final String RbType = "DCARTXC_";
-	private final CallbackSet callbacks = new CallbackSet();
-	
-	public DoCreateAllottedResourceTXCRollbackIT() throws IOException {
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+    private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
+    private static final String RbType = "DCARTXC_";
+    private final CallbackSet callbacks = new CallbackSet();
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+    public DoCreateAllottedResourceTXCRollbackIT() throws IOException {
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    }
 
-		rollbackData.put(RbType, "rollbackAAI", "false");
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
 
-		// this will cause "rollbackSDNC" to be set to false
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
 
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "unassign");
+        rollbackData.put(RbType, "rollbackAAI", "false");
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		rollbackData.put(RbType, "rollbackSDNCassign", "false");
-		
-		/*
-		 * Note: if assign == false then the flow/script will set
-		 * "skipRollback" to false, which will cause ALL of the SDNC steps
-		 * to be skipped, not just the unassign step.
-		 */
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		mockSDNCAdapter(wireMockServer, 404);
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
-	
-	@Test
-	public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
-		logStart();
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables, businessKey);
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
 
-		variables.put("rollbackData", "string instead of rollback data");
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
+        // this will cause "rollbackSDNC" to be set to false
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
 
-		waitForWorkflowToFinish(processEngine,processId);
-		
-		assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertEquals(null, workflowException);
-		assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
-		assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
-		logEnd();
-	}
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-	private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failNotFound", "true");
-		variables.put("msoRequestId", requestId);
-		variables.put("mso-request-id", "requestId");
-		variables.put("allottedResourceId", ARID);
+        waitForWorkflowToFinish(processEngine, processId);
 
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-		
-		RollbackData rollbackData = new RollbackData();
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
 
-		rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
-		rollbackData.put(RbType, "serviceSubscriptionType", SVC);
-		rollbackData.put(RbType, "disablerollback", "false");
-		rollbackData.put(RbType, "rollbackAAI", "true");
-		rollbackData.put(RbType, "rollbackSDNCassign", "true");
-		rollbackData.put(RbType, "rollbackSDNCactivate", "true");
-		rollbackData.put(RbType, "rollbackSDNCcreate", "true");
-		rollbackData.put(RbType, "aaiARPath", "/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-		
-		rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
-		rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); 
-		rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
-		
-		variables.put("rollbackData",rollbackData);
-		
-		return rollbackData;
-	}
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+        rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+        rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "unassign");
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+        rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+        /*
+         * Note: if assign == false then the flow/script will set "skipRollback" to false, which will cause ALL of the
+         * SDNC steps to be skipped, not just the unassign step.
+         */
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        mockSDNCAdapter(wireMockServer, 404);
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    @Test
+    public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
+        logStart();
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables, businessKey);
+
+        variables.put("rollbackData", "string instead of rollback data");
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        waitForWorkflowToFinish(processEngine, processId);
+
+        assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertEquals(null, workflowException);
+        assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+        assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+        logEnd();
+    }
+
+    private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failNotFound", "true");
+        variables.put("msoRequestId", requestId);
+        variables.put("mso-request-id", "requestId");
+        variables.put("allottedResourceId", ARID);
+
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+        RollbackData rollbackData = new RollbackData();
+
+        rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+        rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+        rollbackData.put(RbType, "disablerollback", "false");
+        rollbackData.put(RbType, "rollbackAAI", "true");
+        rollbackData.put(RbType, "rollbackSDNCassign", "true");
+        rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+        rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+        rollbackData.put(RbType, "aaiARPath",
+                "/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC
+                        + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/"
+                        + ARID);
+
+        rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
+        rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
+        rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil
+                .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
+
+        variables.put("rollbackData", rollbackData);
+
+        return rollbackData;
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
index 42f32b8..e4dc5ad 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -24,11 +19,9 @@
 import org.junit.Test;
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.mock.FileUtil;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-
 import static org.junit.Assert.*;
 import static org.onap.so.bpmn.mock.StubResponseAAI.*;
 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
@@ -37,109 +30,114 @@
 
 public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
-	private final CallbackSet callbacks = new CallbackSet();
-	
-	public DoDeleteAllottedResourceBRGIT() {
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-	}
-	
-	@Test
-	public void testDoDeleteAllottedResourceBRG_Success() {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
-		
-		invokeSubProcess(PROCNAME, businessKey, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+    private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
+    private final CallbackSet callbacks = new CallbackSet();
 
-		waitForProcessEnd(businessKey, 10000);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
-		assertNull(workflowException);
-		logEnd();
-	}
-	
-	@Test
-	public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		String businessKey = UUID.randomUUID().toString();
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
+    public DoDeleteAllottedResourceBRGIT() {
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("deactivateNF",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    }
 
-		variables.put("failNotFound", "false");
-		
-		invokeSubProcess(PROCNAME, businessKey, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivateNF");
+    @Test
+    public void testDoDeleteAllottedResourceBRG_Success() {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		waitForProcessEnd(businessKey, 10000);
-		
-		Assert.assertTrue(isProcessEnded(businessKey));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
-		System.out.println("workflowException:\n" + workflowException);
-		assertNull(workflowException);
-		logEnd();
-	}
-	
-	
-	@Test
-	public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
 
-		mockSDNCAdapter(wireMockServer, 500);
-		
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
+        invokeSubProcess(PROCNAME, businessKey, variables);
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
+        assertNull(workflowException);
+        logEnd();
+    }
+
+    @Test
+    public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
+
+        variables.put("failNotFound", "false");
+
+        invokeSubProcess(PROCNAME, businessKey, variables);
+
+        injectSDNCCallbacks(callbacks, "deactivateNF");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        Assert.assertTrue(isProcessEnded(businessKey));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+        System.out.println("workflowException:\n" + workflowException);
+        assertNull(workflowException);
+        logEnd();
+    }
 
 
-		BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+    @Test
+    public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertNotNull(workflowException);
-		logEnd();
-	}
+        mockSDNCAdapter(wireMockServer, 500);
 
-	private void setVariablesSuccess(Map<String, Object> variables) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failNotFound", "true");
-		variables.put("msoRequestId", "testRequestId1");
-		variables.put("mso-request-id", "requestId");
-		variables.put("allottedResourceId", ARID);
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-	}
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+
+        BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+        Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertNotNull(workflowException);
+        logEnd();
+    }
+
+    private void setVariablesSuccess(Map<String, Object> variables) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failNotFound", "true");
+        variables.put("msoRequestId", "testRequestId1");
+        variables.put("mso-request-id", "requestId");
+        variables.put("allottedResourceId", ARID);
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+    }
 
 }
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
index 13ca58b..106c2f0 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
@@ -1,20 +1,15 @@
 /*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the
+ * specific language governing permissions and limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -24,10 +19,8 @@
 import org.junit.Test;
 import org.onap.so.bpmn.common.BPMNUtil;
 import org.onap.so.bpmn.mock.FileUtil;
-
 import java.util.HashMap;
 import java.util.Map;
-
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.onap.so.bpmn.mock.StubResponseAAI.*;
@@ -37,104 +30,109 @@
 
 public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase {
 
-	private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
-	private final CallbackSet callbacks = new CallbackSet();
-	
-	public DoDeleteAllottedResourceTXCIT() {
-		callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-		callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
-		callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
-		callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-	}
-	
-	@Test
-	public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
-		
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivate");
-		injectSDNCCallbacks(callbacks, "delete");
-		injectSDNCCallbacks(callbacks, "unassign");
+    private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
+    private final CallbackSet callbacks = new CallbackSet();
 
-		BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+    public DoDeleteAllottedResourceTXCIT() {
+        callbacks.put("deactivate",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+        callbacks.put("deactivateNF",
+                FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+        callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+        callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+    }
 
-		Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertNull(workflowException);
-		logEnd();
-	}
-	
-	@Test
-	public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockSDNCAdapter(wireMockServer, 200);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-		
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
+    @Test
+    public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		variables.put("failNotFound", "false");
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
 
-		String processId = invokeSubProcess(PROCNAME, variables);
-		
-		injectSDNCCallbacks(callbacks, "deactivateNF");
+        String processId = invokeSubProcess(PROCNAME, variables);
 
-		BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+        injectSDNCCallbacks(callbacks, "deactivate");
+        injectSDNCCallbacks(callbacks, "delete");
+        injectSDNCCallbacks(callbacks, "unassign");
 
-		Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
-		logEnd();
-	}
-	
-	
-	@Test
-	public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
-		logStart();
-		MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
-		MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
-		MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
-		MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
-		mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+        BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
 
-		mockSDNCAdapter(wireMockServer, 500);
-		
-		Map<String, Object> variables = new HashMap<>();
-		setVariablesSuccess(variables);
+        Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertNull(workflowException);
+        logEnd();
+    }
 
-		String processId = invokeSubProcess(PROCNAME, variables);
+    @Test
+    public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockSDNCAdapter(wireMockServer, 200);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
 
-		BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
 
-		Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
-		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
-		System.out.println("workflowException:\n" + workflowException);
-		assertNotNull(workflowException);
-		logEnd();
-	}
+        variables.put("failNotFound", "false");
 
-	private void setVariablesSuccess(Map<String, Object> variables) {
-		variables.put("isDebugLogEnabled", "true");
-		variables.put("failNotFound", "true");
-		variables.put("msoRequestId", "testRequestId1");
-		variables.put("mso-request-id", "requestId");
-		variables.put("allottedResourceId", ARID);
-		
-		variables.put("serviceInstanceId", DEC_INST);
-		variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-	}
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        injectSDNCCallbacks(callbacks, "deactivateNF");
+
+        BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+        Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+        logEnd();
+    }
+
+
+    @Test
+    public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
+        logStart();
+        MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+        MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+                "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+        MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+        MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+        mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+        mockSDNCAdapter(wireMockServer, 500);
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesSuccess(variables);
+
+        String processId = invokeSubProcess(PROCNAME, variables);
+
+        BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+        Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+        String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+        System.out.println("workflowException:\n" + workflowException);
+        assertNotNull(workflowException);
+        logEnd();
+    }
+
+    private void setVariablesSuccess(Map<String, Object> variables) {
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("failNotFound", "true");
+        variables.put("msoRequestId", "testRequestId1");
+        variables.put("mso-request-id", "requestId");
+        variables.put("allottedResourceId", ARID);
+
+        variables.put("serviceInstanceId", DEC_INST);
+        variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+    }
 
 }
