Search in sources :

Example 16 with WorkflowException

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

the class VnfAdapterRestV1IT method testCreateVfModuleException.

@Test
public void testCreateVfModuleException() throws Exception {
    logStart();
    mockVNFPost(wireMockServer, "", 202, "vnfId");
    String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
    String messageId = requestId + "-" + System.currentTimeMillis();
    String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
    String businessKey = UUID.randomUUID().toString();
    Map<String, Object> variables = new HashMap<>();
    variables.put("mso-request-id", requestId);
    variables.put("isDebugLogEnabled", "true");
    variables.put("vnfAdapterRestV1Request", request);
    invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
    injectVNFRestCallbacks(callbacks, "vfModuleException");
    waitForProcessEnd(businessKey, 10000);
    WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
    assertNotNull(wfe);
    logger.debug(wfe.toString());
    String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
    logger.debug("Response:\n{}", response);
    assertTrue(response.contains("<vfModuleException>"));
    assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
    logEnd();
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 17 with WorkflowException

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

the class CreateAAIVfModuleIT method TestQueryGenericVnfFailure_5000.

@Test
public void TestQueryGenericVnfFailure_5000() {
    new MockAAIGenericVnfSearch(wireMockServer);
    MockAAICreateGenericVnf(wireMockServer);
    MockAAIVfModulePUT(wireMockServer, true);
    Map<String, Object> variables = new HashMap<>();
    variables.put("mso-request-id", UUID.randomUUID().toString());
    variables.put("isDebugLogEnabled", "true");
    variables.put("isVidRequest", "false");
    variables.put("vnfName", "STMTN5MMSC23");
    variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
    variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
    variables.put("personaModelVersion", "1.0");
    variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
    variables.put("vfModuleModelName", "MMSC::module-0");
    String processId = invokeSubProcess("CreateAAIVfModule", variables);
    WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
    Assert.assertEquals(500, exception.getErrorCode());
    Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
    logger.debug(exception.getErrorMessage());
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 18 with WorkflowException

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

the class CreateAAIVfModuleIT method TestCreateVfModuleFailure_5000.

@Test
public void TestCreateVfModuleFailure_5000() {
    new MockAAIGenericVnfSearch(wireMockServer);
    MockAAICreateGenericVnf(wireMockServer);
    MockAAIVfModulePUT(wireMockServer, true);
    Map<String, Object> variables = new HashMap<>();
    variables.put("isDebugLogEnabled", "true");
    variables.put("isVidRequest", "false");
    variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
    variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
    variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
    variables.put("personaModelVersion", "1.0");
    variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
    variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
    variables.put("mso-request-id", UUID.randomUUID().toString());
    String processId = invokeSubProcess("CreateAAIVfModule", variables);
    WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
    Assert.assertEquals(5000, exception.getErrorCode());
    Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
    logger.debug(exception.getErrorMessage());
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 19 with WorkflowException

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

the class CreateAAIVfModuleIT method TestCreateGenericVnfFailure_1002.

@Test
public void TestCreateGenericVnfFailure_1002() {
    new MockAAIGenericVnfSearch(wireMockServer);
    MockAAICreateGenericVnf(wireMockServer);
    MockAAIVfModulePUT(wireMockServer, true);
    Map<String, Object> variables = new HashMap<>();
    variables.put("mso-request-id", UUID.randomUUID().toString());
    variables.put("isDebugLogEnabled", "true");
    variables.put("isVidRequest", "false");
    variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
    variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
    variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
    variables.put("personaModelVersion", "1.0");
    variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
    variables.put("vfModuleModelName", "PCRF::module-0");
    String processId = invokeSubProcess("CreateAAIVfModule", variables);
    WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
    Assert.assertEquals(1002, exception.getErrorCode());
    Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
    logger.debug(exception.getErrorMessage());
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 20 with WorkflowException

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

the class DeleteAAIVfModuleIT method TestDeleteVfModuleFailure_1002_1.

@Test
public void TestDeleteVfModuleFailure_1002_1() {
    // failure attempting to delete Base Module when not the last Vf Module
    // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
    String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL + "  <request-info>" + EOL + "    <action>DELETE_VF_MODULE</action>" + EOL + "    <source>PORTAL</source>" + EOL + "  </request-info>" + EOL + "  <vnf-inputs>" + EOL + "    <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL + "    <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + "    <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL + "    <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL + "  </vnf-inputs>" + EOL + "  <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL;
    new MockAAIGenericVnfSearch(wireMockServer);
    new MockAAIDeleteGenericVnf(wireMockServer);
    new MockAAIDeleteVfModule(wireMockServer);
    Map<String, Object> variables = new HashMap<>();
    variables.put("isDebugLogEnabled", "true");
    variables.put("mso-request-id", UUID.randomUUID().toString());
    variables.put("DeleteAAIVfModuleRequest", request);
    String processId = invokeSubProcess("DeleteAAIVfModule", variables);
    WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
    Assert.assertEquals(1002, exception.getErrorCode());
    Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
    logger.debug(exception.getErrorMessage());
}
Also used : HashMap(java.util.HashMap) WorkflowException(org.onap.so.bpmn.core.WorkflowException) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

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