Resolve files with licensing issues in Babel
[aai/babel.git] / src / test / java / org / onap / aai / babel / service / TestCsarToXmlConverter.java
index 244eccd..ef3fb28 100644 (file)
@@ -100,26 +100,6 @@ public class TestCsarToXmlConverter {
                 SERVICE_VERSION);
     }
 
-    /**
-     * Test that an Exception is thrown when the Artifact Generator properties are not present.
-     *
-     * @throws CsarConverterException
-     *             if there is an error either extracting the YAML files or generating XML artifacts
-     * @throws IOException
-     *             if an I/O exception occurs loading the test CSAR file
-     */
-    @Test
-    public void testArtifactGeneratorConfigMissing() throws CsarConverterException, IOException {
-        exception.expect(IllegalArgumentException.class);
-        exception.expectMessage("Cannot generate artifacts. System property "
-                + ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE + " not configured");
-
-        // Unset the required system property
-        System.clearProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE);
-        converter.generateXmlFromCsar(CsarTest.SD_WAN_CSAR_FILE.getContent(), CsarTest.SD_WAN_CSAR_FILE.getName(),
-                SERVICE_VERSION);
-    }
-
     /**
      * Test that an Exception is thrown when the Artifact Generator's TOSCA Mappings configuration file is not present.
      *
@@ -168,6 +148,25 @@ public class TestCsarToXmlConverter {
                 CsarTest.NETWORK_COLLECTION_CSAR_FILE);
     }
 
+    @Test
+    public void generateXmlFromCosAvpnCsar() throws IOException, CsarConverterException {
+        List<String> filesToLoad = new ArrayList<>();
+        filesToLoad.add("AAI-COS_AVPN-service-1.0.xml");
+        filesToLoad.add("AAI-VLAN Network Receptor Configuration-resource-3.0.xml");
+        filesToLoad.add("AAI-VRF Entry Configuration-resource-3.0.xml");
+        assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.COS_AVPN_CSAR_FILE);
+    }
+
+    @Test
+    public void generateXmlFromRgCollector615Csar() throws IOException, CsarConverterException {
+        List<String> filesToLoad = new ArrayList<>();
+        filesToLoad.add("AAI-RG_collector_6-15-service-1.0.xml");
+        filesToLoad.add("AAI-Network Res 1806-resource-4.0.xml");
+        filesToLoad.add("AAI-Network Res 1806..NetworkCollection..0-resource-1.xml");
+        filesToLoad.add("AAI-ExtVL-resource-48.0.xml");
+        assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.RG_COLLECTOR_615_CSAR_FILE);
+    }
+
     @Test
     public void generatePortMirrorConfigurationModel()
             throws CsarConverterException, IOException, XmlArtifactGenerationException {
@@ -187,6 +186,18 @@ public class TestCsarToXmlConverter {
         assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.SERVICE_PROXY_CSAR_FILE);
     }
 
+
+    public void generateChildResourcesCsar()
+            throws CsarConverterException, IOException, XmlArtifactGenerationException {
+
+        List<String> filesToLoad = new ArrayList<>();
+        filesToLoad.add("AAI-Network Cloud VNF Service MOCK-service-1.0.xml");
+        filesToLoad.add("AAI-NetworkCloudVnfMock..NC1_Test_Heat_08152018_base..module-0-resource-1.xml");
+        filesToLoad.add("AAI-Network Cloud VNF MOCK-resource-1.0.xml");
+        filesToLoad.add("AAI-Fabric Configuration-resource-10.0.xml");
+        assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.CHILD_RESOURCE_CSAR_FILE);
+    }
+
     /**
      * A Matcher for comparing generated XML Strings with expected XML content.
      *