use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class BuildingBlockTestDataSetup method buildInstanceGroup.
public InstanceGroup buildInstanceGroup() {
instanceGroupCounter++;
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setId("testId" + instanceGroupCounter);
instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
return instanceGroup;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class BBInputSetupTest method testMapCollection.
@Test
public void testMapCollection() throws JsonProcessingException {
List<AAIResultWrapper> collections = new ArrayList<>();
ServiceInstance serviceInstance = new ServiceInstance();
org.onap.aai.domain.yang.Collection aaiCollection = new org.onap.aai.domain.yang.Collection();
org.onap.aai.domain.yang.RelationshipList collectionRelationshipList = new org.onap.aai.domain.yang.RelationshipList();
org.onap.aai.domain.yang.Relationship collectionInstanceGroupRelationship = new org.onap.aai.domain.yang.Relationship();
collectionRelationshipList.getRelationship().add(collectionInstanceGroupRelationship);
aaiCollection.setRelationshipList(collectionRelationshipList);
collections.add(new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection)));
Collection collection = new Collection();
ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
List<InstanceGroup> instanceGroupsList = new ArrayList<>();
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroupsList.add(instanceGroup);
NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class);
CollectionResource collectionResource = new CollectionResource();
doReturn(collection).when(bbInputSetupMapperLayer).mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class));
doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any());
doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
doReturn(collectionResource).when(networkCollectionCust).getCollectionResource();
doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource);
SPY_bbInputSetup.mapCollection(collections, serviceInstance);
assertEquals(collection, serviceInstance.getCollection());
assertEquals(instanceGroup, collection.getInstanceGroup());
instanceGroupsList.clear();
collection = new Collection();
SPY_bbInputSetup.mapCollection(collections, serviceInstance);
assertEquals(collection, serviceInstance.getCollection());
assertNull(collection.getInstanceGroup());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class BBInputSetupTest method testMapVnfcCollectionInstanceGroup.
@Test
public void testMapVnfcCollectionInstanceGroup() {
VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class);
GenericVnf genericVnf = new GenericVnf();
ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
Service service = Mockito.mock(Service.class);
org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
instanceGroup.setModelUUID("modelUUID");
List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>();
VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization();
vnfcInstanceGroupCust.setInstanceGroup(instanceGroup);
vnfcInstanceGroupCust.setFunction("function");
vnfcInstanceGroupCust.setDescription("description");
vnfcInstanceGroups.add(vnfcInstanceGroupCust);
ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
modelInfoInstanceGroup.setModelUUID("modelUUID");
doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service);
doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations();
doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID");
doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null, instanceGroup);
SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service);
assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class AssignVnfTest method before.
@Before
public void before() throws BBObjectNotFoundException {
ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
modelVnfc.setType("VNFC");
modelVnfc.setFunction("function");
ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup();
modelNetworkInstanceGroup.setType("L3-NETWORK");
modelNetworkInstanceGroup.setFunction("function");
instanceGroup1 = new InstanceGroup();
instanceGroup1.setId("test-001");
instanceGroup1.setModelInfoInstanceGroup(modelVnfc);
instanceGroup2 = new InstanceGroup();
instanceGroup2.setId("test-002");
instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
instanceGroup3 = new InstanceGroup();
instanceGroup3.setId("test-003");
instanceGroup3.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
instanceGroup4 = new InstanceGroup();
instanceGroup4.setId("test-004");
instanceGroup4.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
genericVnf = setGenericVnf();
genericVnf.setVnfName("vnfName");
doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class), isA(GenericVnf.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class TestDataSetup method buildInstanceGroup.
public InstanceGroup buildInstanceGroup() {
instanceGroupCounter++;
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setId("testId" + instanceGroupCounter);
instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
return instanceGroup;
}
Aggregations