aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 45cdbbdfaa..d54fc98c9a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -997,6 +997,38 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
result = Deencapsulation.invoke(testSubject, "createProxyNodeTypes", componentCache, container);
Assert.assertNotNull(result);
}
+
+ @Test
+ public void testCreateServiceSubstitutionNodeTypes() throws Exception {
+ Map<String, Component> componentCache = new HashMap<>();
+
+ Component referencedService = getNewService();
+ referencedService.setInvariantUUID("uuid");
+ referencedService.setUUID("uuid");
+ referencedService.setUniqueId("targetModelUid");
+ referencedService.setDescription("desc");
+ componentCache.put("targetModelUid", referencedService);
+
+ Component containerService = new Service();
+ List<ComponentInstance> componentInstances = new ArrayList<>();
+ ComponentInstance instance = new ComponentInstance();
+ instance.setOriginType(OriginTypeEnum.ServiceSubstitution);
+ instance.setSourceModelUid("targetModelUid");
+
+ componentInstances.add(instance);
+ containerService.setComponentInstances(componentInstances);
+
+ Mockito.when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+ .thenReturn(Either.left(Collections.emptyMap()));
+ Mockito.when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ Mockito.when(capabiltyRequirementConvertor.convertRequirements(any(Map.class), any(Service.class),
+ any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+
+ ToscaTemplate toscaNode = new ToscaTemplate("1_1");
+
+ Deencapsulation.invoke(testSubject, "createServiceSubstitutionNodeTypes", componentCache, containerService, toscaNode);
+ Assert.assertNotNull(toscaNode.getNode_types());
+ }
@Test
public void testCreateProxyNodeTypesWhenGetLatestByNameReturnValue() {