From bc077839a99429fede9cb027f58a209e72f81ba6 Mon Sep 17 00:00:00 2001 From: Yuli Shlosberg Date: Wed, 11 Oct 2017 14:13:53 +0300 Subject: GET query to toscaMode fails -bug fixed Change-Id: I9558bd14bdd4ea8d06863d11aa972e3c86b830b3 Issue-Id: SDC-300 Signed-off-by: Yuli Shlosberg (cherry picked from commit 3838a82907fe16110466df09f19d95063bc1bedf) --- .../be/components/impl/ComponentBusinessLogic.java | 13 +- .../sdc/be/info/ArtifactDefinitionInfoTest.java | 124 +++++++++++ .../sdc/be/info/GroupDefinitionInfoTest.java | 247 +++++++++++++++++++++ 3 files changed, 377 insertions(+), 7 deletions(-) create mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java create mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java (limited to 'catalog-be/src') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index 33180cd35e..a34bf00a7a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -38,11 +38,7 @@ import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.*; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapReqDef; @@ -686,8 +682,11 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { } public Either, ResponseFormat> getToscaModelByComponentUuid(ComponentTypeEnum componentType, String uuid, EnumMap additionalParam) { - - Either, StorageOperationStatus> latestVersionEither = toscaOperationFacade.getComponentListByUuid(uuid, null); + + Map additionalPropertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + additionalPropertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + + Either, StorageOperationStatus> latestVersionEither = toscaOperationFacade.getComponentListByUuid(uuid, additionalPropertiesToMatch); if (latestVersionEither.isRight()) { ResponseFormat response = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(latestVersionEither.right().value(), componentType)); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java new file mode 100644 index 0000000000..a9b9352673 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java @@ -0,0 +1,124 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.ArtifactDefinition; + + +public class ArtifactDefinitionInfoTest { + + private ArtifactDefinitionInfo createTestSubject() { + return new ArtifactDefinitionInfo(new ArtifactDefinition()); + } + + + @Test + public void testGetUniqueId() throws Exception { + ArtifactDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testSetUniqueId() throws Exception { + ArtifactDefinitionInfo testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + + @Test + public void testGetArtifactName() throws Exception { + ArtifactDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactName(); + } + + + @Test + public void testSetArtifactName() throws Exception { + ArtifactDefinitionInfo testSubject; + String artifactName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactName(artifactName); + } + + + @Test + public void testGetArtifactDisplayName() throws Exception { + ArtifactDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactDisplayName(); + } + + + @Test + public void testSetArtifactDisplayName() throws Exception { + ArtifactDefinitionInfo testSubject; + String artifactDisplayName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactDisplayName(artifactDisplayName); + } + + + @Test + public void testGetArtifactVersion() throws Exception { + ArtifactDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactVersion(); + } + + + @Test + public void testSetArtifactVersion() throws Exception { + ArtifactDefinitionInfo testSubject; + String artifactVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactVersion(artifactVersion); + } + + + @Test + public void testGetArtifactUUID() throws Exception { + ArtifactDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + + @Test + public void testSetArtifactUUID() throws Exception { + ArtifactDefinitionInfo testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } +} \ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java new file mode 100644 index 0000000000..36644c5ff7 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java @@ -0,0 +1,247 @@ +package org.openecomp.sdc.be.info; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.GroupProperty; + + +public class GroupDefinitionInfoTest { + + private GroupDefinitionInfo createTestSubject() { + return new GroupDefinitionInfo(); + } + + + @Test + public void testGetInvariantUUID() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + + @Test + public void testSetInvariantUUID() throws Exception { + GroupDefinitionInfo testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + + @Test + public void testGetName() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testSetName() throws Exception { + GroupDefinitionInfo testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testGetUniqueId() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testSetUniqueId() throws Exception { + GroupDefinitionInfo testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + + @Test + public void testGetGroupUUID() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupUUID(); + } + + + @Test + public void testSetGroupUUID() throws Exception { + GroupDefinitionInfo testSubject; + String groupUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupUUID(groupUUID); + } + + + @Test + public void testGetVersion() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testSetVersion() throws Exception { + GroupDefinitionInfo testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testGetCustomizationUUID() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUUID(); + } + + + @Test + public void testSetCustomizationUUID() throws Exception { + GroupDefinitionInfo testSubject; + String customizationUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUUID(customizationUUID); + } + + + @Test + public void testGetIsBase() throws Exception { + GroupDefinitionInfo testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsBase(); + } + + + @Test + public void testSetIsBase() throws Exception { + GroupDefinitionInfo testSubject; + Boolean isBase = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIsBase(isBase); + } + + + @Test + public void testGetArtifacts() throws Exception { + GroupDefinitionInfo testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + GroupDefinitionInfo testSubject; + List artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + + @Test + public void testGetProperties() throws Exception { + GroupDefinitionInfo testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + GroupDefinitionInfo testSubject; + List properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testGetGroupInstanceUniqueId() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupInstanceUniqueId(); + } + + + @Test + public void testSetGroupInstanceUniqueId() throws Exception { + GroupDefinitionInfo testSubject; + String groupInstanceUniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupInstanceUniqueId(groupInstanceUniqueId); + } + + + @Test + public void testToString() throws Exception { + GroupDefinitionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +} \ No newline at end of file -- cgit 1.2.3-korg