use of org.onap.so.bpmn.core.WorkflowException in project so by onap.
the class OofHomingIT method testHoming_error_oofPolicyException.
@Test
public void testHoming_error_oofPolicyException() throws Exception {
mockOof(wireMockServer);
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());
}
use of org.onap.so.bpmn.core.WorkflowException in project so by onap.
the class OofHomingIT method testHoming_success_vnfResourceList.
@Test
public void testHoming_success_vnfResourceList() throws Exception {
// Create a Service Decomposition
MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "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(wireMockServer);
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", "CloudOwner", "mtmnj1a", "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
}
use of org.onap.so.bpmn.core.WorkflowException in project so by onap.
the class OofHomingIT method testHoming_error_oofNoSolution.
@Test
public void testHoming_error_oofNoSolution() throws Exception {
mockOof(wireMockServer);
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);
assertNotNull(businessKey);
}
use of org.onap.so.bpmn.core.WorkflowException in project so by onap.
the class ReceiveWorkflowMessageTest method timeout.
/**
* 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();
}
use of org.onap.so.bpmn.core.WorkflowException in project so by onap.
the class SniroHomingV1IT method testHoming_success_vnfResourceList.
@Test
public void testHoming_success_vnfResourceList() throws Exception {
// Create a Service Decomposition
MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
String busKey = UUID.randomUUID().toString();
Map<String, Object> vars = new HashMap<>();
setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
invokeSubProcess("DecomposeService", busKey, vars);
ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
List<VnfResource> vnfResourceList = sd.getVnfResources();
vnfResourceList.get(0).setResourceId("test-resource-id-000");
// Invoke Homing
mockSNIRO(wireMockServer);
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", "CloudOwner", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
}
Aggregations