summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java14
14 files changed, 418 insertions, 143 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
index d6a28cba25..1cba35dc74 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -29,16 +29,31 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Pnfs;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
@@ -51,6 +66,8 @@ public class GenericPnfCDSControllerRunnableBBTest {
@Mock
private ExtractPojosForBB extractPojosForBB;
+ @Mock
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@InjectMocks
private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
@@ -67,6 +84,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
private final static String action = "action";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
@Before
public void setUp() {
@@ -104,7 +122,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
}
@Test
- public void prepareTest() throws BBObjectNotFoundException {
+ public void prepareTest() throws BBObjectNotFoundException, PayloadGenerationException {
// given
prepareData();
@@ -119,6 +137,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertThat(abstractCDSPropertiesBean).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+ assertThat(execution.getGeneralBuildingBlock()).isNotNull();
assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
@@ -134,7 +153,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
}
- private void prepareData() throws BBObjectNotFoundException {
+ private void prepareData() throws BBObjectNotFoundException, PayloadGenerationException {
Pnf pnf = new Pnf();
ServiceInstance serviceInstance = new ServiceInstance();
@@ -149,8 +168,62 @@ public class GenericPnfCDSControllerRunnableBBTest {
modelInfoServiceInstance.setModelUuid(serviceModelUUID);
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY,
+ createGeneralBuildingBlock(createService(createPnfsList())));
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
+ doNothing().when(configureInstanceParamsForPnf).populateInstanceParams(any(), any(), any());
+ }
+
+ private Service createService(List<Pnfs> pnfList) {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setPnfs(pnfList);
+ service.setResources(resources);
+ return service;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams(serviceJson));
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams(Object serviceJson) {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", serviceJson);
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private List<Pnfs> createPnfsList() {
+ List<Map<String, String>> instanceParamsListSearchedPnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("INSTANCE_PARAM1_NAME", "INSTANCE_PARAM1_VALUE");
+ instanceParam.put("INSTANCE_PARAM2_NAME", "INSTANCE_PARAM2_VALUE");
+ Map<String, String> instanceParam2 = new HashMap<>();
+ instanceParam2.put("INSTANCE_PARAM3_NAME", "INSTANCE_PARAM3_VALUE");
+ instanceParamsListSearchedPnf.add(instanceParam);
+ instanceParamsListSearchedPnf.add(instanceParam2);
+ Pnfs searchedPnf = createPnfs("0c1ac643-377e-475b-be50-6be65f91a7ad", instanceParamsListSearchedPnf);
+
+ List<Pnfs> pnfList = new ArrayList<>();
+ pnfList.add(searchedPnf);
+ return pnfList;
+ }
+
+ private Pnfs createPnfs(String pnfModelCustomizationId, List<Map<String, String>> instanceParamsList) {
+ Pnfs pnfs = new Pnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid(pnfModelCustomizationId);
+ pnfs.setModelInfo(modelInfo);
+ pnfs.setInstanceParams(instanceParamsList);
+ return pnfs;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
new file mode 100644
index 0000000000..67f08f7108
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level.impl;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+
+public class ServiceLevelUpgradeTest {
+
+ @Test
+ public void ServiceLevelUpgradeWithPnf() throws Exception {
+ // given
+ ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+ DelegateExecution execution = prepareExecution();
+ execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "pnf");
+ // when
+ testedObject.execute(execution);
+ // then
+ assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+ .isEqualTo("GenericPnfSoftwareUpgrade");
+ assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+ }
+
+ @Test
+ public void ServiceLevelUpgradeWithVnf() throws Exception {
+ // given
+ ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+ DelegateExecution execution = prepareExecution();
+ execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "vnf");
+ // when
+ testedObject.execute(execution);
+ // then
+ assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+ .isEqualTo("GenericVnfSoftwareUpgrade");
+ assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+ }
+
+ private DelegateExecution prepareExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(ServiceLevelConstants.SERVICE_INSTANCE_ID, "serviceTest");
+ execution.setVariable(ServiceLevelConstants.BPMN_REQUEST, "bpmnRequestTest");
+ execution.setVariable(ServiceLevelConstants.PNF_NAME, "pnfNameTest");
+ return execution;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java
new file mode 100644
index 0000000000..60a0bf12d9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.vfmodule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DeleteVfModuleTest {
+
+ private static final String VF_MODULE_ID = "vfModuleIdTest";
+ private static final String HEAT_STACK_ID = "hsId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VNF_NAME = "vnfName";
+
+ private static final String CLOUD_OWNER = "cloudOwTest";
+ private static final String LCP_CLOUD_REGION_ID = "lcpClRegTest";
+ private static final String TENANT_ID = "tenantIdTest";
+ private static final String TENANT_NAME = "tenantNameTest";
+ private static final String TENANT_CONTEXT = "tenantContext";
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @InjectMocks
+ private DeleteVFModule testedObject;
+
+ @Test
+ public void createInventoryVariable_Success() throws BBObjectNotFoundException {
+ // given
+ BuildingBlockExecution buildingBlockExecution = prepareBuildingBlockExecution();
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.VF_MODULE_ID))
+ .thenReturn(prepareVmModule());
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+ .thenReturn(prepareGenericVnf());
+ // when
+ testedObject.createInventoryVariable(buildingBlockExecution);
+ // then
+ verifyExecution(buildingBlockExecution);
+ }
+
+ private void verifyExecution(BuildingBlockExecution buildingBlockExecution) {
+ CloudInformation cloudInformation = buildingBlockExecution.getVariable("cloudInformation");
+ assertThat(cloudInformation.getOwner()).isEqualTo(CLOUD_OWNER);
+ assertThat(cloudInformation.getRegionId()).isEqualTo(LCP_CLOUD_REGION_ID);
+ assertThat(cloudInformation.getTenantId()).isEqualTo(TENANT_ID);
+ assertThat(cloudInformation.getTenantName()).isEqualTo(TENANT_NAME);
+ assertThat(cloudInformation.getTenantContext()).isEqualTo(TENANT_CONTEXT);
+ assertThat(cloudInformation.getTemplateInstanceId()).isEqualTo(HEAT_STACK_ID);
+
+ assertThat(cloudInformation.getVnfId()).isEqualTo(VNF_ID);
+ assertThat(cloudInformation.getVnfName()).isEqualTo(VNF_NAME);
+ assertThat(cloudInformation.getVfModuleId()).isEqualTo(VF_MODULE_ID);
+ }
+
+ private BuildingBlockExecution prepareBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable("gBBInput", prepareGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
+ }
+
+ private GeneralBuildingBlock prepareGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner(CLOUD_OWNER);
+ cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGION_ID);
+ generalBuildingBlock.setCloudRegion(cloudRegion);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(TENANT_ID);
+ tenant.setTenantName(TENANT_NAME);
+ tenant.setTenantContext(TENANT_CONTEXT);
+ generalBuildingBlock.setTenant(tenant);
+ return generalBuildingBlock;
+ }
+
+ private VfModule prepareVmModule() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId(VF_MODULE_ID);
+ vfModule.setHeatStackId(HEAT_STACK_ID);
+ return vfModule;
+ }
+
+ private GenericVnf prepareGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
index d9fb7f676c..7f9f0417ea 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
@@ -41,10 +41,10 @@ import org.onap.aai.domain.yang.RouteTargets;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.Subnets;
import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
@@ -205,7 +205,7 @@ public class VrfValidationTest extends BaseTaskTest {
AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network);
if (networkWrapper.getRelationships().isPresent()) {
List<AAIResourceUri> vpnBindingUris =
- networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
VpnBinding vpnBinding = new VpnBinding();
vpnBinding.setRouteTargets(new RouteTargets());
vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index c1970ec32c..53d1bea1f2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -39,7 +39,6 @@ import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
@@ -78,12 +77,12 @@ import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -1584,11 +1583,11 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
- eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
@@ -1659,11 +1658,11 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
- eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
@@ -1763,13 +1762,13 @@ public class WorkflowActionTest extends BaseTaskTest {
List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>();
configurationResultWrappers.add(configurationWrapper);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper);
doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
anyObject());
org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc,
- org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
assertEquals("testConfigurationId", configuration.getConfigurationId());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
index 2c7ab92438..fcd44e137b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
@@ -28,18 +28,11 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
public class AAICollectionResourcesTest extends BaseTaskTest {
@@ -65,7 +58,8 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus());
verify(MOCK_aaiResourcesClient, times(1)).create(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
isA(org.onap.aai.domain.yang.Collection.class));
}
@@ -74,15 +68,16 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection);
aaiCollectionResources.updateCollection(networkCollection);
verify(MOCK_aaiResourcesClient, times(1)).update(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
isA(org.onap.aai.domain.yang.Collection.class));
}
@Test
public void deleteCollectionTest() throws Exception {
aaiCollectionResources.deleteCollection(networkCollection);
- verify(MOCK_aaiResourcesClient, times(1))
- .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 2bf177ef83..11694ff83f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -35,6 +35,11 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -44,11 +49,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -204,7 +204,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
@Test
public void getConfigurationTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient)
.get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
aaiConfigurationResources.getConfiguration("configurationId");
@@ -213,7 +214,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
@Test
public void deleteConfigurationTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri);
aaiConfigurationResources.deleteConfiguration("configurationId");
verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index a73cf81e75..b2978e6e62 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -36,18 +36,17 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -83,39 +82,42 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
.mapInstanceGroup(instanceGroup);
aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
isA(Optional.class));
}
@Test
public void deleteInstanceGroupTest() throws Exception {
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1))
- .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
public void connectInstanceGroupTest() throws Exception {
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())));
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))));
}
@Test
public void connectInstanceGroupWithEdgeTest() throws Exception {
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))),
eq(AAIEdgeLabel.BELONGS_TO));
}
@Test
public void existsTest() throws Exception {
aaiInstanceGroupResources.exists(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1))
- .exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).exists(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
@@ -135,7 +137,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
.queryParam("instance-group-name", "instanceGroupName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -144,7 +146,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
.queryParam("instance-group-name", "instanceGroupName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index 3bc4fc0503..535a159e10 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -46,6 +46,14 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -55,15 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -167,7 +166,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<VpnBinding> oVpnBinding = Optional.empty();
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID");
+ AAIResourceUri aaiUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri);
@@ -186,7 +186,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
AAIResourceUri netPolicyUri =
- AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
@@ -204,7 +204,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri netPoliciesUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
@@ -222,8 +223,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<RouteTableReference> oRtref = Optional.empty();
- AAIResourceUri rTRefUri =
- AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID");
+ AAIResourceUri rTRefUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().routeTableReference("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oRtref = aaiNetworkResources.getRouteTable(rTRefUri);
@@ -310,41 +311,45 @@ public class AAINetworkResourcesTest extends TestDataSetup {
public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
}
@Test
public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
}
@Test
public void connectNetworkToCloudRegionTest() throws Exception {
aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
}
@Test
public void connectNetworkToTenantTest() throws Exception {
aaiNetworkResources.connectNetworkToTenant(network, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()))),
+ (eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())))));
}
@Test
public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception {
aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()))),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
@@ -384,9 +389,10 @@ public class AAINetworkResourcesTest extends TestDataSetup {
public void connectInstanceGroupToCloudRegionTest() throws Exception {
aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))),
eq(AAIEdgeLabel.USES));
}
@@ -396,8 +402,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty();
- AAIResourceUri subnetUri =
- AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId");
+ AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().l3Network("ModelInvariantUUID").subnet("serviceModelVersionId"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oSubnet = aaiNetworkResources.getSubnet(subnetUri);
@@ -429,8 +435,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", "networkName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
assertTrue(nameInUse);
@@ -438,8 +444,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", "networkName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
assertFalse(nameInUse);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index b8be045f97..8547ea53b4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -32,25 +32,25 @@ import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import joptsimple.internal.Strings;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import joptsimple.internal.Strings;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIPnfResourcesTest extends TestDataSetup {
@@ -118,7 +118,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), any());
@@ -131,7 +132,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
pnfTest.setRole("test");
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -143,7 +145,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
Pnf pnfTest = getPnfWithTestValues();
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -181,7 +184,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
}
@@ -192,7 +196,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
try {
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
@@ -216,7 +221,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai =
new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
try {
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
index 9f9ac88c3c..8ccb46257d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -39,6 +39,11 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -46,11 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -195,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
@@ -204,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 3dbacd2679..7cc628266b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -38,17 +38,17 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -163,7 +163,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -175,7 +175,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseIsResumeTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -186,7 +186,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 7750c8ad90..bdde1a1237 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -43,15 +43,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAIRestClientImpl;
import org.onap.aaiclient.client.aai.AAIValidatorImpl;
@@ -59,8 +50,16 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -197,18 +196,19 @@ public class AAIVnfResourcesTest extends TestDataSetup {
public void connectVnfToTenantTest() throws Exception {
aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))));
}
@Test
public void connectVnfToCloudRegionTest() throws Exception {
aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
}
@@ -244,8 +244,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIPluralResourceUri vnfUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+ .queryParam("vnf-name", "vnfName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
assertTrue(nameInUse);
@@ -253,8 +253,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIPluralResourceUri vnfUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+ .queryParam("vnf-name", "vnfName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
assertFalse(nameInUse);
@@ -262,7 +262,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void queryVnfWrapperByIdTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL);
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).depth(Depth.ALL);
final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
@@ -279,8 +280,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty();
- AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID",
- "serviceModelVersionId", "abc", "abc");
+ AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion("ModelInvariantUUID", "serviceModelVersionId").tenant("abc").vserver("abc"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oVserver = aaiVnfResources.getVserver(vserverUri);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index 0eae6a3fdc..ada59721fe 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -37,16 +37,16 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);