aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java95
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java6
5 files changed, 139 insertions, 63 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 4755e58582..9195df0955 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -39,12 +39,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -80,6 +80,7 @@ import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -87,10 +88,11 @@ public class BBInputSetupMapperLayerTest {
BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
+
@Test
public void testMapOrchestrationStatusFromAAI() {
OrchestrationStatus expected = OrchestrationStatus.INVENTORIED;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index dd79d2772f..127253a72e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -59,7 +59,6 @@ import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-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.aai.entities.uri.AAIUriFactory;
@@ -69,12 +68,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -1337,6 +1336,10 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
@@ -1348,7 +1351,8 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
- .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateConfiguration(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1374,6 +1378,52 @@ public class BBInputSetupTest {
}
@Test
+ public void testPopulateConfigurationReplace() throws JsonParseException, JsonMappingException, IOException {
+ String instanceName = "configurationName";
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setConfigurationName("configurationName");
+ serviceInstance.getConfigurations().add(configuration);
+ String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
+ // Mock service
+ Service service = mapper.readValue(
+ new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+ ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
+ configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ service.getConfigurationCustomizations().add(configurationCust);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setNewService(service);
+
+ ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).setIsReplace(true).build();
+ SPY_bbInputSetup.populateConfiguration(parameter);
+ configResourceKeys.setVnfResourceCustomizationUUID("my-test-uuid");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ }
+
+ @Test
public void testMapCatalogConfiguration() {
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
L3Network network = new L3Network();
@@ -1420,6 +1470,9 @@ public class BBInputSetupTest {
vnfc.setVnfcName(vnfcName);
RequestDetails requestDetails = new RequestDetails();
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
new CvnfcConfigurationCustomization();
ConfigurationResource configurationResource = new ConfigurationResource();
@@ -1432,7 +1485,8 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
- .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateConfiguration(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1462,6 +1516,10 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
String bbName = AssignFlows.VNF.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
Platform expectedPlatform = new Platform();
LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
String resourceId = "123";
@@ -1481,7 +1539,8 @@ public class BBInputSetupTest {
.setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName)
.setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
.setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
- .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build();
+ .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId())
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateGenericVnf(parameter);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
@@ -1770,7 +1829,8 @@ public class BBInputSetupTest {
expectedAAI.setRelationshipList(relationshipList);
Configuration expected = new Configuration();
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
AAIResultWrapper configurationWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
@@ -1794,7 +1854,8 @@ public class BBInputSetupTest {
expectedAAI.setRelationshipList(relationshipList);
GenericVnf expected = new GenericVnf();
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"));
AAIResultWrapper vnfWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
@@ -1824,7 +1885,7 @@ public class BBInputSetupTest {
expectedAAI.setRelationshipList(relationshipList);
Pnf expected = new Pnf();
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId");
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf("pnfId"));
AAIResultWrapper pnfWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
@@ -1948,7 +2009,8 @@ public class BBInputSetupTest {
List<L3Network> l3Networks = new ArrayList<>();
AAIResultWrapper l3NetworksWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network("networkId"));
doReturn(l3NetworksWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthTwo(aaiResourceUri);
doReturn(expected).when(bbInputSetupMapperLayer).mapAAIL3Network(isA(org.onap.aai.domain.yang.L3Network.class));
@@ -3362,7 +3424,7 @@ public class BBInputSetupTest {
String vnfcName = "vnfcName";
org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
AAIResultWrapper configurationWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index b623475939..c65b36a40c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -65,33 +64,35 @@ import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.aai.domain.yang.VpnBinding;
+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;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
-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.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.graphinventory.entities.uri.Depth;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class BBInputSetupUtilsTest {
- protected ObjectMapper mapper = new ObjectMapper();
+ protected ObjectMapper mapper =
+ new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);;
private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
@InjectMocks
@@ -178,8 +179,10 @@ public class BBInputSetupUtilsTest {
Optional<CloudRegion> expected = Optional.of(new CloudRegion());
doReturn(expected).when(MOCK_aaiResourcesClient).get(CloudRegion.class,
- AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(),
- cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO));
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()))
+ .depth(Depth.TWO));
assertThat(bbInputSetupUtils.getCloudRegion(cloudConfig), sameBeanAs(expected.get()));
}
@@ -207,7 +210,7 @@ public class BBInputSetupUtilsTest {
expected.get().setId(instanceGroupId);
doReturn(expected).when(MOCK_aaiResourcesClient).get(InstanceGroup.class,
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId)));
assertThat(bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId), sameBeanAs(expected.get()));
}
@@ -224,7 +227,7 @@ public class BBInputSetupUtilsTest {
expected.get().setGlobalCustomerId(globalSubscriberId);
doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class,
- AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)));
assertThat(bbInputSetupUtils.getAAICustomer(globalSubscriberId), sameBeanAs(expected.get()));
}
@@ -243,8 +246,8 @@ public class BBInputSetupUtilsTest {
expected.get().setServiceType(subscriptionServiceType);
doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class,
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId,
- subscriptionServiceType));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)));
assertThat(bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType),
sameBeanAs(expected.get()));
@@ -285,9 +288,12 @@ public class BBInputSetupUtilsTest {
ServiceInstance expected = new ServiceInstance();
expected.setServiceInstanceId(serviceInstanceId);
- doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(ServiceInstance.class, AAIUriFactory
- .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId)
- .depth(Depth.TWO));
+ doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient)
+ .get(ServiceInstance.class,
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)
+ .serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
+ .depth(Depth.TWO));
assertThat(bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType,
serviceInstanceId), sameBeanAs(expected));
@@ -319,8 +325,8 @@ public class BBInputSetupUtilsTest {
serviceInstances.getServiceInstance().add(expectedServiceInstance);
AAIPluralResourceUri expectedUri = AAIUriFactory
- .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType())
+ .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances())
.queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO);
bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer);
@@ -401,14 +407,15 @@ public class BBInputSetupUtilsTest {
mapper.readValue(new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class);
doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)));
assertThat(bbInputSetupUtils.getAAIGenericVnf(vnfId), sameBeanAs(expectedAaiVnf));
}
@Test
public void getAAIResourceDepthOneTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId"));
AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE);
AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone();
@@ -420,7 +427,8 @@ public class BBInputSetupUtilsTest {
@Test
public void getAAIResourceDepthTwoTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId"));
AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO);
AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone();
@@ -515,8 +523,8 @@ public class BBInputSetupUtilsTest {
vnf.setVnfId(vnfId);
vnf.setVnfName(vnfName);
doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName));
Optional<GenericVnf> actual =
this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
assertTrue(actual.isPresent());
@@ -544,8 +552,8 @@ public class BBInputSetupUtilsTest {
volumeGroup.setVolumeGroupId(volumeGroupId);
volumeGroup.setVolumeGroupName(volumeGroupName);
doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName));
Optional<VolumeGroup> actual =
this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
@@ -571,8 +579,10 @@ public class BBInputSetupUtilsTest {
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP)
+ AAIUriFactory
+ .createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123"))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "volume-group-name123"));
Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("vnf-id123",
"vf-module-id123", "volume-group-name123");
@@ -619,8 +629,10 @@ public class BBInputSetupUtilsTest {
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ AAIUriFactory
+ .createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123"))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment()));
Optional<VolumeGroup> actual =
this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("vnf-id123", "vf-module-id123");
assertTrue(actual.isPresent());
@@ -678,8 +690,8 @@ public class BBInputSetupUtilsTest {
configuration.setConfigurationId("id123");
doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class,
Configuration.class,
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "service-instance-id123")
- .relatedTo(AAIObjectPlurals.CONFIGURATION)
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123"))
+ .relatedTo(Types.CONFIGURATIONS.getFragment())
.queryParam("configuration-name", "configuration-name123"));
Optional<Configuration> actual = this.bbInputSetupUtils
.getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123");
@@ -689,8 +701,8 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIVfModuleGloballyByNameTest() {
- AAIPluralResourceUri expectedUri =
- AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule");
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
+ .queryParam("vf-module-name", "testVfModule");
bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule");
verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -698,8 +710,9 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIConfigurationGloballyByNameTest() {
- AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", "testConfig");
+ AAIPluralResourceUri expectedUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configurations())
+ .queryParam("configuration-name", "testConfig");
bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig");
verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -707,8 +720,8 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAINetworksGloballyByNameTest() {
- AAIPluralResourceUri expectedUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork");
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", "testNetwork");
bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork");
verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -716,7 +729,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIVolumeGroupGloballyByNameTest() {
- AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "testVoumeGroup");
bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
index edd214f85f..4d034a19e8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import java.io.File;
@@ -38,14 +37,14 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -143,14 +142,14 @@ public class CloudInfoFromAAITest {
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion));
cloudRegions.add(cloudRegionWrapper);
- doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION);
+ doReturn(cloudRegions).when(relationships).getByType(Types.CLOUD_REGION);
List<AAIResultWrapper> tenants = new ArrayList<>();
org.onap.aai.domain.yang.Tenant tenant = new org.onap.aai.domain.yang.Tenant();
tenant.setTenantId(tenantId);
AAIResultWrapper tenantWrapper =
new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(tenant));
tenants.add(tenantWrapper);
- doReturn(tenants).when(relationships).getByType(AAIObjectType.TENANT);
+ doReturn(tenants).when(relationships).getByType(Types.TENANT);
Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
index e05a3bda8f..fff495f9a8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
@@ -34,14 +34,14 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.BaseTest;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.mock.FileUtil;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.beans.BeanUtils;
@@ -71,7 +71,7 @@ public class ExceptionBuilderTest extends BaseTest {
auditList.setAuditType("create");
auditList.setHeatStackName("testStackName");
AAIObjectAudit vserver = new AAIObjectAudit();
- vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vserver.setAaiObjectType(Types.VSERVER.typeName());
vserver.setDoesObjectExist(false);
Vserver vs = new Vserver();
vs.setVserverId("testVServerId");