From bfde3ef00beb3c6f31cebfd12e90b9b9cdcc492e Mon Sep 17 00:00:00 2001 From: "mark.j.leonard" Date: Tue, 26 Mar 2019 13:38:40 +0000 Subject: Remove all references to artifactgenerator config Delete the artifact-generator.properties file. Remove all related functionality from the code. Change-Id: I652d99b6424bb60af5820f5afb97ef139e3f9511 Issue-ID: AAI-2284 Signed-off-by: mark.j.leonard --- .../parser/TestArtifactGeneratorToscaParser.java | 13 ------------- .../aai/babel/service/TestCsarToXmlConverter.java | 20 -------------------- .../org/onap/aai/babel/util/ArtifactTestUtils.java | 14 -------------- src/test/java/org/onap/aai/babel/util/Resources.java | 1 - .../xml/generator/TestAaiArtifactGenerator.java | 1 - .../aai/babel/xml/generator/model/TestModel.java | 6 ++---- .../aai/babel/xml/generator/model/TestVfModule.java | 6 ++---- .../aai/babel/xml/generator/model/TestWidget.java | 6 ++---- src/test/resources/artifact-generator.properties | 0 9 files changed, 6 insertions(+), 61 deletions(-) delete mode 100644 src/test/resources/artifact-generator.properties (limited to 'src/test') diff --git a/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java b/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java index 7bc9fa8..50812c9 100644 --- a/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java +++ b/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java @@ -56,18 +56,6 @@ public class TestArtifactGeneratorToscaParser { private static final String TEST_UUID = "1234"; - /** - * Initialize the Generator with an invalid artifact generator properties file path. - * - * @throws IOException - * if an error occurs reading the configuration properties - */ - @Test(expected = IllegalArgumentException.class) - public void testMissingPropertiesFile() throws IOException { - System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE, "non-existent.file"); - ArtifactGeneratorToscaParser.initWidgetConfiguration(); - } - /** * Initialize the Generator with an invalid mappings file path. * @@ -176,7 +164,6 @@ public class TestArtifactGeneratorToscaParser { public void testAddWidgetToService() throws IOException, XmlArtifactGenerationException { ArtifactTestUtils testUtils = new ArtifactTestUtils(); testUtils.loadWidgetMappings(); - testUtils.loadWidgetToUuidMappings(); Model serviceModel = new Service(); Resource resourceModel = new Resource(WidgetType.valueOf("VF"), false); diff --git a/src/test/java/org/onap/aai/babel/service/TestCsarToXmlConverter.java b/src/test/java/org/onap/aai/babel/service/TestCsarToXmlConverter.java index 244eccd..184623c 100644 --- a/src/test/java/org/onap/aai/babel/service/TestCsarToXmlConverter.java +++ b/src/test/java/org/onap/aai/babel/service/TestCsarToXmlConverter.java @@ -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. * diff --git a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java index 164c80b..066911e 100644 --- a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java +++ b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java @@ -44,7 +44,6 @@ import org.apache.commons.io.IOUtils; import org.custommonkey.xmlunit.Diff; import org.onap.aai.babel.parser.ArtifactGeneratorToscaParser; import org.onap.aai.babel.xml.generator.data.Artifact; -import org.onap.aai.babel.xml.generator.data.WidgetConfigurationUtil; import org.xml.sax.SAXException; /** @@ -60,23 +59,10 @@ public class ArtifactTestUtils { * Initialize System Properties for test configuration files. */ public void setGeneratorSystemProperties() { - System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE, - getResourcePath(Resources.ARTIFACT_GENERATOR_CONFIG)); - System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE, getResourcePath(Resources.TOSCA_MAPPING_CONFIG)); } - /** - * Load the Widget to UUID mappings from the Artifact Generator Properties (resource). - * - * @throws IOException - * if the properties file is not loaded - */ - public void loadWidgetToUuidMappings() throws IOException { - WidgetConfigurationUtil.setConfig(getResourceAsProperties(Resources.ARTIFACT_GENERATOR_CONFIG)); - } - /** * Load the Widget type mappings (resource). * diff --git a/src/test/java/org/onap/aai/babel/util/Resources.java b/src/test/java/org/onap/aai/babel/util/Resources.java index 72b0d1a..e089670 100644 --- a/src/test/java/org/onap/aai/babel/util/Resources.java +++ b/src/test/java/org/onap/aai/babel/util/Resources.java @@ -26,7 +26,6 @@ package org.onap.aai.babel.util; */ public class Resources { - public static final String ARTIFACT_GENERATOR_CONFIG = "artifact-generator.properties"; public static final String TOSCA_MAPPING_CONFIG = "tosca-mappings.json"; public static final String EMPTY_TOSCA_MAPPING_CONFIG = "empty-tosca-mappings.json"; public static final String INVALID_TOSCA_MAPPING_CONFIG = "invalid-tosca-mappings.json"; diff --git a/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java b/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java index 2668e1e..b29d0d7 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java @@ -88,7 +88,6 @@ public class TestAaiArtifactGenerator { public void testParserWithIncompleteMappings() throws SdcToscaParserException, IOException, XmlArtifactGenerationException { testUtils.loadWidgetMappings(); - testUtils.loadWidgetToUuidMappings(); AaiArtifactGenerator artifactGenerator = new AaiArtifactGenerator(); WidgetType.clearElements(); // Remove all WidgetTypes so that the generator fails diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java index f1a579e..9fc5928 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java @@ -37,16 +37,14 @@ import org.onap.aai.babel.util.ArtifactTestUtils; public class TestModel { /** - * Load the Widget Configuration, including the type mappings and the UUID mappings. + * Load the Widget mapping configuration. * * @throws IOException * if the mappings configuration cannot be loaded */ @BeforeClass public static void setup() throws IOException { - ArtifactTestUtils util = new ArtifactTestUtils(); - util.loadWidgetToUuidMappings(); - util.loadWidgetMappings(); + new ArtifactTestUtils().loadWidgetMappings(); } @Test diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestVfModule.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestVfModule.java index 38931fb..88555ee 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestVfModule.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestVfModule.java @@ -41,16 +41,14 @@ import org.onap.aai.babel.xml.generator.XmlArtifactGenerationException; public class TestVfModule { /** - * Load the Widget Configuration, including the type mappings and the UUID mappings. + * Load the Widget mappings configuration. * * @throws IOException * if the mappings configuration cannot be loaded */ @BeforeClass public static void setup() throws IOException { - ArtifactTestUtils util = new ArtifactTestUtils(); - util.loadWidgetToUuidMappings(); - util.loadWidgetMappings(); + new ArtifactTestUtils().loadWidgetMappings(); } /** diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java index e5702ac..fec3479 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java @@ -39,16 +39,14 @@ import org.onap.aai.babel.xml.generator.types.ModelType; public class TestWidget { /** - * Load the Widget Configuration, including the type mappings and the UUID mappings. + * Load the Widget mappings configuration. * * @throws IOException * if the mappings configuration cannot be loaded */ @BeforeClass public static void setup() throws IOException { - ArtifactTestUtils util = new ArtifactTestUtils(); - util.loadWidgetToUuidMappings(); - util.loadWidgetMappings(); + new ArtifactTestUtils().loadWidgetMappings(); } @Test diff --git a/src/test/resources/artifact-generator.properties b/src/test/resources/artifact-generator.properties deleted file mode 100644 index e69de29..0000000 -- cgit