summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSébastien Determe <sd378r@intl.att.com>2018-03-21 14:05:17 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-21 14:05:17 +0000
commitaf455560f39b716a8d770a39012e4004ac03e9f3 (patch)
tree853cc2dee561c9f121f783bd9b4d71aa4b3403ae /src/test
parent3dc5f2a4a5c066a57ef0ce346be884b045ae73c9 (diff)
parent69785b88e46c6bcf5f94f2db2a1c097b08bacc7c (diff)
Merge changes from topic 'feature/sdc-controller'
* changes: Rework the code CsarHandler rework Add new config classes
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java9
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java17
2 files changed, 10 insertions, 16 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java
index 1caa637c5..be2997a31 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java
@@ -35,7 +35,6 @@ import java.security.Principal;
import java.util.List;
import javax.ws.rs.core.SecurityContext;
-import javax.xml.transform.TransformerException;
import org.junit.Before;
import org.junit.Test;
@@ -93,13 +92,7 @@ public class CldsTemplateServiceItCase {
cldsTemplate.setBpmnText(bpmnText);
cldsTemplate.setImageText(imageText);
cldsTemplate.setPropText(bpmnPropText);
- try {
- cldsTemplateService.putTemplate("testModel", cldsTemplate);
- } catch (IOException e) {
- logger.error("IOException while saving template", e);
- } catch (TransformerException ex) {
- logger.error("Transforming exception while saving template.", ex);
- }
+ cldsTemplateService.putTemplate("testModel", cldsTemplate);
}
@Test
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
index d1b177d22..34805d87a 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
@@ -38,7 +38,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
-import org.junit.AfterClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
@@ -54,13 +53,6 @@ public class CsarHandlerTest {
private static final String sdcFolder = "/tmp/csar-handler-tests";
private static final String csarArtifactName = "testArtifact.csar";
- @AfterClass
- public static void removeAllFiles() throws IOException {
- // Do some cleanup
- Path path = Paths.get(sdcFolder + "/test-controller/" + csarArtifactName);
- Files.deleteIfExists(path);
- }
-
@Test
public void testConstructor() throws CsarHandlerException {
IArtifactInfo serviceArtifact = Mockito.mock(IArtifactInfo.class);
@@ -96,9 +88,18 @@ public class CsarHandlerTest {
IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
+ // Test the save
csar.save(resultArtifact);
assertTrue((new File(sdcFolder + "/test-controller/" + csarArtifactName)).exists());
assertEquals(csarArtifactName, csar.getArtifactElement().getArtifactName());
assertNotNull(csar.getSdcCsarHelper());
+ // Test dcaeBlueprint
+ String blueprint = csar.getDcaeBlueprint();
+ assertNotNull(blueprint);
+ assertTrue(!blueprint.isEmpty());
+ assertTrue(blueprint.contains("DCAE-VES-PM-EVENT-v1"));
+ // Do some cleanup
+ Path path = Paths.get(sdcFolder + "/test-controller/" + csarArtifactName);
+ Files.deleteIfExists(path);
}
}