aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2018-11-07 19:13:50 +0000
committermark.j.leonard <mark.j.leonard@gmail.com>2018-11-08 12:58:32 +0000
commita2fefc003db961b717a1809b6f63c4d5ae140baa (patch)
treef048c6e8a28ac6374ec7e268df3c15bc50ab16fd /src/test/java
parenta0bd44713526d50f305116ad7751e9087952d421 (diff)
Add a CSAR test file containing an InstanceGroup
Add a test CSAR file to ensure that the ArtifactGeneratorToscaParser method processInstanceGroup() is covered, prior to refactoring. Change-Id: I277b6721c8a406631d54716aa68b313b1937e5cf Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java26
-rw-r--r--src/test/java/org/onap/aai/babel/testdata/CsarTest.java4
2 files changed, 24 insertions, 6 deletions
diff --git a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
index bf970a6..8d10412 100644
--- a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
+++ b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
@@ -23,6 +23,8 @@ package org.onap.aai.babel.service;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import java.io.IOException;
@@ -168,6 +170,16 @@ public class CsarToXmlConverterTest {
}
@Test
+ public void generateXmlFromNetworkCollectionCsar() throws IOException, CsarConverterException {
+ List<String> filesToLoad = new ArrayList<>();
+ filesToLoad.add("AAI-TEST SVC_1-service-1.0.xml");
+ filesToLoad.add("AAI-TEST CR_1-resource-7.0.xml");
+ filesToLoad.add("AAI-testcr_1..NetworkCollection..0-resource-1.xml");
+ filesToLoad.add("AAI-ExtVL-resource-40.0.xml");
+ assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.NETWORK_COLLECTION_CSAR_FILE);
+ }
+
+ @Test
public void generatePortMirrorConfigurationModel()
throws CsarConverterException, IOException, XmlArtifactGenerationException {
List<String> filesToLoad = new ArrayList<>();
@@ -202,12 +214,16 @@ public class CsarToXmlConverterTest {
private void assertThatGeneratedFilesMatchExpected(Map<String, String> expectedXmlFiles, CsarTest csarFile)
throws CsarConverterException, IOException {
- List<BabelArtifact> generatedArtifacts = converter.generateXmlFromCsar(csarFile.getContent(),
- csarFile.getName(), SERVICE_VERSION);
+ List<BabelArtifact> generatedArtifacts =
+ converter.generateXmlFromCsar(csarFile.getContent(), csarFile.getName(), SERVICE_VERSION);
assertThat("Incorrect number of files generated", //
generatedArtifacts.size(), is(equalTo(expectedXmlFiles.size())));
- generatedArtifacts
- .forEach(ga -> assertThat("The content of " + ga.getName() + " must match the expected content",
- ga.getPayload(), matches(expectedXmlFiles.get(ga.getName()))));
+ for (BabelArtifact generated : generatedArtifacts) {
+ String fileName = generated.getName();
+ String expectedXml = expectedXmlFiles.get(fileName);
+ assertThat("Missing expected content for " + generated.getName(), expectedXml, is(not(nullValue())));
+ assertThat("The content of " + generated.getName() + " must match the expected content",
+ generated.getPayload(), matches(expectedXml));
+ }
}
}
diff --git a/src/test/java/org/onap/aai/babel/testdata/CsarTest.java b/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
index d922e8e..0def88b 100644
--- a/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
+++ b/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
@@ -42,7 +42,9 @@ public enum CsarTest {
MISSING_METADATA_CSAR("service-MissingMetadataTest.csar"),
NO_YAML_FILES("noYmlFilesArchive.zip"),
PORT_MIRROR_CSAR("service_PortMirror.csar"),
- MULTIPLE_VNF_CSAR("catalog_csar_too_many_vnfConfigurations.csar");
+ MULTIPLE_VNF_CSAR("catalog_csar_too_many_vnfConfigurations.csar"),
+ NETWORK_COLLECTION_CSAR_FILE("service_NetworkCollection.csar");
+
// @formatter:on
private String filename;