From dc58ff4151e8a10364ede31ba25f3a0e49344c20 Mon Sep 17 00:00:00 2001 From: ojasdubey Date: Thu, 27 Jun 2019 12:33:35 +0530 Subject: Fix artifact implementation proxy node type Removing the operation implementation from proxy node type in parent service tosca as it will be present in the proxy node template Change-Id: Id414d6cdd5f5f4ccb1d7c235fbc8b7cdf1ec4147 Issue-ID: SDC-2395 Signed-off-by: ojasdubey --- .../sdc/be/tosca/ToscaExportUtilsTest.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'catalog-be/src/test') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java index 1906b9eeb9..2ccf7e0716 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java @@ -18,14 +18,14 @@ package org.openecomp.sdc.be.tosca; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Optional; import org.junit.Assert; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.InputDefinition; @@ -140,6 +140,35 @@ public class ToscaExportUtilsTest { Assert.assertNotNull(proxyNodeTypeProperties.get("componentInputStr2")); } + @Test + public void testOperationImplementationInProxyNodeTypeNotPresent() { + Component service = getTestComponent(); + InterfaceDefinition interfaceDefinition = + service.getInterfaces().get("normalizedServiceComponentName-interface"); + interfaceDefinition.setOperations(new HashMap<>()); + final OperationDataDefinition operation = new OperationDataDefinition(); + operation.setName("start"); + operation.setDescription("op description"); + final ArtifactDataDefinition implementation = new ArtifactDataDefinition(); + implementation.setArtifactName("createBPMN.bpmn"); + operation.setImplementation(implementation); + interfaceDefinition.getOperations().put(operation.getName(), operation); + service.getInterfaces().put("normalizedServiceComponentName-interface", interfaceDefinition); + service.setInputs(Arrays.asList(createMockInput("componentInputStr1", + "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2"))); + Optional> proxyNodeTypeInterfaces = + ToscaExportUtils.getProxyNodeTypeInterfaces(service, dataTypes); + Assert.assertTrue(proxyNodeTypeInterfaces.isPresent()); + Map componentInterfaces = proxyNodeTypeInterfaces.get(); + Assert.assertNotNull(componentInterfaces); + Assert.assertEquals(1, componentInterfaces.size()); + Map proxyInterfaceDefinition = + (Map) componentInterfaces.get("serviceName"); + Map startOperationDefinition = (Map) proxyInterfaceDefinition.get("start"); + Assert.assertNotNull(startOperationDefinition); + Assert.assertNull(startOperationDefinition.get("implementation")); + } + private Component getTestComponent() { Component component = new Service(); component.setNormalizedName("normalizedServiceComponentName"); -- cgit 1.2.3-korg