use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class BBInputSetupTest method test_getGBBMacroNoUserParamsCreate_shouldBeCalled_whenBBhasVirtualLink.
@Test
public void test_getGBBMacroNoUserParamsCreate_shouldBeCalled_whenBBhasVirtualLink() throws Exception {
// given
String resourceId = "123";
String vnfType = "vnfType";
String requestAction = "createInstance";
Service service = Mockito.mock(Service.class);
GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class);
Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
List<NetworkResourceCustomization> networkCustList = new ArrayList<>();
NetworkResourceCustomization networkCust = Mockito.mock(NetworkResourceCustomization.class);
networkCustList.add(networkCust);
CollectionNetworkResourceCustomization collectionNetworkResourceCust = Mockito.mock(CollectionNetworkResourceCustomization.class);
org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf();
aaiVnf.setModelCustomizationId("modelCustId");
ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class);
NetworkResourceCustomization networkResourceCustomization = Mockito.mock(NetworkResourceCustomization.class);
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
doReturn(collectionNetworkResourceCust).when(SPY_bbInputSetupUtils).getCatalogCollectionNetworkResourceCustByID(any(String.class));
doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization);
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service);
}
use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class BBInputSetupTest method testMapCatalogNetwork.
@Test
public void testMapCatalogNetwork() {
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
L3Network network = new L3Network();
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
requestDetails.setModelInfo(modelInfo);
Service service = new Service();
NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class BBInputSetupTest method testMapCatalogConfiguration.
@Test
public void testMapCatalogConfiguration() {
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
L3Network network = new L3Network();
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
requestDetails.setModelInfo(modelInfo);
Service service = new Service();
NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
Aggregations