use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class NetworkCollectionCatalogDbQueryTest method buildingBlockDetailTest.
@Test
public void buildingBlockDetailTest() {
logger.debug("TEST IS STARTING UP...");
logger.debug(Integer.toString(port));
String buildingBlockFlowName = "CreateNetworkCollectionBB";
BuildingBlockDetail buildingBlockDetail = client.getBuildingBlockDetail(buildingBlockFlowName);
logger.debug("" + buildingBlockDetail.getResourceType());
assertNotNull(buildingBlockDetail);
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method test_validateOrchestrationStatus_orchestrationValidationNotFound.
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() {
String flowToBeCalled = "AssignServiceInstanceBB";
execution.setVariable("flowToBeCalled", flowToBeCalled);
BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.FAIL, OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
Mockito.verifyZeroInteractions(requestsDbClient);
verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000), any(NullPointerException.class));
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method test_validateOrchestrationStatusSecondStageOfMultiStageDisabledVfModule.
@Test
public void test_validateOrchestrationStatusSecondStageOfMultiStageDisabledVfModule() throws Exception {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
modelInfoGenericVnf.setMultiStageDesign("false");
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule.setVfModuleId("vfModuleId");
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS, OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId("testVfModuleId1");
request.setResourceStatusMessage(vfModuleExistExpectedMessage);
Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method getBuildingBlockDetail.
private BuildingBlockDetail getBuildingBlockDetail(String assignServiceInstanceBB, ResourceType service, OrchestrationAction assign) {
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName(assignServiceInstanceBB);
buildingBlockDetail.setId(1);
buildingBlockDetail.setResourceType(service);
buildingBlockDetail.setTargetAction(assign);
return buildingBlockDetail;
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method test_validateOrchestrationStatusDeleteVfModuleSilentSuccess.
@Test
public void test_validateOrchestrationStatusDeleteVfModuleSilentSuccess() throws Exception {
String flowToBeCalled = "DeleteVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
modelInfoGenericVnf.setMultiStageDesign("true");
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule.setVfModuleId("vfModuleId");
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("DeleteVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS, OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId("testVfModuleId1");
request.setResourceStatusMessage(vfModuleNotExistExpectedMessage);
Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
assertEquals(vfModuleNotExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
Aggregations