Search in sources :

Example 6 with LineOfBusiness

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));
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Test(org.junit.Test)

Example 7 with LineOfBusiness

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());
}
Also used : ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) AAICommonObjectMapperProvider(org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) Test(org.junit.Test)

Example 8 with LineOfBusiness

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));
}
Also used : Optional(java.util.Optional) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) Test(org.junit.Test)

Example 9 with LineOfBusiness

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);
        }
    }
}
Also used : LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Example 10 with 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));
        }
    }
}
Also used : LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)

Aggregations

LineOfBusiness (org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)15 Test (org.junit.Test)10 Platform (org.onap.so.bpmn.servicedecomposition.bbobjects.Platform)8 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)7 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)7 File (java.io.File)6 HashMap (java.util.HashMap)6 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)6 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)4 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)4 ArrayList (java.util.ArrayList)3 InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)3 ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)3 Service (org.onap.so.db.catalog.beans.Service)3 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)3 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)3 Map (java.util.Map)2 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)2 AAIFluentTypeBuilder (org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder)2 BaseBBInputSetupTestHelper.prepareLookupKeyMap (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap)2