diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
new file mode 100644
index 0000000..e56b45f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
@@ -0,0 +1,46 @@
+/*
+* ============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
+ * 
+ * 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();
+
+	@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
new file mode 100644
index 0000000..9843a953
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
@@ -0,0 +1,45 @@
+/*
+* ============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
+ * 
+ * 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.BaseTest;
+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";
+
+	@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
new file mode 100644
index 0000000..79bffe4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
@@ -0,0 +1,41 @@
+/*
+* ============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
+ * 
+ * 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);
+		}
+}
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
new file mode 100644
index 0000000..b5511f6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so;
+
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.common.WorkflowTest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration
+@AutoConfigureWireMock(port = 0)
+public abstract class  BaseIntegrationTest extends WorkflowTest {
+	@Autowired
+	BPMNUtil bpmnUtil;
+
+	@Value("${wiremock.server.port}")
+	protected String wiremockPort;
+	
+	@After
+	public void baseAfterTest() {
+		WireMock.reset();
+	}
+}
+
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
new file mode 100644
index 0000000..eee2810
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+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"}
+)
+@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")
+                .build();
+    }
+
+    @Bean(name = "requestTransactionManager")
+    public PlatformTransactionManager transactionManager(
+            @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
new file mode 100644
index 0000000..f65cada
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+import org.junit.runner.RunWith;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses({"**/*IT.class"})
+public class IntegrationTestSuite {
+  // 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
new file mode 100644
index 0000000..5f0722a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -0,0 +1,357 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import 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;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Set of utility methods used for Unit testing
+ *
+ */
+@Component
+public class BPMNUtil {
+
+	private static WorkflowAsyncResource workflowResource;
+	
+	@Autowired
+	public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
+		BPMNUtil.workflowResource = 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;
+	}
+
+	/*
+	@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 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 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
new file mode 100644
index 0000000..470cc22
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
@@ -0,0 +1,183 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+
+/**
+ * Unit test for CompleteMsoProcess.bpmn.
+ */
+
+public class CompleteMsoProcessIT extends BaseIntegrationTest {
+	
+	private void executeFlow(String inputRequestFile) throws InterruptedException {
+		mockUpdateRequestDB(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();
+	}
+
+	@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;
+	}	
+}
+
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
new file mode 100644
index 0000000..0ef856b
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
@@ -0,0 +1,116 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test cases for ConfirmVolumeGroupName.bpmn
+ */
+
+public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest {
+	/**
+	 * Sunny day scenario.
+	 * 
+	 * @throws Exception
+	 */
+	@Test	
+	public void sunnyDay() throws Exception {
+		logStart();
+		MockGetVolumeGroupById("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("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("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
new file mode 100644
index 0000000..af9ab7d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
@@ -0,0 +1,88 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+
+/**
+ * Please describe the ConfirmVolumeGroupTenantTest.java class
+ *
+ */
+
+public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
+
+	@Test	
+	public void testRemoveLayer3Service_success() throws Exception{
+		MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(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);
+
+		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("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(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);
+
+	}
+
+	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
new file mode 100644
index 0000000..fd38ff0
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
@@ -0,0 +1,267 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+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.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+
+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.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for CreateAAIVfModule.bpmn.
+ */
+
+public class CreateAAIVfModuleIT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+	
+	@Test	
+	public void  TestCreateGenericVnfSuccess_200() {
+
+		new MockAAIGenericVnfSearch();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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);
+	}
+
+	@Test	
+	public void  TestCreateVfModuleSuccess_200() {
+		// create Add-on VF Module for existing Generic VNF
+		new MockAAIGenericVnfSearch();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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  TestQueryGenericVnfFailure_5000() {
+		new MockAAIGenericVnfSearch();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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());
+	}
+
+	@Test	
+	public void  TestCreateDupGenericVnfFailure_1002() {
+		new MockAAIGenericVnfSearch();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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();
+		MockAAICreateGenericVnf();
+		MockAAIVfModulePUT(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(){
+		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)));
+		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(boolean isCreate){
+		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)));
+		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")));
+		stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))				
+				.willReturn(aResponse()
+					.withStatus(200)));
+	}
+	
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..6af705f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
@@ -0,0 +1,132 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+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;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn.
+ */
+
+public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest {
+
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleVolumeGroupIT.class);
+
+	/**
+	 * Test the happy path through the flow.
+	 */
+	@Test
+	public void happyPath() throws IOException {
+
+		logStart();
+
+		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+		MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
+		MockPutVfModuleIdNoResponse("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);
+
+		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();
+	}
+
+	/**
+	 * Test the case where the GET to AAI returns a 404.
+	 */
+	@Test
+	public void badGet() throws IOException {
+
+		logStart();
+
+		String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+		MockGetVfModuleId("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());
+
+		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/CreateAAIVfModuleVolumeGroupRequest.xml");
+		MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+		MockPutVfModuleId("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);
+
+		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();
+	}
+}
+
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
new file mode 100644
index 0000000..7acaf44
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
@@ -0,0 +1,95 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit Test for the DecomposeService Flow
+ *
+ */
+
+public class DecomposeServiceIT extends BaseIntegrationTest {
+
+
+	public DecomposeServiceIT() throws IOException {
+
+	}
+
+	@Test	
+	public void testDecomposeService_success() throws Exception{
+		MockGetServiceResourcesCatalogData("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);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		Assert.assertTrue(isProcessEnded(businessKey));
+
+	}
+	
+	//@Test
+	@Test
+	public void testDecomposeService_success_partial() throws Exception{
+		MockGetServiceResourcesCatalogData("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);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		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);
+
+		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
new file mode 100644
index 0000000..27b39ae
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
@@ -0,0 +1,288 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+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.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+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.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for DeleteAAIVfModule.bpmn.
+ */
+
+public class DeleteAAIVfModuleIT extends BaseIntegrationTest {
+	private static final String EOL = "\n";
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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  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;
+
+		new MockAAIGenericVnfSearch();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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();
+		new MockAAIDeleteGenericVnf();
+		new MockAAIDeleteVfModule();
+		
+		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
new file mode 100644
index 0000000..a6d2654
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
@@ -0,0 +1,224 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+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.stubFor;
+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;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for FalloutHandler.bpmn.
+ */
+
+public class FalloutHandlerIT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class);
+	
+	
+	private void setupMocks() {
+		stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter"))
+				.willReturn(aResponse()
+				.withStatus(200)
+				.withHeader("Content-Type", "text/xml")
+				.withBody("<DbTag>Notified</DbTag>")));
+		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")); 
+	}
+
+	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
new file mode 100644
index 0000000..fa8823a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test for GenerateVfModuleName.bpmn.
+ */
+
+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;
+
+		MockGetGenericVnfById(".*", "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/GenericGetServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java
new file mode 100644
index 0000000..38d05fe
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java
@@ -0,0 +1,560 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceSubscription;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+
+/**
+ * Unit Test for the GenericGetService Sub Flow
+ */
+
+public class GenericGetServiceIT extends BaseIntegrationTest {
+
+
+	@Test
+	public void testGenericGetService_success_serviceInstance() throws Exception{
+		MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertEquals(null, workflowException);
+	}
+
+
+	@Test
+	
+	public void testGenericGetService_success_serviceSubscription() throws Exception{
+
+		MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstance_byName() throws Exception{
+
+		MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
+		MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("true", byName);
+		assertNotNull(response);
+		assertEquals("200", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstance_byId() throws Exception{
+
+		MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+		MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertEquals("200", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstance_404Response() throws Exception{
+
+		MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceSubscription404() throws Exception{
+		MockGetServiceSubscription("SDN-ETHERNET-INTERNET", "1604-MVM-26", 404);
+		
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstanceByName404() throws Exception{
+
+		MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("true", byName);
+		assertEquals("404", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstanceById404() throws Exception{
+
+		MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals("404", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{
+
+		MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{
+		MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
+		
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("true", byName);
+		assertEquals("200", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{
+
+	        MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals("200", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+
+	@Test
+	
+	public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.,workStep=*]";
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.,workStep=*]";
+
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{
+
+		MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{
+
+		MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("false", byName);
+		assertEquals("500", siUrlResponseCode);
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+	@Test
+	
+	public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{
+
+		MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("true", obtainUrl);
+		assertEquals("true", byName);
+		assertEquals("500", siUrlResponseCode);
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+    @Test
+    
+    public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{
+
+        MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
+        MockGetServiceInstance("AbcBank", "ABC-ST", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+        Map<String, Object> variables = new HashMap<>();
+        setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null);
+
+        String processId = invokeSubProcess( "GenericGetService", variables);
+        
+
+        String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+        String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+        String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
+        String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+        String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+        String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+        assertEquals("true", successIndicator);
+        assertEquals("true", found);
+		assertNotNull(resourceLink);
+        assertNotNull(response);
+        assertEquals("200", siUrlResponseCode);
+        assertEquals(null, workflowException);
+    }
+
+	@Test
+	
+	public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{
+
+		MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
+		MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
+
+		String processId = invokeSubProcess( "GenericGetService", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+		String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+		String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("false", found);
+		assertEquals(null, resourceLink);
+		assertEquals("  ", response);
+		assertEquals("200", siUrlResponseCode);
+		assertEquals(null, workflowException);
+	}
+
+	private void setVariablesInstance(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
+		variables.put("isDebugLogEnabled", "true");
+		variables.put("GENGS_serviceInstanceId", siId);
+		variables.put("GENGS_serviceInstanceName", siName);
+		variables.put("GENGS_globalCustomerId",globalCustId);
+		variables.put("GENGS_serviceType", serviceType);
+		variables.put("GENGS_type", "service-instance");
+		variables.put("mso-request-id", UUID.randomUUID().toString());
+	}
+
+	private void setVariablesSubscription(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
+		variables.put("isDebugLogEnabled", "true");
+		variables.put("GENGS_serviceInstanceId", siId);
+		variables.put("GENGS_serviceInstanceName", siName);
+		variables.put("GENGS_globalCustomerId",globalCustId);
+		variables.put("GENGS_serviceType", serviceType);
+		variables.put("GENGS_type", "service-subscription");
+		variables.put("mso-request-id", UUID.randomUUID().toString());
+	}
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java
new file mode 100644
index 0000000..10c0640
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java
@@ -0,0 +1,190 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVceById;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Please describe the GenericGetVnfTest.java class
+ *
+ */
+
+public class GenericGetVnfIT extends BaseIntegrationTest {
+
+	@Test
+	
+	public void testGenericGetVnf_success_genericVnf() throws Exception{
+		MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
+
+		String processId = invokeSubProcess(  "GenericGetVnf", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+		String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertNotNull(vnf);
+		assertEquals(null, workflowException);
+
+	}
+
+	@Test
+	
+	public void testGenericGetVnf_success_vce() throws Exception{
+		MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables, "testVnfId123", "testVnfName123", "vce");
+
+		String processId = invokeSubProcess(  "GenericGetVnf", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+		String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("false", byName);
+		assertNotNull(response);
+		assertNotNull(vnf);
+		assertEquals(null, workflowException);
+
+	}
+
+	@Test
+	
+	public void testGenericGetVnf_success_genericVnfByName() throws Exception{
+		MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables, "", "testVnfName123", "generic-vnf");
+
+		String processId = invokeSubProcess(  "GenericGetVnf", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+		String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("true", byName);
+		assertNotNull(response);
+		assertNotNull(vnf);
+		assertEquals(null, workflowException);
+
+	}
+
+	@Test
+	
+	public void testGenericGetVnf_success_vceByName() throws Exception{
+		MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables, null, "testVnfName123", "vce");
+
+		String processId = invokeSubProcess(  "GenericGetVnf", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+		String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+		String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+		assertEquals("true", successIndicator);
+		assertEquals("true", found);
+		assertEquals("true", byName);
+		assertNotNull(response);
+		assertNotNull(vnf);
+		assertEquals(null, workflowException);
+
+	}
+
+	
+
+	@Test
+	public void testGenericGetVnf_error_genericVnf500() throws Exception{
+
+		MockGetGenericVnfById_500("testVnfId123_500");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables, "testVnfId123_500", "testVnfId123_500", "generic-vnf");
+
+		String processId = invokeSubProcess(  "GenericGetVnf", variables);
+		
+
+		String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+		String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+		String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+		String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+
+		String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+		assertEquals("false", successIndicator);
+		assertEquals("false", found);
+		assertEquals("false", byName);
+
+		assertEquals(expectedWorkflowException, workflowException);
+	}
+
+	private void setVariables(Map<String, Object> variables, String vnfId, String vnfName, String type) {
+		variables.put("isDebugLogEnabled", "true");
+		variables.put("GENGV_vnfId", vnfId);
+		variables.put("GENGV_vnfName",vnfName);
+		variables.put("GENGV_type", type);
+		variables.put("mso-request-id", UUID.randomUUID().toString());
+	}
+}
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
new file mode 100644
index 0000000..744ef9b
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+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;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for RainyDayHandler.bpmn.
+ */
+public class ManualHandlingIT extends BaseIntegrationTest {
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class);
+	
+	@Test
+	public void  TestManualHandlingSuccess() {
+		MockPostRequestDB();
+		
+		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) {
+
+		}
+
+		TaskService taskService = processEngine.getTaskService();
+
+		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));
+	}
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..819962f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIDeleteGenericVnf {
+	public MockAAIDeleteGenericVnf(){
+		stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+				.willReturn(aResponse()
+						.withStatus(200)));
+		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
new file mode 100644
index 0000000..9cb10a0
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIDeleteVfModule {
+	
+	public MockAAIDeleteVfModule()
+	{
+		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)));
+		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)));
+		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)));
+		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")));
+		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")));
+
+		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
new file mode 100644
index 0000000..b46d528
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
@@ -0,0 +1,340 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIGenericVnfSearch {
+	
+	private static final String EOL = "\n";
+
+	public MockAAIGenericVnfSearch(){
+		String body;
+		
+		// The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+	
+		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")));
+	
+		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")));
+		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;
+		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)));
+		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;
+		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)));
+		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
+	
+		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")));
+	
+		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;
+		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;
+		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;
+		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;
+		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;
+		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
new file mode 100644
index 0000000..6a9ff2a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+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");
+	}
+}
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
new file mode 100644
index 0000000..9bcc559
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -0,0 +1,761 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+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;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.AllottedResource;
+import org.onap.so.bpmn.core.domain.CloudFlavor;
+import org.onap.so.bpmn.core.domain.HomingSolution;
+import org.onap.so.bpmn.core.domain.ModelInfo;
+import org.onap.so.bpmn.core.domain.NetworkResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.domain.ServiceInstance;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.mock.FileUtil;
+
+
+/**
+ * Test the OOF Homing subflow building block.
+ */
+@Ignore
+public class OofHomingIT extends BaseIntegrationTest {
+
+    ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+    String subscriber = "";
+    String subscriber2 = "";
+
+    private final CallbackSet callbacks = new CallbackSet();
+
+    public OofHomingIT() throws IOException {
+        String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf.json");
+        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");
+
+        callbacks.put("oof", JSON, "oofResponse", oofCallback);
+        callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
+        callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
+        callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
+        callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
+        callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
+
+        // Service Model
+        ModelInfo sModel = new ModelInfo();
+        sModel.setModelCustomizationName("testModelCustomizationName");
+        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.setNfFunction("testARFunctionName");
+        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.setNfFunction("testAR2FunctionName");
+        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.setNfFunction("testVnfFunctionName");
+        ArrayList<CloudFlavor> flavors = new ArrayList<>();
+        CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
+        CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
+        flavors.add(flavor1);
+        flavors.add(flavor2);
+        vnf.getHomingSolution().setFlavors(flavors);
+        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);
+        System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+        serviceDecomposition.setModelInfo(sModel);
+        serviceDecomposition.setAllottedResources(arList);
+        serviceDecomposition.setVnfResources(vnfList);
+        serviceDecomposition.setServiceInstance(si);
+
+        // 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\"}";
+    }
+
+    @Test    
+    public void testHoming_success_2AR1Vnf() throws Exception {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(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");
+        String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+        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+", " ");
+        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\"",
+                "\"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\""),
+                resourceVNFHomingString);
+        assertEquals(verifyOofRequest(), expectedOofRequest);
+    }
+
+    @Test  
+    public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables2(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");
+        String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+        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();
+
+        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+", " ");
+        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\"",
+                "\"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\""),
+                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\""),
+                resourceNetHoming2String);
+        assertEquals(verifyOofRequest(), expectedOofRequest);
+
+    }
+
+    @Test
+    public void testHoming_success_vnfResourceList() throws Exception {
+
+        // Create a Service Decomposition
+        MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4",
+                "/BuildingBlocks/oofCatalogResp.json");
+        String busKey = UUID.randomUUID().toString();
+        Map<String, Object> vars = new HashMap<>();
+        setVariablesForServiceDecomposition(vars, "testRequestId123",
+                "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        invokeSubProcess("DecomposeService", busKey, vars);
+
+        ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+        System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
+        List<VnfResource> vnfResourceList = sd.getVnfResources();
+        vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+        // Invoke Homing
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("homingService", "oof");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", sd);
+        variables.put("subscriberInfo", subscriber2);
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+
+        invokeSubProcess("Homing", businessKey, variables);
+        injectWorkflowMessages(callbacks, "oof3");
+        waitForProcessEnd(businessKey, 10000);
+
+        //Get Variables
+
+        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");
+        System.out.println("resourceVnf is: " + resourceVnf);
+        HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+        String resourceVnfHomingString = resourceVnfHoming.toString();
+        System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString);
+        resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+        System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString);
+
+        assertNull(workflowException);
+
+        //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", ""));
+
+        //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+
+        assertEquals(homingSolutionService("service", "service-instance-01234",
+                "MDTNJ01", "test-resource-id-000","att-aic",
+                "mtmnj1a",
+                "\"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 {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<String, Object>();
+        setVariablesExistingLicense(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "sniro");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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");
+        HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
+        Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+        HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
+        Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+        HomingSolution resourceVNFHoming = (HomingSolution) 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+", " ");
+        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\""),
+                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\""),
+                resourceVNFHomingString);
+        assertEquals(verifyOofRequestExistingLicense(), oofRequest);
+
+    }
+
+    @Test  
+    public void testHoming_error_inputVariable() throws Exception {
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables3(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test  
+    public void testHoming_error_badResponse() throws Exception {
+        mockOof_500();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //Get Variables
+        WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+                "WorkflowException");
+
+        assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
+    }
+
+    @Test   
+    public void testHoming_error_oofNoSolution() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "oofNoSol");
+
+        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);
+    }
+
+    @Test  
+    public void testHoming_error_oofPolicyException() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "oofPolicyEx");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test   
+    public void testHoming_error_oofServiceException() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+        injectWorkflowMessages(callbacks, "oofServiceEx");
+        waitForProcessEnd(businessKey, 10000);
+
+        //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]",
+                workflowException.toString());
+    }
+
+
+    private void setVariables(Map<String, Object> variables) {
+        variables.put("homingService", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+        variables.put("vgMuxInfraModelId", "testArModelUuid");
+        //	variables.put("mso-request-id", "testRequestId");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId123");
+        variables.put("serviceInstanceName", "testServiceName");
+        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.setModelCustomizationName("testModelCustomizationNameNet2");
+        netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+        netModel2.setModelName("testModelNameNet2");
+        netModel2.setModelVersion("testModelVersionNet2");
+        net2.setModelInfo(netModel2);
+        netList.add(net2);
+        serviceDecomposition.setNetworkResources(netList);
+
+        variables.put("homingService", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+        variables.put("vgMuxInfraModelId", "testArModelUuid");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId123");
+        variables.put("serviceInstanceName", "testServiceName");
+        variables.put("serviceDecomposition", serviceDecomposition);
+        variables.put("subscriberInfo", subscriber2);
+    }
+
+    private void setVariables3(Map<String, Object> variables) {
+        variables.put("homingService", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+        variables.put("vgMuxInfraModelId", "testArModelUuid");
+        variables.put("isDebugLogEnabled", "true");
+        //	variables.put("mso-request-id", "testRequestId");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId123");
+        variables.put("serviceInstanceName", "testServiceName");
+        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");
+
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+        variables.put("isDebugLogEnabled", "true");
+        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 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 } }";
+        }
+        return solution;
+    }
+
+    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 } }";
+        } 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 } }";
+        } else {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+                    "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
+                    licenseList +  " ] }, \"rehome\" : false } }";
+        }
+        return solution;
+    }
+
+    private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+        variables.put("homingService", "oof");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", requestId);
+        variables.put("msoRequestId", requestId);
+        variables.put("serviceInstanceId", siId);
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+
+
+        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\":\"" +
+                "\"}}}";
+        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}\"}}";
+        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
new file mode 100644
index 0000000..33e4443
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -0,0 +1,771 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.AllottedResource;
+import org.onap.so.bpmn.core.domain.CloudFlavor;
+import org.onap.so.bpmn.core.domain.HomingSolution;
+import org.onap.so.bpmn.core.domain.ModelInfo;
+import org.onap.so.bpmn.core.domain.NetworkResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.domain.ServiceInstance;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+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;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
+
+
+/**
+ * Test the OOF Homing subflow building block.
+ */
+@Ignore
+public class OofHomingTestIT extends BaseIntegrationTest {
+
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+
+    ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+    String subscriber = "";
+    String subscriber2 = "";
+
+    private final CallbackSet callbacks = new CallbackSet();
+
+    public OofHomingTestIT() throws IOException {
+        String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf");
+        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");
+
+        callbacks.put("oof", JSON, "oofResponse", oofCallback);
+        callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
+        callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
+        callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
+        callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
+        callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
+
+        // Service Model
+        ModelInfo sModel = new ModelInfo();
+        sModel.setModelCustomizationName("testModelCustomizationName");
+        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");
+        ArrayList<CloudFlavor> flavors = new ArrayList<>();
+        CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
+        CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
+        flavors.add(flavor1);
+        flavors.add(flavor2);
+        vnf.getHomingSolution().setFlavors(flavors);
+        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);
+
+        // 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\"}";
+    }
+
+    @Test
+
+    public void testHoming_success_2AR1Vnf() throws Exception {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(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");
+        String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+        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+", " ");
+        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\"",
+                "\"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\""),
+                resourceVNFHomingString);
+        assertEquals(verifyOofRequest(), expectedOofRequest);
+    }
+
+    @Test
+
+    public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables2(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");
+        String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+        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();
+
+        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+", " ");
+        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\"",
+                "\"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\""),
+                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\""),
+                resourceNetHoming2String);
+        assertEquals(verifyOofRequest(), expectedOofRequest);
+
+    }
+
+    @Test
+
+
+    public void testHoming_success_vnfResourceList() throws Exception {
+
+        // Create a Service Decomposition
+        MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4",
+                "/BuildingBlocks/oofCatalogResp.json");
+        String busKey = UUID.randomUUID().toString();
+        Map<String, Object> vars = new HashMap<>();
+        setVariablesForServiceDecomposition(vars, "testRequestId123",
+                "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+        invokeSubProcess("DecomposeService", busKey, vars);
+
+        ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
+                "serviceDecomposition");
+        logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
+        List<VnfResource> vnfResourceList = sd.getVnfResources();
+//logger.debug(" vnfResourceList = " + vnfResourceList);
+        vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+        // Invoke Homing
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("homingService", "oof");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("msoRequestId", "testRequestId");
+        variables.put("serviceInstanceId", "testServiceInstanceId");
+        variables.put("serviceDecomposition", sd);
+        variables.put("subscriberInfo", subscriber2);
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+
+        invokeSubProcess("Homing", businessKey, variables);
+        injectWorkflowMessages(callbacks, "oof3");
+        waitForProcessEnd(businessKey, 10000);
+
+        //Get Variables
+
+        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");
+        logger.debug("resourceVnf is: " + resourceVnf);
+        HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+        String resourceVnfHomingString = resourceVnfHoming.toString();
+        logger.debug("resourceVnfHomingString is: " + resourceVnfHomingString);
+        resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+        logger.debug("Now resourceVnfHomingString is: " + resourceVnfHomingString);
+
+        assertNull(workflowException);
+
+        //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", ""));
+
+        //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+
+        assertEquals(homingSolutionService("service", "service-instance-01234",
+                "MDTNJ01", "test-resource-id-000","att-aic",
+                "mtmnj1a",
+                "\"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 {
+
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<String, Object>();
+        setVariablesExistingLicense(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "sniro");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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");
+        HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
+        Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+        HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
+        Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+        HomingSolution resourceVNFHoming = (HomingSolution) 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+", " ");
+        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\""),
+                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\""),
+                resourceVNFHomingString);
+        assertEquals(verifyOofRequestExistingLicense(), oofRequest);
+
+    }
+
+    @Test
+
+    public void testHoming_error_inputVariable() throws Exception {
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables3(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test
+
+    public void testHoming_error_badResponse() throws Exception {
+        mockOof_500();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test
+
+    public void testHoming_error_oofNoSolution() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "oofNoSol");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test
+
+    public void testHoming_error_oofPolicyException() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "oofPolicyEx");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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());
+    }
+
+    @Test
+
+    public void testHoming_error_oofServiceException() throws Exception {
+        mockOof();
+
+        String businessKey = UUID.randomUUID().toString();
+        Map<String, Object> variables = new HashMap<>();
+        setVariables(variables);
+
+        invokeSubProcess("Homing", businessKey, variables);
+
+        injectWorkflowMessages(callbacks, "oofServiceEx");
+
+        waitForProcessEnd(businessKey, 10000);
+
+        //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]",
+                workflowException.toString());
+    }
+
+
+    private void setVariables(Map<String, Object> variables) {
+        variables.put("homingService", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        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.setModelCustomizationName("testModelCustomizationNameNet2");
+        netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+        netModel2.setModelName("testModelNameNet2");
+        netModel2.setModelVersion("testModelVersionNet2");
+        net2.setModelInfo(netModel2);
+        netList.add(net2);
+        serviceDecomposition.setNetworkResources(netList);
+
+        variables.put("homingService", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        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", "oof");
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+        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");
+
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+        serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+        variables.put("isDebugLogEnabled", "true");
+        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 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 } }";
+        }
+        return solution;
+    }
+
+    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 } }";
+        } 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 } }";
+        } else {
+            solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+                    cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+                    "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
+                    licenseList +  " ] }, \"rehome\" : false } }";
+        }
+        return solution;
+    }
+
+    private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+        variables.put("homingService", "oof");
+        variables.put("isDebugLogEnabled", "true");
+        variables.put("mso-request-id", requestId);
+        variables.put("msoRequestId", requestId);
+        variables.put("serviceInstanceId", siId);
+        HashMap customerLocation = new HashMap<String, Object>();
+        customerLocation.put("customerLatitude", "32.89748");
+        customerLocation.put("customerLongitude", "-97.040443");
+        customerLocation.put("customerName", "xyz");
+        variables.put("customerLatitude", "32.89748");
+        variables.put("customerLongitude", "-97.040443");
+        variables.put("customerName", "xyz");
+        variables.put("customerLocation", customerLocation);
+        variables.put("cloudOwner", "amazon");
+        variables.put("cloudRegionId", "TNZED");
+
+
+        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\":\"\"}}]}}";
+        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}\"}}";
+        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
new file mode 100644
index 0000000..b8ae341
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
@@ -0,0 +1,208 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for PrepareUpdateAAIVfModule.bpmn.
+ */
+
+public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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("skask", 1, "VfModularity/GenericVnf.xml");
+		MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+		MockPatchVfModuleId("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("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("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("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("skask", 1, "VfModularity/GenericVnf.xml");
+		MockAAIVfModuleBadPatch("/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
new file mode 100644
index 0000000..7b85edf
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
@@ -0,0 +1,69 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+
+/**
+ * Unit test for RainyDayHandler.bpmn.
+ */
+
+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();
+		
+		
+		String businessKey = UUID.randomUUID().toString();
+		invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		Assert.assertTrue(isProcessEnded(businessKey));
+		
+	}
+
+	
+	
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..7f3e884
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
@@ -0,0 +1,145 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+ 
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+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;
+import org.onap.so.bpmn.common.WorkflowTest;
+import org.onap.so.bpmn.common.WorkflowTest.CallbackSet;
+import org.onap.so.bpmn.core.WorkflowException;
+
+/**
+ * Unit tests for SDNCAdapterRestV1.
+ */
+@Ignore
+public class ReceiveWorkflowMessageTest extends WorkflowTest {
+
+	private static final String EOL = "\n";
+
+	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);
+
+		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 {
+
+		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");
+
+		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"));
+
+		logEnd();
+	}
+
+	/**
+	 * Test the timeout scenario.
+	 */
+	@Test
+	@Deployment(resources = {
+		"subprocess/ReceiveWorkflowMessage.bpmn"
+		})
+	public void timeout() throws Exception {
+
+		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");
+
+		invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+
+		// No injection
+
+		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"));
+
+		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
new file mode 100644
index 0000000..dc5c36f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+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;
+import org.junit.runners.model.Statement;
+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:
+ * <pre>
+ *     @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";
+
+	private final ProcessEngineServices processEngineServices;
+	private final String endpointUrl;
+
+	public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+		this(processEngineServices, DEFAULT_ENDPOINT_URL);
+	}
+
+	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;
+
+				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.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
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
new file mode 100644
index 0000000..baf41d1
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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.stubFor;
+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;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for SDNCAdapterRestV2.bpmn.
+ *
+ * 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();
+
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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);
+	}
+
+	/**
+	 * 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"));
+
+		invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
+
+		injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+		// First non-final response will have done a notification
+		Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+		Assert.assertNotNull(interimNotification);
+
+		injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+		// Second non-final response will not have done a notification
+		interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+		Assert.assertNull(interimNotification);
+
+		injectSDNCRestCallbacks(callbacks, "final");
+
+		interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+		Assert.assertNull(interimNotification);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		Assert.assertTrue(isProcessEnded(businessKey));
+
+		logEnd();
+	}
+
+	/**
+	 * Defines WireMock stubs needed by these tests.
+	 */
+	private void mocks() {
+		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
new file mode 100644
index 0000000..9239889
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.dmaap.DmaapProperties;
+import org.onap.so.client.dmaap.DmaapPropertiesLoader;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+
+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);
+	}
+	
+}
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
new file mode 100644
index 0000000..f780b69
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
@@ -0,0 +1,549 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+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;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.*;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+
+/**
+ * Test the SNIRO Homing subflow building block.
+ */
+@Ignore
+public class SniroHomingV1IT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SniroHomingV1IT.class);
+	
+
+	ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+	String subscriber = "";
+	String subscriber2 = "";
+
+	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);
+
+		// 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);
+
+		// 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\"}";
+	}
+
+	@Test
+	 // 1802 merge
+	
+	public void testHoming_success_2AR1Vnf() throws Exception {
+
+		mockSNIRO();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		injectWorkflowMessages(callbacks, "sniro");
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//Get Variables
+		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+		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+", "");
+
+		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);
+
+	}
+
+	@Test
+	 // 1802 merge
+	
+	public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+		mockSNIRO();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables2(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		injectWorkflowMessages(callbacks, "sniro2");
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//Get Variables
+		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+		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();
+
+		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+", "");
+
+		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);
+	}
+
+	@Test
+	 // 1802 merge
+	
+	public void testHoming_success_vnfResourceList() throws Exception {
+
+		// Create a Service Decomposition 
+		MockGetServiceResourcesCatalogDataByModelUuid("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);
+
+		ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+		List<VnfResource> vnfResourceList = sd.getVnfResources();
+		vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+		// Invoke Homing
+
+		mockSNIRO();
+
+		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);
+
+		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", "att-aic", "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();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<String, Object>();
+		setVariablesExistingLicense(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		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");
+
+		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+", "");
+
+		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);
+
+	}
+
+
+	@Test
+	
+	public void testHoming_error_inputVariable() throws Exception {
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables3(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//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());
+	}
+
+	@Test
+	
+	public void testHoming_error_badResponse() throws Exception {
+		mockSNIRO_500();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//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());
+	}
+
+	@Test
+	 // 1802 merge
+	
+	public void testHoming_error_sniroNoSolution() throws Exception {
+		mockSNIRO();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		injectWorkflowMessages(callbacks, "sniroNoSol");
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//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());
+	}
+
+	@Test
+	
+	public void testHoming_error_sniroPolicyException() throws Exception {
+		mockSNIRO();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		injectWorkflowMessages(callbacks, "sniroPolicyEx");
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//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());
+	}
+
+	@Test
+	
+	public void testHoming_error_sniroServiceException() throws Exception {
+		mockSNIRO();
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		setVariables(variables);
+
+		invokeSubProcess("Homing", businessKey, variables);
+
+		injectWorkflowMessages(callbacks, "sniroServiceEx");
+
+		waitForProcessEnd(businessKey, 10000);
+
+		//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());
+	}
+
+
+
+	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);
+
+		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 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");
+
+		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 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);
+
+		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_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
new file mode 100644
index 0000000..e1a265b
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
@@ -0,0 +1,174 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for UpdateAAIGenericVnf bpmn.
+ */
+
+public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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("skask", 1, "VfModularity/GenericVnf.xml");
+		MockPutGenericVnf("/skask", 200);
+		MockPatchGenericVnf("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("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("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("skask", 1, "VfModularity/GenericVnf.xml");
+		MockPutGenericVnf_Bad("skask", 404);
+		MockAAIVfModuleBadPatch("/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
new file mode 100644
index 0000000..3ff2657
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
@@ -0,0 +1,142 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+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;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for UpdateAAIVfModuleTest.bpmn.
+ */
+
+public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
+		MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+		MockPatchVfModuleId("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("/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("/skask/vf-modules/vf-module/supercool");
+		MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
+		MockAAIVfModuleBadPatch("/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
new file mode 100644
index 0000000..fc15e92
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -0,0 +1,386 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
+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;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for VnfAdapterRestV1.
+ */
+
+public class VnfAdapterRestV1IT extends BaseIntegrationTest {
+	
+	MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,VnfAdapterRestV1IT.class);
+	
+
+	private static final String EOL = "\n";
+
+	private final CallbackSet callbacks = new CallbackSet();
+
+	private final String CREATE_VF_MODULE_REQUEST =
+		"<createVfModuleRequest>" + EOL +
+		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + 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 UPDATE_VF_MODULE_REQUEST =
+		"<updateVfModuleRequest>" + EOL +
+		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + 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 String DELETE_VF_MODULE_REQUEST =
+		"<deleteVfModuleRequest>" + EOL +
+		"  <cloudSiteId>cloudSiteId</cloudSiteId>" + 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 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 +
+			"    <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;
+
+	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 +
+			"    <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("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("deleteVfModule",
+			"<deleteVfModuleResponse>" + EOL +
+			"  <vnfId>vnfId</vnfId>" + EOL +
+			"  <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+			"  <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+			"</deleteVfModuleResponse>" + EOL);
+
+		callbacks.put("rollbackVfModule",
+			"<rollbackVfModuleResponse>" + EOL +
+			"  <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+			"  <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
+			"</rollbackVfModuleResponse>" + 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);
+	}
+
+	@Test
+	
+	public void testCreateVfModuleSuccess() throws Exception {
+		logStart();
+
+		mockVNFPost("", 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, "createVfModule");
+		waitForProcessEnd(businessKey, 10000);
+
+		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+		logger.debug("Response:\n" + response);
+		assertTrue(response!=null && response.contains("<createVfModuleResponse>"));
+		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+		logEnd();
+	}
+
+	@Test
+	
+	public void testUpdateVfModuleSuccess() throws Exception {
+		logStart();
+
+		mockVNFPut("/vfModuleId", 202);
+
+		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+		String messageId = requestId + "-" + System.currentTimeMillis();
+		String request = UPDATE_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, "updateVfModule");
+		waitForProcessEnd(businessKey, 10000);
+
+		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+		logger.debug("Response:\n" + response);
+		assertTrue(response.contains("<updateVfModuleResponse>"));
+		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+		logEnd();
+	}
+
+	@Test
+	
+	public void testDeleteVfModuleSuccess() throws Exception {
+		logStart();
+
+		mockVNFDelete("vnfId", "/vfModuleId", 202);
+
+		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+		String messageId = requestId + "-" + System.currentTimeMillis();
+		String request = DELETE_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, "deleteVfModule");
+		waitForProcessEnd(businessKey, 10000);
+
+		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+		logger.debug("Response:\n" + response);
+		assertTrue(response.contains("<deleteVfModuleResponse>"));
+		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+		logEnd();
+	}
+
+	@Test
+	
+	public void testRollbackVfModuleSuccess() throws Exception {
+		logStart();
+
+		mockVNFRollbackDelete("/vfModuleId", 202);
+
+		String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+		String messageId = requestId + "-" + System.currentTimeMillis();
+		String request = ROLLBACK_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, "rollbackVfModule");
+		waitForProcessEnd(businessKey, 10000);
+
+		String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+		logger.debug("Response:\n" + response);
+		assertTrue(response.contains("<rollbackVfModuleResponse>"));
+		assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+		logEnd();
+	}
+
+	@Test
+	
+	public void testCreateVfModuleException() throws Exception {
+		logStart();
+
+		mockVNFPost("", 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
new file mode 100644
index 0000000..a746bbb
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
@@ -0,0 +1,84 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+
+@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>";
+
+		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());
+	}
+
+	private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
+		WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+		VariableMapImpl variableMap = new VariableMapImpl();
+
+		Map<String, Object> variableValueType = new HashMap<>();
+
+		Map<String, Object> requestMsg = new HashMap<>();
+		requestMsg.put("value", request);
+		requestMsg.put("type", "String");
+
+		Map<String, Object> msorequestId = new HashMap<>();
+		msorequestId.put("type", "String");
+		msorequestId.put("value",requestId);
+
+		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);
+
+		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
new file mode 100644
index 0000000..0efecac
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
@@ -0,0 +1,69 @@
+/*- 
+ * ============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 
+ * 
+ * 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========================================================= 
+ */ 
+
+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;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+
+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());
+		
+		
+
+	}
+
+}
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
new file mode 100644
index 0000000..8ebc80c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -0,0 +1,2215 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+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;
+import java.lang.management.RuntimeMXBean;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+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;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+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;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.Rule;
+import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.MsoRequest;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
+import org.onap.so.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+
+/**
+ * A base class for Workflow tests.
+ * <p>
+ * 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();
+ * </pre>
+ */
+
+public abstract class WorkflowTest {
+
+	private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowTest.class);
+
+	//TODO this is not used anymore, can maybe be removed
+	@Rule
+	public ProcessEngineRule processEngineRule;
+
+	@Autowired
+	protected WorkflowResource workflowResourceSync;
+
+	@Autowired
+	protected ProcessEngine processEngine;
+
+	@Autowired
+	protected RuntimeService runtimeService;
+
+	@Autowired
+	protected HistoryService historyService;
+
+	@Autowired
+	private WorkflowAsyncResource workflowResource;
+
+	@Autowired
+	private WorkflowMessageResource workflowMessageResource;
+
+	@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";
+
+
+	/**
+	 * Constructor.
+	 */
+	public WorkflowTest() throws RuntimeException {
+	}
+
+	/**
+	 * The current request ID.  Normally set when an "invoke" method is called.
+	 */
+	protected volatile String msoRequestId = null;
+
+	/**
+	 * The current service instance ID.  Normally set when an "invoke" method
+	 * is called.
+	 */
+	protected volatile String msoServiceInstanceId = null;
+
+	/**
+	 * Logs a test start method.
+	 */
+	protected void logStart() {
+		msoLogger.debug("STARTED TEST");
+	}
+
+	/**
+	 * Logs a test end method.
+	 */
+	protected void logEnd() {
+		msoLogger.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();
+		msoLogger.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";
+			msoLogger.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();
+		msoLogger.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";
+			msoLogger.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();
+		msoLogger.debug("JVM args = " + arguments);
+
+		Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+			request, injectedVariables, false);
+		VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+		msoLogger.debug("Sending " + request + " to " + processKey + " process");
+
+		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();
+		msoLogger.debug("JVM args = " + arguments);
+
+		Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+			request, injectedVariables, serviceInstantiationModel);
+		VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+		msoLogger.debug("Sending " + request + " to " + processKey + " process");
+
+		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";
+						msoLogger.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("")) {
+				msoLogger.debug("No requestId element in injectedVariables");
+				variables.put("mso-request-id", UUID.randomUUID().toString());
+			}
+			if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+				msoLogger.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;
+					msoLogger.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) {
+		msoLogger.debug("Waiting " + timeout + "ms for process with business key " + businessKey
+			+ " to send a response");
+
+		long now = System.currentTimeMillis() + timeout;
+		long endTime = now + timeout;
+
+		while (now <= endTime) {
+			Response response = asyncResponse.getResponse();
+
+			if (response != null) {
+				msoLogger.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";
+					msoLogger.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;
+				msoLogger.debug(msg);
+				fail(msg);
+				return null; // unreachable
+			}
+
+			now = System.currentTimeMillis();
+		}
+
+		String msg = "No response received from process with business key " + businessKey +
+			" within " + timeout + "ms";
+		msoLogger.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";
+					msoLogger.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 + "'";
+				msoLogger.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.
+	 * @param callbacks an object containing callback data for the program
+	 * @param program the program to execute
+	 */
+	protected void injectSDNCCallbacks(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;
+			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";
+					msoLogger.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";
+					msoLogger.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 + "'";
+				msoLogger.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";
+					msoLogger.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 + "'";
+				msoLogger.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";
+					msoLogger.debug(msg);
+					fail(msg);
+				}
+
+				content = callbackData.getContent();
+			} else if ("ERR".equals(modifier)) {
+				String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+				msoLogger.debug(msg);
+				fail(msg);
+			} else {
+				String msg = "Invalid VNF program modifier: '" + modifier + "'";
+				msoLogger.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";
+				msoLogger.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) {
+		msoLogger.debug("Waiting " + timeout + "ms for there to be " + count + " "
+			+ processKey + " instances");
+
+		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) {
+				msoLogger.debug("There are now " + actual + " "
+					+ processKey + " instances");
+				last = actual;
+			}
+
+			if (actual == count) {
+				return;
+			}
+
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				String msg = "Interrupted waiting for there to be " + count + " "
+					+ processKey + " instances";
+				msoLogger.debug(msg);
+				fail(msg);
+			}
+
+			now = System.currentTimeMillis();
+		}
+
+		String msg = "Timed out waiting for there to be " + count + " "
+			+ processKey + " instances";
+		msoLogger.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) {
+
+		msoLogger.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) {
+					msoLogger.debug("Timed out waiting for "
+						+ processKey + " to start");
+				} else {
+					msoLogger.debug("Timed out waiting for "
+						+ processKey + "[" + processInstance.getId()
+						+ "]." + variable + " to be set");
+				}
+
+				return null;
+			}
+
+			if (processInstance == null) {
+				processInstance = runtimeService
+					.createProcessInstanceQuery()
+					.processDefinitionKey(processKey)
+					.singleResult();
+			}
+
+			if (processInstance != null) {
+				value = runtimeService
+					.getVariable(processInstance.getId(), variable);
+			}
+
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				msoLogger.debug("Interrupted waiting for "
+					+ processKey + "." + variable + " to be set");
+				return null;
+			}
+
+			now = System.currentTimeMillis();
+		}
+
+		msoLogger.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) {
+			return false;
+		}
+
+		content = content.replace("((REQUEST-ID))", sdncRequestId);
+		// Deprecated usage.  All test code should switch to the (( ... )) syntax.
+		content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+		msoLogger.debug("Injecting SDNC adapter callback");
+
+		Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+		msoLogger.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.
+
+		msoLogger.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);
+		msoLogger.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);
+
+		msoLogger.debug("Injecting VNF adapter callback");
+
+		Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+		msoLogger.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);
+		}
+
+		msoLogger.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 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) {
+			msoLogger.debug("Failed to unmarshal VNF callback content:");
+			msoLogger.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);
+
+		msoLogger.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) {
+			msoLogger.debug("Failed to unmarshal VNF Delete callback content:");
+			msoLogger.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);
+
+		msoLogger.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 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) {
+			msoLogger.debug("Failed to unmarshal VNF callback content:");
+			msoLogger.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";
+					msoLogger.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";
+					msoLogger.debug(msg);
+					fail(msg);
+				}
+
+				content = callbackData.getContent();
+				contentType = callbackData.getContentType();
+			} else {
+				String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+				msoLogger.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);
+		}
+
+		msoLogger.debug("Injecting " + messageType + " message");
+
+		Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+		msoLogger.debug("Workflow response to " + messageType + " message: " + 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";
+					msoLogger.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";
+					msoLogger.debug(msg);
+					fail(msg);
+				}
+
+				content = callbackData.getContent();
+				contentType = callbackData.getContentType();
+			} else {
+				String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+				msoLogger.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.placement");
+					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;
+					}
+
+				}
+			}
+		}
+		msoLogger.debug("Injecting " + messageType + " message");
+
+		Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+		msoLogger.debug("Workflow response to " + messageType + " message: " + 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) {
+		msoLogger.debug("Waiting " + timeout + "ms for process with business key " +
+			businessKey + " to end");
+
+		long now = System.currentTimeMillis() + timeout;
+		long endTime = now + timeout;
+
+		while (now <= endTime) {
+			if (isProcessEnded(businessKey)) {
+				msoLogger.debug("Process with business key " + businessKey + " has ended");
+				return;
+			}
+
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				String msg = "Interrupted waiting for process with business key " +
+					businessKey + " to end";
+				msoLogger.debug(msg);
+				fail(msg);
+			}
+
+			now = System.currentTimeMillis();
+		}
+
+		String msg = "Process with business key " + businessKey +
+			" did not end within " + timeout + "ms";
+		msoLogger.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) {
+		msoLogger.debug("Waiting " + timeout + "ms for process with business key " +
+			businessKey + " to end");
+
+		long now = System.currentTimeMillis() + timeout;
+		long endTime = now + timeout;
+
+		while (now <= endTime) {
+			if (isProcessEnded(businessKey, processName)) {
+				msoLogger.debug("Process with business key " + businessKey + " has ended");
+				return;
+			}
+
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				String msg = "Interrupted waiting for process with business key " +
+					businessKey + " to end";
+				msoLogger.debug(msg);
+				fail(msg);
+			}
+
+			now = System.currentTimeMillis();
+		}
+
+		String msg = "Process with business key " + businessKey +
+			" did not end within " + timeout + "ms";
+		msoLogger.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.
+<<<<<<< HEAD:bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+	 * @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.
+=======
+>>>>>>> origin/release/1806.51:bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
+	 * @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) {
+			msoLogger.debug("Error retrieving variable " + variableName +
+				" from historical process with business key " + 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){
+			msoLogger.debug("Multiple proccess instances exist with process name " + processName + " and business key " + businessKey + ". Must pass instance index as a parameter.");
+			return null;
+		}catch(Exception e){
+			msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + 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) {
+			msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + 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) {
+			msoLogger.debug("Error retrieving variable " + variableName +
+					" from sub flow: " + subflowName + ", Exception is: " + 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) {
+			msoLogger.debug("Error retrieving variable " + variableName +
+				" from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + 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
new file mode 100644
index 0000000..dbad35a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+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:
+ * <pre>
+ *     @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/infrastructure/FlakyTests.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
new file mode 100644
index 0000000..5b5e17c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure;
+
+public interface FlakyTests {
+	 /* category marker */ 
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
new file mode 100644
index 0000000..7cb649d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionTestImpl implements AaiConnection {
+
+    public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp";
+    public static final String ID_WITH_IP_V6 = "idWithIpV6";
+    public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
+    public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp";
+    public static final String DEFAULT_IP = "1.2.3.4";
+    public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
+
+    private Map<String, Pnf> created = new HashMap<>();
+
+    @Override
+    public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+        if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) {
+            Pnf pnf = new Pnf();
+            pnf.setIpaddressV4Oam(DEFAULT_IP);
+            return Optional.of(pnf);
+        } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) {
+            Pnf pnf = new Pnf();
+            pnf.setIpaddressV6Oam(DEFAULT_IP_V6);
+            return Optional.of(pnf);
+        } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) {
+            return Optional.of(new Pnf());
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    @Override
+    public void createEntry(String correlationId, Pnf entry) throws IOException {
+        created.put(correlationId, entry);
+    }
+
+    public Map<String, Pnf> getCreated() {
+        return created;
+    }
+
+    public void reset() {
+        created.clear();
+    }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
new file mode 100644
index 0000000..7df6757
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionThrowingException implements AaiConnection {
+
+    @Override
+    public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+        throw new IOException();
+    }
+
+    @Override
+    public void createEntry(String correlationId, Pnf entry) throws IOException {
+        throw new IOException();
+    }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
new file mode 100644
index 0000000..f5d212f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {CancelDmaapSubscription.class, DmaapClientTestImpl.class})
+public class CancelDmaapSubscriptionTest {
+
+    @Autowired
+    public CancelDmaapSubscription delegate;
+
+    @Autowired
+    private DmaapClientTestImpl dmaapClientTest;
+
+    @Test
+    public void shouldCancelSubscription() throws Exception {
+        // given
+        DelegateExecution delegateExecution = mock(DelegateExecution.class);
+        when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+        when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+        dmaapClientTest.registerForUpdate("testCorrelationId", () -> {});
+        // when
+        delegate.execute(delegateExecution);
+        // then
+        assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse();
+    }
+}
\ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
new file mode 100644
index 0000000..301e5d9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(Enclosed.class)
+public class CheckAaiForCorrelationIdDelegateTest {
+
+    @RunWith(SpringRunner.class)
+    @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class})
+    public static class ConnectionOkTests {
+
+        @Autowired
+        private CheckAaiForCorrelationIdDelegate delegate;
+
+        @Test
+        public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
+            // given
+            DelegateExecution execution = mock(DelegateExecution.class);
+            when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
+            when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
+            // when, then
+            assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+            verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+        }
+
+        @Test
+        public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
+            // given
+            DelegateExecution execution = mock(DelegateExecution.class);
+            when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
+            // when
+            delegate.execute(execution);
+            // then
+            verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false);
+        }
+
+        @Test
+        public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception {
+            shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP);
+        }
+
+        @Test
+        public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception {
+            shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6);
+        }
+
+        private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception {
+            // given
+            DelegateExecution execution = mock(DelegateExecution.class);
+            when(execution.getVariable(CORRELATION_ID)).thenReturn(id);
+            // when
+            delegate.execute(execution);
+            // then
+            verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+            verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true);
+        }
+
+        @Test
+        public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
+            // given
+            DelegateExecution execution = mock(DelegateExecution.class);
+            when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+            // when
+            delegate.execute(execution);
+            // then
+            verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+            verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false);
+        }
+    }
+
+
+    @RunWith(SpringRunner.class)
+    @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class})
+    public static class NoConnectionTests {
+
+        @Autowired
+        private CheckAaiForCorrelationIdDelegate delegate;
+
+        @Test
+        public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception {
+            // given
+            DelegateExecution execution = mock(DelegateExecution.class);
+            when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+            when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
+            // when, then
+            assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+            verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+        }
+    }
+}
\ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
new file mode 100644
index 0000000..465dc08
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.onap.aai.domain.yang.Pnf;
+
+public class CreateAaiEntryWithPnfIdDelegateTest {
+
+    @Test
+    public void shouldSetPnfIdAndPnfName() throws Exception {
+        // given
+        CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate();
+        AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
+        delegate.setAaiConnection(aaiConnection);
+        DelegateExecution execution = mock(DelegateExecution.class);
+        when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId");
+        // when
+        delegate.execute(execution);
+        // then
+        Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId");
+        assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId");
+        assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
+        assertThat(createdEntry.isInMaint()).isTrue();
+    }
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..9c8f19f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+import java.util.Objects;
+
+public class DmaapClientTestImpl implements DmaapClient {
+
+    private String correlationId;
+    private Runnable informConsumer;
+
+    @Override
+    public void registerForUpdate(String correlationId, Runnable informConsumer) {
+        this.correlationId = correlationId;
+        this.informConsumer = informConsumer;
+    }
+
+    @Override
+    public Runnable unregister(String correlationId) {
+        if (Objects.equals(this.correlationId, correlationId)) {
+            this.correlationId = null;
+            Runnable informConsumer = this.informConsumer;
+            this.informConsumer = null;
+            return informConsumer;
+        }
+        return null;
+    }
+
+    public String getCorrelationId() {
+        return correlationId;
+    }
+
+    public Runnable getInformConsumer() {
+        return informConsumer;
+    }
+
+    public boolean haveRegisteredConsumer() {
+        return correlationId != null;
+    }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
new file mode 100644
index 0000000..168cd69
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class})
+public class InformDmaapClientTest {
+
+    @Autowired
+    private InformDmaapClient informDmaapClient;
+
+    @Autowired
+    private DmaapClientTestImpl dmaapClientTest;
+
+    private DelegateExecution delegateExecution;
+
+    private MessageCorrelationBuilder messageCorrelationBuilder;
+
+    @Test
+    public void shouldSendListenerToDmaapClient() throws Exception {
+        // given
+        mockDelegateExecution();
+        // when
+        informDmaapClient.execute(delegateExecution);
+        // then
+        assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+        assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
+        verifyZeroInteractions(messageCorrelationBuilder);
+    }
+
+    @Test
+    public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
+        // given
+        mockDelegateExecution();
+        // when
+        informDmaapClient.execute(delegateExecution);
+        dmaapClientTest.getInformConsumer().run();
+        // then
+        assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+        InOrder inOrder = inOrder(messageCorrelationBuilder);
+        inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
+        inOrder.verify(messageCorrelationBuilder).correlateWithResult();
+    }
+
+    private void mockDelegateExecution() {
+        delegateExecution = mock(DelegateExecution.class);
+        when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+        when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+        ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
+        when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+        RuntimeService runtimeService = mock(RuntimeService.class);
+        when(processEngineServices.getRuntimeService()).thenReturn(runtimeService);
+        messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
+        when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
+        when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
+    }
+}
\ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
new file mode 100644
index 0000000..aab289f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PnfCheckInputsTest {
+
+    private PnfCheckInputs delegate;
+
+    @Before
+    public void setUp() throws Exception {
+        delegate = new PnfCheckInputs();
+    }
+
+    private DelegateExecution mockDelegateExecution() {
+        DelegateExecution delegateExecution = mock(DelegateExecution.class);
+        when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
+        return delegateExecution;
+    }
+
+    @Test
+    public void shouldThrowException_whenPnfIdNotSet() throws Exception {
+        // given
+        DelegateExecution delegateExecution = mockDelegateExecution();
+        // when, then
+        assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+    }
+
+    private DelegateExecution mockDelegateExecutionWithCorrelationId() {
+        DelegateExecution delegateExecution = mockDelegateExecution();
+        when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId");
+        return delegateExecution;
+    }
+
+    @Test
+    public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception {
+        // given
+        DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
+        // when, then
+        assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+    }
+
+    @Test
+    public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception {
+        // given
+        String defaultTimeout = "T1D";
+        delegate.setDefaultTimeout(defaultTimeout);
+        DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
+        // when
+        delegate.execute(delegateExecution);
+        // then
+        verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout));
+    }
+}
\ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
new file mode 100644
index 0000000..7c4c820
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
@@ -0,0 +1,150 @@
+/*-
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate.bpmn;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml")
+@Ignore
+public class CreateAndActivatePnfResourceTest {
+
+    private static final String TIMEOUT_10_S = "PT10S";
+    @Autowired
+    private RuntimeService runtimeService;
+
+    @Autowired
+    @Rule
+    public ProcessEngineRule processEngineRule;
+
+    @Autowired
+    private AaiConnectionTestImpl aaiConnection;
+
+    @Test
+    @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+    public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception {
+        // given
+        aaiConnection.reset();
+        BpmnAwareTests.init(processEngineRule.getProcessEngine());
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+        variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP);
+        // when
+        ProcessInstance instance = runtimeService
+                .startProcessInstanceByKey("CreateAndActivatePnfResource", variables);
+        // then
+        assertThat(instance).isEnded().hasPassedInOrder(
+                "CreateAndActivatePnf_StartEvent",
+                "CheckAiiForCorrelationId",
+                "DoesAaiContainInfoAboutPnf",
+                "DoesAaiContainInfoAboutIp",
+                "AaiEntryAlreadyUpToDate"
+        );
+    }
+
+    @Test
+    @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+    public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception {
+        // given
+        aaiConnection.reset();
+        BpmnAwareTests.init(processEngineRule.getProcessEngine());
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+        variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP);
+        // when
+        ProcessInstance instance = runtimeService
+                .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+        assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+        runtimeService.createMessageCorrelation("WorkflowMessage")
+                .processInstanceBusinessKey("businessKey")
+                .correlateWithResult();
+        // then
+        assertThat(instance).isEnded().hasPassedInOrder(
+                "CreateAndActivatePnf_StartEvent",
+                "CheckAiiForCorrelationId",
+                "DoesAaiContainInfoAboutPnf",
+                "DoesAaiContainInfoAboutIp",
+                "AaiEntryExists",
+                "InformDmaapClient",
+                "WaitForDmaapPnfReadyNotification",
+                "AaiEntryUpdated"
+        );
+    }
+
+    @Test
+    @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+    public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception {
+        // given
+        aaiConnection.reset();
+        BpmnAwareTests.init(processEngineRule.getProcessEngine());
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+        variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY);
+        // when
+        ProcessInstance instance = runtimeService
+                .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+        assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+        runtimeService.createMessageCorrelation("WorkflowMessage")
+                .processInstanceBusinessKey("businessKey")
+                .correlateWithResult();
+        // then
+        assertThat(instance).isEnded().hasPassedInOrder(
+                "CreateAndActivatePnf_StartEvent",
+                "CheckAiiForCorrelationId",
+                "DoesAaiContainInfoAboutPnf",
+                "CreateAndActivatePnf_CreateAaiEntry",
+                "AaiEntryExists",
+                "InformDmaapClient",
+                "WaitForDmaapPnfReadyNotification",
+                "AaiEntryUpdated"
+        );
+        assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY);
+    }
+
+    private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {
+        return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery()
+                .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list();
+    }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
new file mode 100644
index 0000000..08ac9b6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -0,0 +1,197 @@
+/*-
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.dmaap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
+import org.springframework.core.env.Environment;
+@RunWith(MockitoJUnitRunner.class)
+public class PnfEventReadyDmaapClientTest {
+
+    private static final String CORRELATION_ID = "corrTestId";
+    private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
+    private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
+            + "    {\n"
+            + "        \"pnfRegistrationFields\" : {\n"
+            + "        \"correlationId\" : \"%s\",\n"
+            + "        \"value\" : \"value1\"\n"
+            + "        }\n"
+            + "    },\n"
+            + "    {\n"
+            + "        \"pnfRegistrationFields\" : {\n"
+            + "        \"correlationId\" : \"corr\",\n"
+            + "        \"value\" : \"value2\"\n"
+            + "        }\n"
+            + "    }\n"
+            + "]";
+    private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID =
+            "{\"pnfRegistrationFields\":{\"field\":\"value\"}}";
+
+    private static final String HOST = "hostTest";
+    private static final int PORT = 1234;
+    private static final String PROTOCOL = "http";
+    private static final String URI_PATH_PREFIX = "eventsForTesting";
+    private static final String EVENT_TOPIC_TEST = "eventTopicTest";
+    private static final String CONSUMER_ID = "consumerTestId";
+    private static final String CONSUMER_GROUP = "consumerGroupTest";
+    @Mock
+    private Environment env;
+    @InjectMocks
+    private PnfEventReadyDmaapClient testedObject = new PnfEventReadyDmaapClient();
+;
+    private DmaapTopicListenerThread testedObjectInnerClassThread;
+    private HttpClient httpClientMock;
+    private Runnable threadMockToNotifyCamundaFlow;
+    private ScheduledExecutorService executorMock;
+
+    @Before
+    public void init() throws NoSuchFieldException, IllegalAccessException {
+    	when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
+    	when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
+        testedObject.setDmaapProtocol(PROTOCOL);
+        testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX);
+        testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
+        testedObject.setConsumerId(CONSUMER_ID);
+        testedObject.setConsumerGroup(CONSUMER_GROUP);
+        testedObject.setDmaapClientDelayInSeconds(1);
+        testedObject.init();
+        testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
+        httpClientMock = mock(HttpClient.class);
+        threadMockToNotifyCamundaFlow = mock(Runnable.class);
+        executorMock = mock(ScheduledExecutorService.class);
+        setPrivateField();
+    }
+
+    /**
+     * Test run method, where the are following conditions:
+     * <p> - DmaapThreadListener is running, flag is set to true
+     * <p> - map is filled with one entry with the key that we get from response
+     * <p> run method should invoke thread from map to notify camunda process, remove element from the map (map is
+     * empty) and shutdown the executor because of empty map
+     */
+    @Test
+    public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady()
+            throws IOException {
+        when(httpClientMock.execute(any(HttpGet.class))).
+                thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
+        testedObjectInnerClassThread.run();
+        ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
+        verify(httpClientMock).execute(captor1.capture());
+        assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL)
+                .hasPath(
+                        "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
+        verify(threadMockToNotifyCamundaFlow).run();
+        verify(executorMock).shutdownNow();
+    }
+
+    /**
+     * Test run method, where the are following conditions:
+     * <p> - DmaapThreadListener is running, flag is set to true
+     * <p> - map is filled with one entry with the correlationId that does not match to correlationId
+     * taken from http response. run method should not do anything with the map not run any thread to notify camunda
+     * process
+     */
+    @Test
+    public void correlationIdIsFoundInHttpResponse_NotFoundInMap()
+            throws IOException {
+        when(httpClientMock.execute(any(HttpGet.class))).
+                thenReturn(createResponse(
+                        String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
+        testedObjectInnerClassThread.run();
+        verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
+    }
+
+    /**
+     * Test run method, where the are following conditions:
+     * <p> - DmaapThreadListener is running, flag is set to true
+     * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse
+     * run method should not do anything with the map and not run any thread to notify camunda process
+     */
+    @Test
+    public void correlationIdIsNotFoundInHttpResponse() throws IOException {
+        when(httpClientMock.execute(any(HttpGet.class))).
+                thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
+        testedObjectInnerClassThread.run();
+        verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
+    }
+
+    private void setPrivateField() throws NoSuchFieldException, IllegalAccessException {
+        Field httpClientField = testedObject.getClass().getDeclaredField("httpClient");
+        httpClientField.setAccessible(true);
+        httpClientField.set(testedObject, httpClientMock);
+        httpClientField.setAccessible(false);
+
+        Field executorField = testedObject.getClass().getDeclaredField("executor");
+        executorField.setAccessible(true);
+        executorField.set(testedObject, executorMock);
+        executorField.setAccessible(false);
+
+        Field pnfCorrelationToThreadMapField = testedObject.getClass()
+                .getDeclaredField("pnfCorrelationIdToThreadMap");
+        pnfCorrelationToThreadMapField.setAccessible(true);
+        Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
+        pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow);
+        pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap);
+
+        Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning");
+        threadRunFlag.setAccessible(true);
+        threadRunFlag.set(testedObject, true);
+        threadRunFlag.setAccessible(false);
+    }
+
+    private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
+        HttpEntity entity = new StringEntity(json);
+        ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
+        HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
+        response.setEntity(entity);
+        response.setStatusCode(200);
+        return response;
+    }
+
+}
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
new file mode 100644
index 0000000..8c31a02
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
@@ -0,0 +1,47 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+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";
+}
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
new file mode 100644
index 0000000..6109306
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
@@ -0,0 +1,381 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+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.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetCustomer;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicyfqdn;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetwork;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
+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;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.bpmn.mock.StubResponseOof;
+
+
+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 {
+
+        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("uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+		StubResponseOof.mockOof();
+		// TODO: the SI should NOT have to be URL-encoded yet again!
+		MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		
+		MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+        MockGetGenericVnfByIdWithDepth(".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml");
+
+		MockPutGenericVnf(".*");
+        MockPatchGenericVnf(".*");
+
+        MockGetGenericVnfByIdWithPriority(".*", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+        // MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+        MockPutVfModuleIdNoResponse(".*", "PCRF", ".*");
+        MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+
+		MockGetNetworkPolicyfqdn(".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200);
+		MockNodeQueryServiceInstanceByName_404(".*");
+
+		mockVNFPost("", 202, ".*");
+
+        stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202)));
+		stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+		stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+		stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+		stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+		MockPostRequestDB();	
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		mockSDNCAdapter(200);
+		
+		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 VNF
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "queryModule");
+        injectSDNCCallbacks(callbacks, "activate");
+        //VF Module
+        injectSDNCCallbacks(callbacks, "queryModule");
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "queryModule");
+        injectSDNCCallbacks(callbacks, "queryModule");
+		injectSDNCCallbacks(callbacks, "assign");
+		injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
+        injectVNFRestCallbacks(callbacks, "vnfCreate");
+        injectSDNCCallbacks(callbacks, "activate");
+
+        // for BRG
+        injectSDNCCallbacks(callbacks, "assign");
+        injectSDNCCallbacks(callbacks, "create");
+        injectSDNCCallbacks(callbacks, "activate");
+        injectSDNCCallbacks(callbacks, "queryBRG");
+
+		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("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("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
+	}
+
+	@Test
+	public void testCreateVcpeResCustService_NoParts() throws Exception {
+		System.out.println("starting: testCreateVcpeResCustService_NoParts\n"  );
+		MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+		MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+		MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+		
+		// TODO: the SI should NOT have to be URL-encoded yet again!
+		MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		
+		MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		
+		// TODO: should these really be PARENT_INST, or should they be INST?
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+        StubResponseOof.mockOof();
+        stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+        stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+        stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+        MockPostRequestDB();
+        mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		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);
+
+		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);
+
+		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("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+		
+		// TODO: the SI should NOT have to be URL-encoded yet again!
+		MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		
+		MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance_500(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+		mockSDNCAdapter(404);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+        StubResponseOof.mockOof();
+        stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+        stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+        stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+        stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+        MockPostRequestDB();
+		
+		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);
+
+		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("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+		MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+		
+		// TODO: the SI should NOT have to be URL-encoded yet again!
+		MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+		
+		MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+		MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		StubResponseOof.mockOof();
+		stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+		stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+		stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+		stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+		MockPostRequestDB();
+		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
new file mode 100644
index 0000000..ca81d99
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
@@ -0,0 +1,291 @@
+/*
+ * ============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
+ *
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import com.github.tomakehurst.wiremock.stubbing.Scenario;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+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.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+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;
+
+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 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"));
+
+		request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+	}
+
+	@Before
+	public void init(){
+		BPMNUtil.cleanHistory(processEngine);
+	}
+
+	@Test
+	public void testDeleteVcpeResCustService_Success() throws Exception {
+		logStart();
+		MockNodeQueryServiceInstanceById(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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+		/*
+		 * cannot use MockGetServiceInstance(), because we need to return
+		 * different responses as we traverse through the flow
+		 */
+
+		// initially, the SI includes the ARs
+		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
+		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(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID);
+		MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+		// for TXC
+		MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID);
+		MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS);
+
+        //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+        stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+                .willReturn(aResponse()
+                        .withStatus(200)
+                        .withHeader("Content-Type", "text/xml")
+                        .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
+
+
+		stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+				.willReturn(aResponse()
+						.withStatus(204)
+						.withHeader("Content-Type", "text/xml")));
+
+        MockDeleteServiceInstance(CUST,SVC,INST,SVC);
+
+        mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = setupVariables(businessKey);
+
+		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+		// for BRG
+		injectSDNCCallbacks(callbacks, "deactivate");
+		injectSDNCCallbacks(callbacks, "delete");
+		injectSDNCCallbacks(callbacks, "unassign");
+
+		// for VNF1
+		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 SI
+		injectSDNCCallbacks(callbacks, "deactivate");
+		injectSDNCCallbacks(callbacks, "delete");
+
+		waitForProcessEnd(businessKey, 70000);
+		assertTrue(isProcessEnded(businessKey));
+
+		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));
+		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"));
+
+		BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
+		logEnd();
+	}
+
+	@Test
+	public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+		logStart();
+		MockNodeQueryServiceInstanceById(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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+		MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = setupVariables(businessKey);
+
+
+		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+		// for SI
+		injectSDNCCallbacks(callbacks, "deactivate");
+		injectSDNCCallbacks(callbacks, "delete");
+
+		waitForProcessEnd(businessKey, 70000);
+
+		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));
+		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"));
+
+		BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
+		logEnd();
+	}
+
+	@Test
+	public void testDeleteVcpeResCustService_Fault() throws Exception {
+		logStart();
+		MockNodeQueryServiceInstanceById(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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+		MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+
+		// generate failure
+		mockSDNCAdapter(404);
+
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = setupVariables(businessKey);
+
+		invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+		waitForProcessEnd(businessKey, 70000);
+
+		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));
+		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;
+	}
+
+}
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
new file mode 100644
index 0000000..2b1b5a3
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
@@ -0,0 +1,266 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import static org.junit.Assert.*;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+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;
+
+
+public class DoCreateAllottedResourceBRGIT extends AbstractTestBase {
+
+	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();
+
+		// 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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables,"testRequestId123");
+
+		String processId = invokeSubProcess(PROCNAME, variables);
+		
+		injectSDNCCallbacks(callbacks, "assign");
+		injectSDNCCallbacks(callbacks, "create");
+		injectSDNCCallbacks(callbacks, "activate");
+		injectSDNCCallbacks(callbacks, "query");
+
+		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_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(DEC_INST, "GenericFlows/getNotFound.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables,"testRequestId124");
+		
+		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_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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables,"testRequestId125");
+
+		variables.put("failExists", "false");
+
+		String processId = invokeSubProcess(PROCNAME, variables);
+
+		
+		
+		injectSDNCCallbacks(callbacks, "query");
+
+		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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(404);
+		mockUpdateRequestDB(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
new file mode 100644
index 0000000..5b78b48
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
@@ -0,0 +1,323 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Test;
+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;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase {
+
+	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 {
+        logStart();
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+		rollbackData.put(RbType, "rollbackAAI", "false");
+		rollbackData.put(RbType, "rollbackSDNCassign", "false");
+		
+		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(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+		logEnd();
+	}
+	
+	@Test
+	public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+		logStart();
+	    MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+		// this will cause "rollbackSDNC" to be set to false
+		rollbackData.put(RbType, "rollbackSDNCassign", "false");
+		
+		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_NoDeactivate() throws Exception {
+		logStart();
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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 testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+		logStart();
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		mockSDNCAdapter(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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", "http://localhost:"+wiremockPort+"/aai/v9/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
new file mode 100644
index 0000000..473661c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
@@ -0,0 +1,276 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+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;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+public class DoCreateAllottedResourceTXCIT extends AbstractTestBase {
+
+	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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables, "testRequestId123");
+
+		String processId = invokeSubProcess(PROCNAME, variables);
+		
+		injectSDNCCallbacks(callbacks, "assign");
+		injectSDNCCallbacks(callbacks, "create");
+		injectSDNCCallbacks(callbacks, "activate");
+		injectSDNCCallbacks(callbacks, "query");
+
+		waitForWorkflowToFinish(processEngine,processId);
+		
+		assertTrue(isProcessEndedByProcessInstanceId(processId));
+		
+		String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+		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_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(DEC_INST, "GenericFlows/getNotFound.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables, "testRequestId123");
+
+		String processId = invokeSubProcess(PROCNAME, variables);
+
+		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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables, "testRequestId123");
+
+		variables.put("failExists", "false");
+
+		String processId = invokeSubProcess(PROCNAME, variables);
+		
+		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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(DEC_INST, "GenericFlows/getSIUrlById.xml");
+		MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+		
+		MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+		MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+		MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+		mockSDNCAdapter(404);
+		mockUpdateRequestDB(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
new file mode 100644
index 0000000..3720f1d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
@@ -0,0 +1,323 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Test;
+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;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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 testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+		logStart();
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+		rollbackData.put(RbType, "rollbackAAI", "false");
+		rollbackData.put(RbType, "rollbackSDNCassign", "false");
+		
+		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(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+		assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+		logEnd();
+	}
+	
+	@Test
+	public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+		logStart();
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		String businessKey = UUID.randomUUID().toString();
+		Map<String, Object> variables = new HashMap<>();
+		RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+		// this will cause "rollbackSDNC" to be set to false
+		rollbackData.put(RbType, "rollbackSDNCassign", "false");
+		
+		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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		mockSDNCAdapter(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(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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", "http://localhost:"+wiremockPort+"/aai/v9/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
new file mode 100644
index 0000000..4edaf7d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
@@ -0,0 +1,145 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Assert;
+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;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+
+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(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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");
+
+		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(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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();
+	}
+	
+	
+	@Test
+	public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+		logStart();
+		MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		mockSDNCAdapter(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);
+	}
+
+}
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
new file mode 100644
index 0000000..520beaf
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
@@ -0,0 +1,140 @@
+/*
+ * ============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
+ * 
+ * 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=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Assert;
+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.*;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+
+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(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(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");
+
+		BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+
+		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(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockSDNCAdapter(200);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+		
+		Map<String, Object> variables = new HashMap<>();
+		setVariablesSuccess(variables);
+
+		variables.put("failNotFound", "false");
+
+		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(ARID, "GenericFlows/getARUrlById.xml");
+		MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+		MockPatchAllottedResource(CUST, SVC, INST, ARID);
+		MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+		mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+		mockSDNCAdapter(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);
+	}
+
+}
