aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtilsTest.java78
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java35
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/NodeTypeConvertUtilsTest.java18
3 files changed, 131 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtilsTest.java
new file mode 100644
index 0000000000..0e564c1249
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtilsTest.java
@@ -0,0 +1,78 @@
+package org.openecomp.sdc.be.datamodel.utils;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.be.info.ArtifactTemplateInfo;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+
+public class ArtifactUtilsTest {
+
+ private ArtifactUtils createTestSubject() {
+ return new ArtifactUtils();
+ }
+
+ @Test
+ public void testFindMasterArtifact() throws Exception {
+ Map<String, ArtifactDefinition> deplymentArtifact = new HashMap<>();
+ List<ArtifactDefinition> artifacts = new LinkedList<>();
+ List<String> artifactsList = new LinkedList<>();
+ ArtifactDefinition result;
+
+ // default test
+ result = ArtifactUtils.findMasterArtifact(deplymentArtifact, artifacts, artifactsList);
+ }
+
+ @Test
+ public void testBuildJsonForUpdateArtifact() throws Exception {
+ String artifactId = "";
+ String artifactName = "";
+ String artifactType = "";
+ ArtifactGroupTypeEnum artifactGroupType = ArtifactGroupTypeEnum.DEPLOYMENT;
+ String label = "";
+ String displayName = "";
+ String description = "";
+ byte[] artifactContentent = new byte[] { ' ' };
+ List<ArtifactTemplateInfo> updatedRequiredArtifacts = null;
+ boolean isFromCsar = false;
+ Map<String, Object> result;
+
+ // test 1
+ artifactId = null;
+ result = ArtifactUtils.buildJsonForUpdateArtifact(artifactId, artifactName, artifactType, artifactGroupType,
+ label, displayName, description, artifactContentent, updatedRequiredArtifacts, isFromCsar);
+
+ // test 2
+ /*artifactId = "";
+ result = ArtifactUtils.buildJsonForUpdateArtifact(artifactId, artifactName, artifactType, artifactGroupType,
+ label, displayName, description, artifactContentent, updatedRequiredArtifacts, isFromCsar);
+ Assert.assertEquals(null, result);*/
+ }
+
+ @Test
+ public void testBuildJsonForArtifact() throws Exception {
+ ArtifactTemplateInfo artifactTemplateInfo = new ArtifactTemplateInfo();
+ artifactTemplateInfo.setFileName("mock.mock.heat");
+ byte[] artifactContentent = new byte[] { ' ' };
+ int atrifactLabelCounter = 0;
+ Map<String, Object> result;
+
+ // default test
+ result = ArtifactUtils.buildJsonForArtifact(artifactTemplateInfo, artifactContentent, atrifactLabelCounter);
+ }
+
+ @Test
+ public void testFindArtifactInList() throws Exception {
+ List<ArtifactDefinition> createdArtifacts = new LinkedList<>();
+ String artifactId = "mock";
+ ArtifactDefinition result;
+
+ // default test
+ result = ArtifactUtils.findArtifactInList(createdArtifacts, artifactId);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java
new file mode 100644
index 0000000000..5ed11a553e
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java
@@ -0,0 +1,35 @@
+package org.openecomp.sdc.be.datamodel.utils;
+
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_INPUT_PARAMETERS;
+
+import java.util.LinkedList;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
+import org.openecomp.sdc.be.model.Operation;
+
+public class InterfaceUIDataConverterTest {
+
+ @Test
+ public void testConvertInterfaceDataToOperationData() throws Exception {
+ InterfaceOperationDataDefinition interfaceOperation = new InterfaceOperationDataDefinition();
+ Operation result;
+
+ // default test
+ result = InterfaceUIDataConverter.convertInterfaceDataToOperationData(interfaceOperation);
+ }
+
+ @Test
+ public void testConvertOperationDataToInterfaceData() throws Exception {
+ Operation operationData = new Operation();
+ InterfaceOperationDataDefinition result;
+ ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>();
+ operationData.setInputs(inputs);
+ operationData.setImplementation(new ArtifactDataDefinition());
+ // default test
+ result = InterfaceUIDataConverter.convertOperationDataToInterfaceData(operationData);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/NodeTypeConvertUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/NodeTypeConvertUtilsTest.java
new file mode 100644
index 0000000000..d75d760076
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/NodeTypeConvertUtilsTest.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.be.datamodel.utils;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+
+public class NodeTypeConvertUtilsTest {
+
+ @Test
+ public void testGetCategoryNodeTypeByComponentParam() throws Exception {
+ // test 1
+ for (ComponentTypeEnum comp : ComponentTypeEnum.values()) {
+ for (CategoryTypeEnum cat : CategoryTypeEnum.values()) {
+ NodeTypeConvertUtils.getCategoryNodeTypeByComponentParam(comp, cat);
+ }
+ }
+ }
+} \ No newline at end of file