aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2017-10-18 16:45:59 +0300
committerYuli Shlosberg <ys9693@att.com>2017-10-18 16:46:43 +0300
commit8c4c1dd56dedace1c59d32f5c51c285da05301bf (patch)
tree3577ce85c9ac0fbcfe50afafac402d8d9a0b910d /catalog-be
parent928b71baf3ca7b51bd5c36765eece8ef32b38197 (diff)
add more unit tests to BE components
Change-Id: Ic14375454aac2960cd9b250e98991ca073e17a24 Issue-Id: SDC-467 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java24
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java49
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java48
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java38
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java61
5 files changed, 210 insertions, 10 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java
index d8b82da396..95845c3660 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java
@@ -20,7 +20,19 @@
package org.openecomp.sdc.be.components;
-import fj.data.Either;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Before;
import org.junit.Ignore;
@@ -70,15 +82,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
-import javax.servlet.ServletContext;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
+import fj.data.Either;
public class ServiceBusinessLogicTest {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java
new file mode 100644
index 0000000000..daacb79de5
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java
@@ -0,0 +1,49 @@
+package org.openecomp.sdc.be.servlets;
+
+import javax.annotation.Generated;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Response;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.ESArtifactData;
+
+import ch.qos.logback.classic.Logger;
+
+
+public class CsarBuildServletTest {
+
+ private CsarBuildServlet createTestSubject() {
+ return new CsarBuildServlet();
+ }
+
+
+ @Test
+ public void testGetDefaultTemplate() throws Exception {
+ CsarBuildServlet testSubject;
+ HttpServletRequest request = null;
+ String serviceName = "";
+ String serviceVersion = "";
+ Response result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getDefaultTemplate(request, serviceName, serviceVersion);
+ }
+
+
+ @Test
+ public void testGetToscaCsarTemplate() throws Exception {
+ CsarBuildServlet testSubject;
+ HttpServletRequest request = null;
+ String serviceName = "";
+ String serviceVersion = "";
+ Response result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getToscaCsarTemplate(request, serviceName, serviceVersion);
+ }
+
+
+
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java
new file mode 100644
index 0000000000..c56fd474b4
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java
@@ -0,0 +1,48 @@
+package org.openecomp.sdc.be.servlets;
+
+import javax.annotation.Generated;
+
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.junit.Test;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+
+public class RepresentationUtilsTest {
+
+ private RepresentationUtils createTestSubject() {
+ return new RepresentationUtils();
+ }
+
+
+ @Test
+ public void testConvertJsonToArtifactDefinitionForUpdate() throws Exception {
+ String content = "";
+ Class<ArtifactDefinition> clazz = null;
+ ArtifactDefinition result;
+
+ // default test
+ result = RepresentationUtils.convertJsonToArtifactDefinitionForUpdate(content, clazz);
+ }
+
+
+ @Test
+ public void testToRepresentation() throws Exception {
+ T elementToRepresent = null;
+ Object result;
+
+ // default test
+ result = RepresentationUtils.toRepresentation(elementToRepresent);
+ }
+
+
+
+
+ @Test
+ public void testConvertJsonToArtifactDefinition() throws Exception {
+ String content = "";
+ Class<ArtifactDefinition> clazz = null;
+ ArtifactDefinition result;
+
+ // default test
+ result = RepresentationUtils.convertJsonToArtifactDefinition(content, clazz);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java
new file mode 100644
index 0000000000..dec4e78008
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java
@@ -0,0 +1,38 @@
+package org.openecomp.sdc.be.tosca;
+
+import java.util.List;
+
+import javax.annotation.Generated;
+
+import org.junit.Test;
+import org.openecomp.sdc.generator.data.ArtifactType;
+
+
+public class ArtifactTypesTest {
+
+ private ArtifactTypes createTestSubject() {
+ return new ArtifactTypes();
+ }
+
+
+ @Test
+ public void testGetArtifactTypes() throws Exception {
+ ArtifactTypes testSubject;
+ List<ArtifactType> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getArtifactTypes();
+ }
+
+
+ @Test
+ public void testSetArtifactTypes() throws Exception {
+ ArtifactTypes testSubject;
+ List<ArtifactType> artifactTypes = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setArtifactTypes(artifactTypes);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java
new file mode 100644
index 0000000000..9af90bb9e4
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdc.be.tosca;
+
+import java.util.List;
+
+import javax.annotation.Generated;
+
+import org.apache.commons.lang3.tuple.Triple;
+import org.junit.Test;
+import org.openecomp.sdc.be.model.Component;
+
+
+public class ToscaRepresentationTest {
+
+ private ToscaRepresentation createTestSubject() {
+ return new ToscaRepresentation();
+ }
+
+
+ @Test
+ public void testGetMainYaml() throws Exception {
+ ToscaRepresentation testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getMainYaml();
+ }
+
+
+ @Test
+ public void testSetMainYaml() throws Exception {
+ ToscaRepresentation testSubject;
+ String mainYaml = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setMainYaml(mainYaml);
+ }
+
+
+ @Test
+ public void testGetDependencies() throws Exception {
+ ToscaRepresentation testSubject;
+ List<Triple<String, String, Component>> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getDependencies();
+ }
+
+
+ @Test
+ public void testSetDependencies() throws Exception {
+ ToscaRepresentation testSubject;
+ List<Triple<String, String, Component>> dependancies = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setDependencies(dependancies);
+ }
+} \ No newline at end of file