From b7b2f15bd99597c365e690a6237b3c80c2465d18 Mon Sep 17 00:00:00 2001 From: Jennie Jia Date: Wed, 22 Aug 2018 15:59:30 +0000 Subject: Add more Junit test for SDC Context Builder Issue-ID: LOG-622 Change-Id: I8b4f6ad164b4367eb785c51ea594c9971f0743f4 Signed-off-by: Jennie Jia --- .../sdc/model/test/ArtifactInfoTest.java | 19 ++++++++++++++++++- .../sdc/test/ToscaBuildConfigTest.java | 21 +++++++++++++++------ 2 files changed, 33 insertions(+), 7 deletions(-) (limited to 'src') 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")); } -- cgit 1.2.3-korg