Search in sources :

Example 6 with ServiceDecomposition

use of org.onap.so.bpmn.core.domain.ServiceDecomposition in project so by onap.

the class DecomposeJsonUtilTest method testJsonToServiceDecomposition_JsonDecomposingException.

@Test
public void testJsonToServiceDecomposition_JsonDecomposingException() throws JsonDecomposingException {
    expectedException.expect(JsonDecomposingException.class);
    // wrong object
    vnfResource = createVnfResourceData();
    ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(vnfResource.toString());
}
Also used : ServiceDecomposition(org.onap.so.bpmn.core.domain.ServiceDecomposition) Test(org.junit.Test)

Example 7 with ServiceDecomposition

use of org.onap.so.bpmn.core.domain.ServiceDecomposition in project so by onap.

the class DecomposeJsonUtilTest method testJsonToServiceDecomposition_twoParams.

@Test
public void testJsonToServiceDecomposition_twoParams() throws JsonDecomposingException {
    serviceDecomposition = createServiceDecompositionData();
    ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(serviceDecomposition.toString(), "serviceInstanceId");
    assertEquals(serviceInstanceId, serviceDecompositionObj.getServiceInstance().getInstanceId());
}
Also used : ServiceDecomposition(org.onap.so.bpmn.core.domain.ServiceDecomposition) Test(org.junit.Test)

Example 8 with ServiceDecomposition

use of org.onap.so.bpmn.core.domain.ServiceDecomposition in project so by onap.

the class DecomposeJsonUtilTest method testJsonToServiceDecomposition.

@Test
public void testJsonToServiceDecomposition() throws JsonDecomposingException {
    serviceDecomposition = createServiceDecompositionData();
    ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(serviceDecomposition.toString());
    assertEquals(serviceDecomposition.getServiceType(), serviceDecompositionObj.getServiceType());
}
Also used : ServiceDecomposition(org.onap.so.bpmn.core.domain.ServiceDecomposition) Test(org.junit.Test)

Example 9 with ServiceDecomposition

use of org.onap.so.bpmn.core.domain.ServiceDecomposition in project so by onap.

the class OofHomingIT method testHoming_success_2AR1Vnf2Net.

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

Example 10 with ServiceDecomposition

use of org.onap.so.bpmn.core.domain.ServiceDecomposition in project so by onap.

the class OofHomingIT method testHoming_success_2AR1Vnf.

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

Aggregations

ServiceDecomposition (org.onap.so.bpmn.core.domain.ServiceDecomposition)12 Test (org.junit.Test)11 HashMap (java.util.HashMap)8 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)8 WorkflowException (org.onap.so.bpmn.core.WorkflowException)8 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 VnfResource (org.onap.so.bpmn.core.domain.VnfResource)8