aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2019-03-26 13:38:40 +0000
committermark.j.leonard <mark.j.leonard@gmail.com>2019-03-28 13:19:09 +0000
commitbfde3ef00beb3c6f31cebfd12e90b9b9cdcc492e (patch)
treebe8321d3f3216b152d186f0bd23a2694bf0c7183
parent8a7d9a0d7782b9339810b02208620bdd2f0a12b2 (diff)
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 <mark.j.leonard@gmail.com>
-rw-r--r--appconfig-local/readme.txt4
-rw-r--r--pom.xml2
-rw-r--r--src/main/bin/start.sh9
-rw-r--r--src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java27
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java1
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java32
-rw-r--r--src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java13
-rw-r--r--src/test/java/org/onap/aai/babel/service/TestCsarToXmlConverter.java20
-rw-r--r--src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java14
-rw-r--r--src/test/java/org/onap/aai/babel/util/Resources.java1
-rw-r--r--src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java1
-rw-r--r--src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java6
-rw-r--r--src/test/java/org/onap/aai/babel/xml/generator/model/TestVfModule.java6
-rw-r--r--src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java6
-rw-r--r--src/test/resources/artifact-generator.properties0
15 files changed, 16 insertions, 126 deletions
diff --git a/appconfig-local/readme.txt b/appconfig-local/readme.txt
index 79cf29e..42b32f7 100644
--- a/appconfig-local/readme.txt
+++ b/appconfig-local/readme.txt
@@ -1 +1,3 @@
-Relevant configuration files need to be copied here to successfully run this service locally. \ No newline at end of file
+Relevant configuration files need to be copied here to successfully run this service locally.
+
+mvn -DKEY_STORE_PASSWORD=<obfuscated_password> spring-boot:run
diff --git a/pom.xml b/pom.xml
index fccfa93..5736290 100644
--- a/pom.xml
+++ b/pom.xml
@@ -175,7 +175,7 @@
<jvmArguments>
-DCONFIG_HOME=./appconfig-local
-DAPP_HOME=.
- -Dartifactgenerator.config=./appconfig-local/artifact-generator.properties
+ -Dtosca.mappings.config=./appconfig-local/tosca-mappings.json
-DKEY_STORE_PASSWORD=${KEY_STORE_PASSWORD}
</jvmArguments>
</configuration>
diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh
index f30a599..3121c8e 100644
--- a/src/main/bin/start.sh
+++ b/src/main/bin/start.sh
@@ -3,8 +3,8 @@
# ============LICENSE_START=======================================================
# org.onap.aai
# ================================================================================
-# Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
-# Copyright © 2017-2019 European Software Marketing Ltd.
+# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2017-2019 European Software Marketing Ltd.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,18 +22,17 @@
APP_HOME="${APP_HOME:-/opt/app/babel}"
if [ -z "${CONFIG_HOME}" ]; then
- echo "CONFIG_HOME must be set in order to start up process"
+ echo "CONFIG_HOME must be set in order to start the process"
exit 1
fi
if [ -z "${KEY_STORE_PASSWORD}" ]; then
- echo "KEY_STORE_PASSWORD must be set in order to start up process"
+ echo "KEY_STORE_PASSWORD must be set in order to start the process"
exit 1
fi
PROPS="-DAPP_HOME=${APP_HOME}"
PROPS="${PROPS} -DCONFIG_HOME=${CONFIG_HOME}"
-PROPS="${PROPS} -Dartifactgenerator.config=${CONFIG_HOME}/artifact-generator.properties"
PROPS="${PROPS} -Dtosca.mappings.config=${CONFIG_HOME}/tosca-mappings.json"
PROPS="${PROPS} -DKEY_STORE_PASSWORD=${KEY_STORE_PASSWORD}"
JVM_MAX_HEAP=${MAX_HEAP:-1024}
diff --git a/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java b/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java
index 9b66e58..c2d34c9 100644
--- a/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java
+++ b/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java
@@ -25,7 +25,6 @@ import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
@@ -33,7 +32,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Properties;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.onap.aai.babel.logging.LogHelper;
@@ -60,7 +58,6 @@ public class ArtifactGeneratorToscaParser {
private static Logger log = LogHelper.INSTANCE;
- public static final String PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE = "artifactgenerator.config";
public static final String PROPERTY_TOSCA_MAPPING_FILE = "tosca.mappings.config";
public static final String GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND =
@@ -94,30 +91,6 @@ public class ArtifactGeneratorToscaParser {
}
/**
- * Initializes the Widget to UUID mapping configuration.
- *
- * @throws IOException
- * if an error occurs reading the configuration properties
- */
- public static void initWidgetConfiguration() throws IOException {
- log.debug("Getting Widget Configuration");
- String configLocation = System.getProperty(PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE);
- if (configLocation != null) {
- File file = new File(configLocation);
- if (file.exists()) {
- Properties properties = new Properties();
- properties.load(new FileInputStream(file));
- WidgetConfigurationUtil.setConfig(properties);
- } else {
- throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGFILE_NOT_FOUND, configLocation));
- }
- } else {
- throw new IllegalArgumentException(
- String.format(GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND, PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE));
- }
- }
-
- /**
* Initializes the group filtering and TOSCA to Widget mapping configuration.
*
* @param configLocation
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java
index 2b8b128..11c1471 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java
@@ -82,7 +82,6 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
}
try {
- ArtifactGeneratorToscaParser.initWidgetConfiguration();
ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(configLocation);
} catch (IOException e) {
log.error(ApplicationMsgs.LOAD_PROPERTIES, e, configLocation);
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java b/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java
index 620f792..8f774c9 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Properties;
import org.onap.aai.babel.xml.generator.XmlArtifactGenerationException;
import org.onap.aai.babel.xml.generator.model.Resource;
import org.onap.aai.babel.xml.generator.model.Widget;
@@ -40,7 +39,6 @@ public class WidgetConfigurationUtil {
public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND =
"Cannot generate artifacts. Widget configuration not found for %s";
- private static Properties config;
private static List<String> instanceGroups = Collections.emptyList();
private static Map<String, Resource> typeToResource = new HashMap<>();
private static Map<String, Widget> typeToWidget = new HashMap<>();
@@ -52,10 +50,6 @@ public class WidgetConfigurationUtil {
throw new UnsupportedOperationException("This static class should not be instantiated!");
}
- public static void setConfig(Properties config) {
- WidgetConfigurationUtil.config = config;
- }
-
public static void setSupportedInstanceGroups(List<String> supportedInstanceGroups) {
instanceGroups = supportedInstanceGroups;
}
@@ -94,15 +88,10 @@ public class WidgetConfigurationUtil {
public static void setWidgetTypes(List<WidgetTypeConfig> types) {
WidgetType.clearElements();
for (WidgetTypeConfig type : types) {
- if (type.type == null || type.name == null) {
+ if (type.type == null || type.name == null || type.modelInvariantId == null
+ || type.modelVersionId == null) {
throw new IllegalArgumentException("Incomplete widget type specified: " + type);
}
- if (type.modelInvariantId == null) {
- type.modelInvariantId = WidgetConfigurationUtil.getModelInvariantId(type.name);
- }
- if (type.modelVersionId == null) {
- type.modelVersionId = WidgetConfigurationUtil.getModelVersionId(type.name);
- }
Widget widget = new Widget(new WidgetType(type.type), type.name, type.deleteFlag, //
type.modelInvariantId, type.modelVersionId);
typeToWidget.put(type.type, widget);
@@ -123,21 +112,4 @@ public class WidgetConfigurationUtil {
}
}
- public static String getModelInvariantId(String name) {
- String id = config.getProperty(ArtifactType.AAI.name() + ".model-invariant-id." + name);
- if (id == null) {
- throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND,
- ArtifactType.AAI.name() + ".model-invariant-id." + name));
- }
- return id;
- }
-
- public static String getModelVersionId(String name) {
- String id = config.getProperty(ArtifactType.AAI.name() + ".model-version-id." + name);
- if (id == null) {
- throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND,
- ArtifactType.AAI.name() + ".model-version-id." + name));
- }
- return id;
- }
}
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
@@ -57,18 +57,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.
*
* @throws IOException
@@ -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
@@ -101,26 +101,6 @@ public class TestCsarToXmlConverter {
}
/**
- * 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.
*
* @throws CsarConverterException
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,24 +59,11 @@ 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).
*
* @throws IOException
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
--- a/src/test/resources/artifact-generator.properties
+++ /dev/null