Search in sources :

Example 11 with ModelInfoInstanceGroup

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup in project so by onap.

the class AAIObjectInstanceNameGeneratorTest method generateInstanceGroupNameTest.

@Test
public void generateInstanceGroupNameTest() throws Exception {
    ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
    modelVnfc.setFunction("vre");
    modelVnfc.setType("VNFC");
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setId("test-001");
    instanceGroup.setModelInfoInstanceGroup(modelVnfc);
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("vnf-123");
    vnf.setVnfName("test-vnf");
    assertEquals("test-vnf_vre", new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf));
}
Also used : AAIObjectInstanceNameGenerator(org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) Test(org.junit.Test)

Example 12 with ModelInfoInstanceGroup

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup in project so by onap.

the class BBInputSetupTest method testMapCatalogCollectionAndInstanceGroup.

@Test
public void testMapCatalogCollectionAndInstanceGroup() {
    ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
    modelInfoCollection.setCollectionFunction("collectionFunction");
    modelInfoCollection.setCollectionRole("collectionRole");
    modelInfoCollection.setCollectionType("collectionType");
    modelInfoCollection.setDescription("description");
    modelInfoCollection.setModelInvariantUUID("modelInvariantUUID");
    modelInfoCollection.setQuantity(0);
    ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
    modelInfoInstanceGroup.setFunction("function");
    modelInfoInstanceGroup.setInstanceGroupRole("instanceGroupRole");
    modelInfoInstanceGroup.setModelInvariantUUID("modelInvariantUUID");
    modelInfoInstanceGroup.setModelUUID("modelUUID");
    modelInfoInstanceGroup.setType("VNFC");
    modelInfoInstanceGroup.setDescription("description");
    InstanceGroup instanceGroup = new InstanceGroup();
    Collection collection = new Collection();
    collection.setInstanceGroup(instanceGroup);
    CollectionResource collectionResource = new CollectionResource();
    org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
    collectionResource.setToscaNodeType("NetworkCollection");
    collectionResource.setInstanceGroup(catalogInstanceGroup);
    CollectionResourceCustomization collectionCust = new NetworkCollectionResourceCustomization();
    collectionCust.setModelCustomizationUUID("modelCustomizationUUID");
    collectionCust.setCollectionResource(collectionResource);
    Service service = new Service();
    service.getCollectionResourceCustomizations().add(collectionCust);
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setCollection(collection);
    List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = new ArrayList<>();
    CollectionResourceInstanceGroupCustomization instanceGroupCust = new CollectionResourceInstanceGroupCustomization();
    instanceGroupCust.setFunction("function");
    instanceGroupCust.setDescription("description");
    doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust, collectionResource);
    doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup);
    SPY_bbInputSetup.mapCatalogCollection(service, serviceInstance.getCollection(), "modelCustomizationUUID");
    SPY_bbInputSetup.mapCatalogNetworkCollectionInstanceGroup(service, serviceInstance.getCollection().getInstanceGroup(), collectionCust.getModelCustomizationUUID());
    assertThat(collection.getModelInfoCollection(), sameBeanAs(modelInfoCollection));
    assertThat(instanceGroup.getModelInfoInstanceGroup(), sameBeanAs(modelInfoInstanceGroup));
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) ArrayList(java.util.ArrayList) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) Test(org.junit.Test)

Aggregations

ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)12 Test (org.junit.Test)8 InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)8 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)6 ArrayList (java.util.ArrayList)4 CollectionResourceInstanceGroupCustomization (org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization)3 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)2 Before (org.junit.Before)2 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)2 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)2 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)2 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)2 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)2 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)2 CollectionResourceCustomization (org.onap.so.db.catalog.beans.CollectionResourceCustomization)2 Service (org.onap.so.db.catalog.beans.Service)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 IOException (java.io.IOException)1 URI (java.net.URI)1