Search in sources :

Example 6 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization in project so by onap.

the class CatalogDbClientTest method testFindCvnfcCustomizationInListNoNulls.

@Test
public final void testFindCvnfcCustomizationInListNoNulls() {
    String cvnfcCustomizationUuid = "a123";
    CvnfcCustomization cvnfc = new CvnfcCustomization();
    cvnfc.setModelCustomizationUUID("z789J");
    CvnfcCustomization cvnfc2 = new CvnfcCustomization();
    cvnfc2.setModelCustomizationUUID("a123");
    ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>();
    cvnfcs.add(cvnfc);
    cvnfcs.add(cvnfc2);
    CvnfcCustomization aCvnfc = catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs);
    assertTrue(aCvnfc.getModelCustomizationUUID().equals("a123"));
}
Also used : CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteVfModuleFabricCreateTest.

@Test
public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception {
    String gAction = "createInstance";
    String resource = "VfModule";
    String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
    initExecution(gAction, bpmnRequest, true);
    execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
    NorthBoundRequest northBoundRequest = new NorthBoundRequest();
    List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AddFabricConfigurationBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
    CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
    ConfigurationResource configurationResource = new ConfigurationResource();
    configurationResource.setToscaNodeType("FabricConfiguration");
    vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
    vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
    vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
    List<CvnfcConfigurationCustomization> custSet = new ArrayList<CvnfcConfigurationCustomization>();
    custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
    cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
    cvnfcCustomization.setDescription("description");
    cvnfcCustomizations.add(cvnfcCustomization);
    CvnfcCustomization cvnfcCustomization2 = new CvnfcCustomization();
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization2 = new CvnfcConfigurationCustomization();
    ConfigurationResource configurationResource2 = new ConfigurationResource();
    configurationResource2.setToscaNodeType("FabricConfiguration");
    vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
    vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
    vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
    List<CvnfcConfigurationCustomization> custSet2 = new ArrayList<CvnfcConfigurationCustomization>();
    custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
    cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
    cvnfcCustomization2.setDescription("description2");
    cvnfcCustomizations.add(cvnfcCustomization2);
    when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
    workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB");
}
Also used : ArrayList(java.util.ArrayList) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 8 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization in project so by onap.

the class WorkflowActionUnitTest method traverseCatalogDbForConfigurationTest.

@Test
public void traverseCatalogDbForConfigurationTest() {
    CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
    CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization();
    ConfigurationResource configuration = new ConfigurationResource();
    configuration.setToscaNodeType("FabricConfiguration");
    configuration.setModelUUID("my-uuid");
    vfModuleCustomization.setConfigurationResource(configuration);
    cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singletonList(vfModuleCustomization));
    List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization);
// when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class),
// any(String.class)))
// .thenReturn(cvnfcCustomizations);
// List<CvnfcConfigurationCustomization> results =
// workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId");
// assertThat(results, is(Arrays.asList(vfModuleCustomization)));
}
Also used : CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) Test(org.junit.Test)

Example 9 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization in project so by onap.

the class UserParamsServiceTraversalTest method getCvnfcCustomizations.

private List<CvnfcCustomization> getCvnfcCustomizations() {
    ConfigurationResource configurationResource = new ConfigurationResource();
    configurationResource.setToscaNodeType("FabricConfiguration");
    CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
    cvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
    CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
    List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>();
    cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization);
    cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations);
    List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>();
    cvnfcCustomizations.add(cvnfcCustomization);
    return cvnfcCustomizations;
}
Also used : CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArrayList(java.util.ArrayList) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource)

Example 10 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization in project so by onap.

the class BBInputSetupMapperLayerTest method testmapCatalogConfigurationToConfiguration.

@Test
public void testmapCatalogConfigurationToConfiguration() {
    String modelCustUUID = "modelCustomizationUUID";
    String modelInvariantUUID = "modelInvariantUUID";
    String modelVersionUUID = "modelUUID";
    String policyName = "policyName";
    ModelInfoConfiguration expected = new ModelInfoConfiguration();
    expected.setModelCustomizationId(modelCustUUID);
    expected.setModelInvariantId(modelInvariantUUID);
    expected.setModelVersionId(modelVersionUUID);
    expected.setPolicyName(policyName);
    ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
    configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
    configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
    configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
    configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
    CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
    policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
    policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
    policyNameTable.setPolicyName(policyName);
    ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
    assertThat(actual, sameBeanAs(expected));
}
Also used : ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Aggregations

CvnfcCustomization (org.onap.so.db.catalog.beans.CvnfcCustomization)16 ArrayList (java.util.ArrayList)12 Test (org.junit.Test)10 CvnfcConfigurationCustomization (org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization)9 ConfigurationResource (org.onap.so.db.catalog.beans.ConfigurationResource)7 VnfcCustomization (org.onap.so.db.catalog.beans.VnfcCustomization)7 VfModule (org.onap.so.db.catalog.beans.VfModule)6 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)6 VnfResource (org.onap.so.db.catalog.beans.VnfResource)5 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)5 Transactional (org.springframework.transaction.annotation.Transactional)4 List (java.util.List)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 BaseTest (org.onap.so.db.catalog.BaseTest)2 CollectionNetworkResourceCustomization (org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization)2 CollectionResourceInstanceGroupCustomization (org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization)2 ConfigurationResourceCustomization (org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)2 InstanceGroup (org.onap.so.db.catalog.beans.InstanceGroup)2