aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennie Jia <Jennie.Jia@amdocs.com>2018-08-22 15:59:30 +0000
committerJennie Jia <Jennie.Jia@amdocs.com>2018-08-22 16:00:39 +0000
commitb7b2f15bd99597c365e690a6237b3c80c2465d18 (patch)
tree48ae3044f2d1a7f4d82af8ab1f9e2fe17b5a6832
parent4fdbacb857cbfe84001ef354356cca024292f42b (diff)
Add more Junit test for SDC Context Builder
Issue-ID: LOG-622 Change-Id: I8b4f6ad164b4367eb785c51ea594c9971f0743f4 Signed-off-by: Jennie Jia <Jennie.Jia@amdocs.com>
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/model/test/ArtifactInfoTest.java19
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java21
2 files changed, 33 insertions, 7 deletions
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/model/test/ArtifactInfoTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/model/test/ArtifactInfoTest.java
index 2ebb891..ff4584c 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/sdc/model/test/ArtifactInfoTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/model/test/ArtifactInfoTest.java
@@ -18,9 +18,9 @@
package org.onap.pomba.contextbuilder.sdc.model.test;
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.onap.pomba.contextbuilder.sdc.model.ArtifactInfo;
+import org.openecomp.sdc.api.notification.IArtifactInfo;
public class ArtifactInfoTest {
@@ -31,8 +31,25 @@ public class ArtifactInfoTest {
ArtifactInfo artifact = new ArtifactInfo();
artifact.setArtifactType(artifactType);
artifact.setArtifactURL(url);
+ artifact.setArtifactChecksum("artifactChecksum");
+ artifact.setArtifactDescription("artifactDescription");
+ artifact.setArtifactName("artifactName");
+ artifact.setArtifactTimeout(1000);
+ artifact.setArtifactUUID("ae04b88e-e2ee-4ce9-a62d-3d08cf0f46db");
+ artifact.setArtifactVersion("artifactVersion");
+
+ IArtifactInfo generatedArtifactTest=(IArtifactInfo)artifact;
+ artifact.setGeneratedArtifact(generatedArtifactTest);
assertEquals(artifactType, artifact.getArtifactType());
assertEquals(url, artifact.getArtifactURL());
+ assertEquals("artifactChecksum", artifact.getArtifactChecksum());
+ assertEquals("artifactDescription", artifact.getArtifactDescription());
+ assertEquals("artifactName", artifact.getArtifactName());
+ assertEquals(Integer.valueOf(1000), artifact.getArtifactTimeout());
+ assertEquals("ae04b88e-e2ee-4ce9-a62d-3d08cf0f46db", artifact.getArtifactUUID());
+ assertEquals("artifactVersion", artifact.getArtifactVersion());
+ assertEquals(generatedArtifactTest, artifact.getGeneratedArtifact());
+
}
} \ No newline at end of file
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java
index 8f16d5e..a346dd3 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java
@@ -18,6 +18,7 @@
package org.onap.pomba.contextbuilder.sdc.test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.pomba.contextbuilder.sdc.ToscaBuilderConfig;
@@ -33,12 +34,20 @@ public class ToscaBuildConfigTest {
configTest.setCsarFileSuffix(".zip");
configTest.setArtifactType("TOSCA_CSAR");
configTest.setUrlTemplate(urlTemplate);
-
-
- assertEquals(configTest.getCsarFilePrefix().toString(), "csar-");
- assertEquals(configTest.getCsarFileSuffix().toString(), ".zip");
- assertEquals(configTest.getArtifactType().toString(), "TOSCA_CSAR");
- assertEquals(configTest.getUrlTemplate().toString(), urlTemplate);
+ configTest.setTestToscaCsarFile("/src/test/toscaModel.zip");
+
+ assertEquals("csar-", configTest.getCsarFilePrefix());
+ assertEquals(".zip", configTest.getCsarFileSuffix());
+ assertEquals("TOSCA_CSAR", configTest.getArtifactType());
+ assertEquals(urlTemplate, configTest.getUrlTemplate());
+ assertEquals("/src/test/toscaModel.zip", configTest.getTestToscaCsarFile());
+
+ String str= configTest.toString();
+ assertTrue(str.contains("TOSCA_CSAR"));
+ assertTrue(str.contains("csar-"));
+ assertTrue(str.contains(".zip"));
+ assertTrue(str.contains("/sdc/v1/catalog/services/e9851a43-c068-4eb2-9fe7-2d123bd94ff0/toscaModel"));
+ assertTrue(str.contains("/src/test/toscaModel.zip"));
}