Topology tree: enrich vfModules data from other versions of same model
[vid.git] / vid-app-common / src / test / java / org / onap / vid / services / AAIServiceTreeIntegrativeTest.java
index 02f127d..03b5b24 100644 (file)
@@ -56,6 +56,7 @@ import org.onap.vid.model.aaiTree.AAITreeNode;
 import org.onap.vid.model.aaiTree.FailureAAITreeNode;
 import org.onap.vid.model.aaiTree.ServiceInstance;
 import org.onap.vid.model.aaiTree.Vnf;
+import org.onap.vid.properties.Features;
 import org.onap.vid.testUtils.TestUtils;
 import org.onap.vid.utils.Logging;
 import org.springframework.http.HttpMethod;
@@ -304,7 +305,10 @@ public class AAIServiceTreeIntegrativeTest {
         TestUtils.initMockitoMocks(this);
         reboundLoggingWithMdcMock();
         aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClient, logging);
-        aaiTreeNodesEnricher = new AAITreeNodesEnricher(aaiClient, serviceModelInflator);
+        aaiTreeNodesEnricher = new AAITreeNodesEnricher(aaiClient, null, featureManager, serviceModelInflator);
+
+        when(featureManager.isActive(Features.FLAG_EXP_TOPOLOGY_TREE_VFMODULE_NAMES_FROM_OTHER_TOSCA_VERSIONS))
+            .thenReturn(true);
     }
 
     private void reboundLoggingWithMdcMock() {
@@ -320,7 +324,7 @@ public class AAIServiceTreeIntegrativeTest {
 
         when(aaiGetVersionByInvariantIdResponse.readEntity(String.class)).thenReturn(getVersionByInvariantIdResponseString);
 
-        when(sdcService.getService(any())).thenReturn(mock(ServiceModel.class));
+        when(sdcService.getServiceModelOrThrow(any())).thenReturn(mock(ServiceModel.class));
         when(serviceModelInflator.toNamesByVersionId(any())).thenReturn(ImmutableMap.of(
                  "11c6dc3e-cd6a-41b3-a50e-b5a10f7157d0", new ServiceModelInflator.Names("vnf-model-customization-name", "vnf-key-in-model")
         ));
@@ -372,11 +376,11 @@ public class AAIServiceTreeIntegrativeTest {
         when(aaiGetVersionByInvariantIdResponse.readEntity(String.class)).
                 thenReturn(TestUtils.readFileAsString("/getTopology/serviceWithCR/service-design-and-creation.json"));
 
-        when(sdcService.getService(any())).thenReturn(
+        when(sdcService.getServiceModelOrThrow(any())).thenReturn(
                 TestUtils.readJsonResourceFileAsObject("/getTopology/serviceWithCR/serviceWithCRModel.json", ServiceModel.class));
 
         ServiceInstance serviceInstance = new AAIServiceTree(aaiTreeNodeBuilder,
-            new AAITreeNodesEnricher(aaiClient, new ServiceModelInflator()), aaiTreeConverter, sdcService, executorService)
+            new AAITreeNodesEnricher(aaiClient, null, featureManager, new ServiceModelInflator()), aaiTreeConverter, sdcService, executorService)
                 .getServiceInstanceTopology("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", "Emanuel", "a565e6ad-75d1-4493-98f1-33234b5c17e2");
 
         String expected = TestUtils.readFileAsString("/getTopology/serviceWithCR/getTopologyWithCR.json");
@@ -440,7 +444,7 @@ public class AAIServiceTreeIntegrativeTest {
 
         when(aaiGetVersionByInvariantIdResponse.readEntity(String.class)).thenReturn(getVersionByInvariantIdResponseString);
 
-        when(sdcService.getService(any())).thenReturn(mock(ServiceModel.class));
+        when(sdcService.getServiceModelOrThrow(any())).thenReturn(mock(ServiceModel.class));
         when(serviceModelInflator.toNamesByVersionId(any())).thenReturn(ImmutableMap.of());
 
         new AAIServiceTree(aaiTreeNodeBuilder, aaiTreeNodesEnricher, aaiTreeConverter, sdcService, executorService)