Search in sources :

Example 1 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class BBInputSetupMapperLayerTest method testMapOrchestrationContext.

@Test
public void testMapOrchestrationContext() throws IOException {
    OrchestrationContext expected = new OrchestrationContext();
    expected.setIsRollbackEnabled(true);
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
    OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);
    assertThat(actual, sameBeanAs(expected));
}
Also used : File(java.io.File) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 2 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class BuildingBlockTestDataSetup method setOrchestrationContext.

public OrchestrationContext setOrchestrationContext() {
    OrchestrationContext orchestrationContext = buildOrchestrationContext();
    gBBInput.setOrchContext(orchestrationContext);
    return orchestrationContext;
}
Also used : OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)

Example 3 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class BBInputSetupMapperLayerTest method testMapOrchestrationContextNoRequestInfo.

@Test
public void testMapOrchestrationContextNoRequestInfo() throws IOException {
    OrchestrationContext expected = new OrchestrationContext();
    expected.setIsRollbackEnabled(false);
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContextNoRequestInfo.json"), RequestDetails.class);
    OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);
    assertThat(actual, sameBeanAs(expected));
}
Also used : File(java.io.File) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 4 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterCreateTasksTest method test_createVfModule.

@Test
public void test_createVfModule() throws Exception {
    RequestContext requestContext = setRequestContext();
    ServiceInstance serviceInstance = setServiceInstance();
    GenericVnf genericVnf = setGenericVnf();
    VfModule vfModule = setVfModule();
    CloudRegion cloudRegion = setCloudRegion();
    OrchestrationContext orchestrationContext = setOrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    CreateVfModuleRequest modRequest = new CreateVfModuleRequest();
    modRequest.setVfModuleId(vfModule.getVfModuleId());
    modRequest.setBaseVfModuleStackId("baseVfModuleStackId");
    modRequest.setVfModuleName(vfModule.getVfModuleName());
    CreateVfModuleRequest createVfModuleRequest = modRequest;
    String sdncVfModuleQueryResponse = "{someJson}";
    execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse);
    String sdncVnfQueryResponse = "{someJson}";
    execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
    doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    vnfAdapterCreateTasks.createVfModule(execution);
    verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString());
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Example 5 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterCreateTasksTest method test_createVolumeGroupRequest.

@Test
public void test_createVolumeGroupRequest() throws Exception {
    RequestContext requestContext = setRequestContext();
    ServiceInstance serviceInstance = setServiceInstance();
    GenericVnf genericVnf = setGenericVnf();
    VfModule vfModule = setVfModule();
    vfModule.setSelflink("vfModuleSelfLink");
    VolumeGroup volumeGroup = setVolumeGroup();
    volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    CloudRegion cloudRegion = setCloudRegion();
    OrchestrationContext orchestrationContext = setOrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    String sdncVnfQueryResponse = "SDNCVnfQueryResponse";
    execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse);
    CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
    request.setVolumeGroupId("volumeGroupStackId");
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
    doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
    vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
    verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
    assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVolumeGroupRequest(org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Aggregations

OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)29 Test (org.junit.Test)25 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)25 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)25 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)24 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)18 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)16 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 HashMap (java.util.HashMap)13 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)13 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)13 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)11 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)7 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)6 Map (java.util.Map)5 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)5 CreateVolumeGroupRequest (org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest)4 File (java.io.File)3 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)3 MsoRequest (org.onap.so.entity.MsoRequest)3