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));
}
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;
}
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));
}
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());
}
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"));
}
Aggregations