Search in sources :

Example 11 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class SniroHomingV1IT method testHoming_success_2AR1Vnf.

@Test
public void testHoming_success_2AR1Vnf() throws Exception {
    mockSNIRO(wireMockServer);
    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);
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 12 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class SniroHomingV1IT method testHoming_success_existingLicense.

@Test
public void testHoming_success_existingLicense() throws Exception {
    mockSNIRO(wireMockServer);
    String businessKey = UUID.randomUUID().toString();
    Map<String, Object> variables = new HashMap<String, Object>();
    setVariablesExistingLicense(variables);
    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);
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 13 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class SniroHomingV1IT method testHoming_error_sniroNoSolution.

@Test
public void testHoming_error_sniroNoSolution() throws Exception {
    mockSNIRO(wireMockServer);
    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());
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 14 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class SniroHomingV1IT method testHoming_success_2AR1Vnf2Net.

@Test
public void testHoming_success_2AR1Vnf2Net() throws Exception {
    mockSNIRO(wireMockServer);
    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);
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 15 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class UpdateAAIGenericVnfIT method personaMismatch.

/**
 * Test the happy path through the flow.
 */
@Test
public void personaMismatch() throws IOException {
    logStart();
    String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
    updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
    MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
    String businessKey = UUID.randomUUID().toString();
    Map<String, Object> variables = new HashMap<>();
    variables.put("mso-request-id", UUID.randomUUID().toString());
    variables.put("isDebugLogEnabled", "true");
    variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
    invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
    Assert.assertTrue(isProcessEnded(businessKey));
    WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
    logger.debug("Workflow Exception: {}", workflowException);
    Assert.assertNotNull(workflowException);
    logEnd();
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Aggregations

WorkflowException (org.onap.so.bpmn.core.WorkflowException)75 Test (org.junit.Test)61 HashMap (java.util.HashMap)49 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)45 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)9 AllottedResource (org.onap.so.bpmn.core.domain.AllottedResource)8 HomingSolution (org.onap.so.bpmn.core.domain.HomingSolution)8 NetworkResource (org.onap.so.bpmn.core.domain.NetworkResource)8 Resource (org.onap.so.bpmn.core.domain.Resource)8 ServiceDecomposition (org.onap.so.bpmn.core.domain.ServiceDecomposition)8 VnfResource (org.onap.so.bpmn.core.domain.VnfResource)8 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)7 Timestamp (java.sql.Timestamp)4 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)4 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)4 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)3 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)3 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)3