diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java index 18af7a035a..dc89156ee9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java @@ -25,10 +25,13 @@ import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.InterfaceDefinition; +import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertNotNull; @@ -68,6 +71,7 @@ public class ArtifactResolverTest { resource.setDeploymentArtifacts(artifact1Map); resource.setArtifacts(artifact2Map); + resource.setInterfaces(createInterfaceArtifact()); service.setDeploymentArtifacts(artifact1Map); service.setArtifacts(artifact2Map); @@ -77,6 +81,26 @@ public class ArtifactResolverTest { componentInstance.setArtifacts(artifact2Map); } + private Map<String, InterfaceDefinition> createInterfaceArtifact() { + Operation operation = new Operation(); + ArtifactDefinition artifact4 = new ArtifactDefinition(); + artifact4.setUniqueId("a4"); + operation.setImplementation(artifact4); + HashMap<String, Operation> operationsMap = new HashMap<>(); + operationsMap.put("operation", operation); + InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setOperationsMap(operationsMap); + Map<String, InterfaceDefinition> interfaces = new HashMap<>(1); + interfaces.put("someKey", interfaceDefinition); + return interfaces; + } + + @Test + public void findArtifactOnComponent_resourceInterfaceOperation() throws Exception { + assertNull(testInstance.findArtifactOnComponent(resource, ComponentTypeEnum.RESOURCE, "someId")); + assertNotNull(testInstance.findArtifactOnComponent(resource, ComponentTypeEnum.RESOURCE, "a4")); + } + @Test public void findArtifactOnComponent_noArtifactsOnComponent() throws Exception { assertNull(testInstance.findArtifactOnComponent(noArtifactsResource, ComponentTypeEnum.RESOURCE, "someId")); |