use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method continueValidationActivatedTest.
@Test
public void continueValidationActivatedTest() throws Exception {
String flowToBeCalled = "DeactivateVnfBB";
BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail(flowToBeCalled, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule.setVfModuleId("vfModuleId");
vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE, OrchestrationStatus.ACTIVATED, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED, OrchestrationAction.DEACTIVATE);
execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.CONTINUE, execution.getVariable("orchestrationStatusValidationResult"));
Mockito.verifyZeroInteractions(requestsDbClient);
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class OrchestrationStatusValidatorTest method test_validateOrchestrationStatusConfiguration.
@Test
public void test_validateOrchestrationStatusConfiguration() throws Exception {
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
String flowToBeCalled = "UnassignFabricConfigurationBB";
ServiceInstance si = setServiceInstance();
List<Configuration> configurations = new ArrayList<>();
Configuration config = new Configuration();
si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
config.setConfigurationId("configurationId");
config.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
configurations.add(config);
si.setConfigurations(configurations);
execution.setVariable("flowToBeCalled", flowToBeCalled);
execution.setVariable("aLaCarte", true);
BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("UnassignFabricConfigurationBB", ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
configuration.setConfigurationId("configurationId");
configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS, OrchestrationStatus.PRECREATED, ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION, OrchestrationStatus.PRECREATED, OrchestrationAction.UNASSIGN);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
Mockito.verifyZeroInteractions(requestsDbClient);
}
use of org.onap.so.db.catalog.beans.BuildingBlockDetail in project so by onap.
the class BuildingBlockDetailTest method BuildingBlockDetailSingleLookupValidationTest.
@Test
public void BuildingBlockDetailSingleLookupValidationTest() {
String buildingBlockName = "AssignServiceInstanceBB";
BuildingBlockDetail buildingBlockDetail = buildingBlockDetailRepository.findOneByBuildingBlockName(buildingBlockName);
assertEquals(buildingBlockName, buildingBlockDetail.getBuildingBlockName());
assertEquals(ResourceType.SERVICE, buildingBlockDetail.getResourceType());
assertEquals(OrchestrationAction.ASSIGN, buildingBlockDetail.getTargetAction());
}
Aggregations