use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupMapperLayerTest method testSetPlatformAndLOB.
@Test
public void testSetPlatformAndLOB() throws IOException {
ServiceInstance expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"), ServiceInstance.class);
Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>();
resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId");
Platform platformMSO = new Platform();
platformMSO.setPlatformName("platformName");
LineOfBusiness lineOfBusinessMSO = new LineOfBusiness();
lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName");
ServiceInstance actual = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"), ServiceInstance.class);
bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual, resourcesToBeOrchestrated);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupTest method testMapLineOfBusiness.
@Test
public void testMapLineOfBusiness() throws JsonProcessingException {
org.onap.aai.domain.yang.LineOfBusiness expectedAAI = new org.onap.aai.domain.yang.LineOfBusiness();
LineOfBusiness expected = new LineOfBusiness();
AAIResultWrapper vnfWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
doReturn(expected).when(bbInputSetupMapperLayer).mapAAILineOfBusiness(isA(org.onap.aai.domain.yang.LineOfBusiness.class));
GenericVnf vnf = new GenericVnf();
SPY_bbInputSetup.mapLineOfBusiness(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf);
assertEquals(expected, vnf.getLineOfBusiness());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class AAIVnfResourcesTest method createLineOfBusinessandConnectVnfTest.
@Test
public void createLineOfBusinessandConnectVnfTest() {
LineOfBusiness lob = new LineOfBusiness();
lob.setLineOfBusinessName("a123");
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
aaiVnfResources.createLineOfBusinessandConnectVnf(lob, genericVnf);
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), isA(AAIResourceUri.class));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetup method mapLineOfBusiness.
protected void mapLineOfBusiness(List<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) {
if (!lineOfBusinesses.isEmpty()) {
AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0);
Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp = lineOfBusinessWrapper.asBean(org.onap.aai.domain.yang.LineOfBusiness.class);
if (aaiLineOfBusinessOp.isPresent()) {
LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusinessOp.get());
genericVnf.setLineOfBusiness(lineOfBusiness);
}
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class AAICreateTasks method createLineOfBusinessVnf.
protected void createLineOfBusinessVnf(GenericVnf vnf) {
LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
if (lineOfBusiness != null) {
if (Strings.isNullOrEmpty(lineOfBusiness.getLineOfBusinessName())) {
logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
} else {
List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName());
lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), vnf));
}
}
}
Aggregations