diff options
author | William Reehil <william.reehil@att.com> | 2022-11-15 14:31:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-11-15 14:31:35 +0000 |
commit | 44a077f64b1caf30677ec81910c67c5358ad6790 (patch) | |
tree | eda8a7cfcf6cb4c94d508260c1dfbafd6a700362 /aai-schema-gen/src | |
parent | ade63a2fd61bae99fb4911f02ee437e38dcf01d1 (diff) | |
parent | fa2e088e613c35fbfd4a19ac0e0cb88ce9ef7448 (diff) |
Merge "Update aai-schema-ingest dependency in the schema-service"
Diffstat (limited to 'aai-schema-gen/src')
22 files changed, 500 insertions, 221 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java index 9460175..f279aef 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java @@ -22,8 +22,6 @@ package org.onap.aai.schemagen; -import freemarker.template.TemplateException; - import java.io.File; import java.io.IOException; import java.util.Collections; @@ -31,13 +29,15 @@ import java.util.List; import java.util.ListIterator; import org.onap.aai.schemagen.swagger.GenerateSwagger; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import freemarker.template.TemplateException; + public class AutoGenerateHtml { private static Logger logger = LoggerFactory.getLogger(AutoGenerateHtml.class); @@ -53,31 +53,32 @@ public class AutoGenerateHtml { try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( "org.onap.aai.setup", "org.onap.aai.schemagen")) { - SchemaVersions schemaVersions = ctx.getBean(SchemaVersions.class); - List<SchemaVersion> versionsToGen = schemaVersions.getVersions(); - Collections.sort(versionsToGen); - Collections.reverse(versionsToGen); - ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator(); - String schemaDir; - if (System.getProperty("user.dir") != null - && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) { - schemaDir = ALT_SCHEMA_DIR; - } else { - schemaDir = DEFAULT_SCHEMA_DIR; - } - String release = System.getProperty("aai.release", "onap"); - while (versionIterator.hasNext()) { - System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString()); - String yamlFile = - schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_" - + System.getProperty(AAI_GENERATE_VERSION) + ".yaml"; - File swaggerYamlFile = new File(yamlFile); - if (swaggerYamlFile.exists()) { - GenerateSwagger.schemaVersions = schemaVersions; - GenerateSwagger.main(args); - } + SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class); + + List<SchemaVersion> versionsToGen = schemaConfigVersions.getVersions(); + Collections.sort(versionsToGen); + Collections.reverse(versionsToGen); + ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator(); + String schemaDir; + if (System.getProperty("user.dir") != null + && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) { + schemaDir = ALT_SCHEMA_DIR; + } else { + schemaDir = DEFAULT_SCHEMA_DIR; + } + String release = System.getProperty("aai.release", "onap"); + while (versionIterator.hasNext()) { + System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString()); + String yamlFile = + schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_" + + System.getProperty(AAI_GENERATE_VERSION) + ".yaml"; + File swaggerYamlFile = new File(yamlFile); + if (swaggerYamlFile.exists()) { + GenerateSwagger.schemaConfigVersions = schemaConfigVersions; + GenerateSwagger.main(args); } + } } catch (BeansException e) { logger.warn("Unable to initialize AnnotationConfigApplicationContext ", e); } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java index 2655e3c..f9e7b4d 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java @@ -37,8 +37,8 @@ import java.util.Map; import org.onap.aai.schemagen.genxsd.HTMLfromOXM; import org.onap.aai.schemagen.genxsd.NodesYAMLfromOXM; import org.onap.aai.schemagen.genxsd.YAMLfromOXM; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; @@ -109,11 +109,12 @@ public class GenerateXsd { return true; } - SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class); - if (schemaVersions == null) { + SchemaConfigVersions schemaConfigVersions = + SpringContextAware.getBean(SchemaConfigVersions.class); + if (schemaConfigVersions == null) { return false; } - for (SchemaVersion v : schemaVersions.getVersions()) { + for (SchemaVersion v : schemaConfigVersions.getVersions()) { if (v.toString().equals(versionToGen)) { return true; } @@ -156,7 +157,7 @@ public class GenerateXsd { try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( "org.onap.aai.setup", "org.onap.aai.schemagen")) { - SchemaVersions schemaVersions = ctx.getBean(SchemaVersions.class); + SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class); if (!fileTypeToGen.equals(GENERATE_TYPE_XSD) && !fileTypeToGen.equals(GENERATE_TYPE_YAML)) { @@ -173,7 +174,7 @@ public class GenerateXsd { System.err.println("Invalid version passed. " + versionToGen); System.exit(1); } else if ("ALL".equalsIgnoreCase(versionToGen)) { - versionsToGen = schemaVersions.getVersions(); + versionsToGen = schemaConfigVersions.getVersions(); Collections.sort(versionsToGen); Collections.reverse(versionsToGen); } else { diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SchemaConfiguration.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SchemaConfiguration.java index 4657862..12afcaf 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SchemaConfiguration.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SchemaConfiguration.java @@ -22,12 +22,15 @@ package org.onap.aai.schemagen; +import java.util.HashSet; +import java.util.Set; + import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.setup.AAIConfigTranslator; -import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; -import org.onap.aai.setup.SchemaVersions; +import org.onap.aai.setup.Translator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -36,19 +39,23 @@ public class SchemaConfiguration { @Bean public EdgeIngestor edgeIngestor(SchemaLocationsBean schemaLocationsBean, - SchemaVersions schemaVersions) { - return new EdgeIngestor(configTranslator(schemaLocationsBean, schemaVersions), - schemaVersions); + SchemaConfigVersions schemaConfigVersions) { + return new EdgeIngestor(configTranslators(schemaLocationsBean, schemaConfigVersions)); } @Bean(name = "nodeIngestor") - public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) { - return new NodeIngestor(configTranslator); + public NodeIngestor nodeIngestor(SchemaLocationsBean schemaLocationsBean, + SchemaConfigVersions schemaConfigVersions) { + return new NodeIngestor(configTranslators(schemaLocationsBean, schemaConfigVersions)); } @Bean(name = "configTranslator") - public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, - SchemaVersions schemaVersions) { - return new AAIConfigTranslator(schemaLocationsBean, schemaVersions); + public Set<Translator> configTranslators(SchemaLocationsBean schemaLocationsBean, + SchemaConfigVersions schemaConfigVersions) { + Set<Translator> translators = new HashSet<>(); + AAIConfigTranslator translator = + new AAIConfigTranslator(schemaLocationsBean, schemaConfigVersions); + translators.add(translator); + return translators; } } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SwaggerGenerationConfiguration.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SwaggerGenerationConfiguration.java index 0370e8b..aa8b508 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SwaggerGenerationConfiguration.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/SwaggerGenerationConfiguration.java @@ -27,7 +27,7 @@ import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.schemagen.genxsd.HTMLfromOXM; import org.onap.aai.schemagen.genxsd.NodesYAMLfromOXM; import org.onap.aai.schemagen.genxsd.YAMLfromOXM; -import org.onap.aai.setup.SchemaVersions; +import org.onap.aai.setup.SchemaConfigVersions; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; @@ -45,23 +45,23 @@ public class SwaggerGenerationConfiguration { @Bean @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public NodesYAMLfromOXM nodesYamlFromOXM(SchemaVersions schemaVersions, + public NodesYAMLfromOXM nodesYamlFromOXM(SchemaConfigVersions schemaConfigVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - return new NodesYAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + return new NodesYAMLfromOXM(basePath, schemaConfigVersions, nodeIngestor, edgeIngestor); } @Bean @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HTMLfromOXM htmlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, - EdgeIngestor edgeIngestor) { - return new HTMLfromOXM(maxOccurs, schemaVersions, nodeIngestor, edgeIngestor); + public HTMLfromOXM htmlFromOXM(SchemaConfigVersions schemaConfigVersions, + NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new HTMLfromOXM(maxOccurs, schemaConfigVersions, nodeIngestor, edgeIngestor); } @Bean @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public YAMLfromOXM yamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, - EdgeIngestor edgeIngestor) { - return new YAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + public YAMLfromOXM yamlFromOXM(SchemaConfigVersions schemaConfigVersions, + NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new YAMLfromOXM(basePath, schemaConfigVersions, nodeIngestor, edgeIngestor); } } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/ConfigTranslatorForDocs.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/ConfigTranslatorForDocs.java index 87ba528..ca1c71e 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/ConfigTranslatorForDocs.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/ConfigTranslatorForDocs.java @@ -22,17 +22,22 @@ package org.onap.aai.schemagen.genxsd; import java.io.File; import java.io.FilenameFilter; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; -import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.AAIConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; -public class ConfigTranslatorForDocs extends ConfigTranslator { +public class ConfigTranslatorForDocs extends AAIConfigTranslator { - public ConfigTranslatorForDocs(SchemaLocationsBean bean, SchemaVersions schemaVersions) { - super(bean, schemaVersions); + public ConfigTranslatorForDocs(SchemaLocationsBean bean, + SchemaConfigVersions schemaConfigVersions) { + super(bean, schemaConfigVersions); } @Override diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java index c1cf5ac..5779e6d 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java @@ -32,8 +32,8 @@ import javax.xml.parsers.ParserConfigurationException; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.nodes.NodeIngestor; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Attr; @@ -48,9 +48,9 @@ public class HTMLfromOXM extends OxmFileProcessor { private String maxOccurs; - public HTMLfromOXM(String maxOccurs, SchemaVersions schemaVersions, NodeIngestor ni, + public HTMLfromOXM(String maxOccurs, SchemaConfigVersions schemaConfigVersions, NodeIngestor ni, EdgeIngestor ei) { - super(schemaVersions, ni, ei); + super(schemaConfigVersions, ni, ei); this.maxOccurs = maxOccurs; } @@ -76,7 +76,7 @@ public class HTMLfromOXM extends OxmFileProcessor { sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") .append(LINE_SEPARATOR); String namespace = "org.onap"; - if (v.compareTo(getSchemaVersions().getNamespaceChangeVersion()) < 0) { + if (v.compareTo(getSchemaConfigVersions().getNamespaceChangeVersion()) < 0) { namespace = "org.openecomp"; } sb.append( diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java index 77c76cb..92cc4a0 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java @@ -49,8 +49,8 @@ import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.EdgeRuleQuery; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.nodes.NodeIngestor; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Element; @@ -71,9 +71,9 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { private final String basePath; - public NodesYAMLfromOXM(String basePath, SchemaVersions schemaVersions, NodeIngestor ni, - EdgeIngestor ei) { - super(schemaVersions, ni, ei); + public NodesYAMLfromOXM(String basePath, SchemaConfigVersions schemaConfigVersions, + NodeIngestor ni, EdgeIngestor ei) { + super(schemaConfigVersions, ni, ei); this.basePath = basePath; } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/OxmFileProcessor.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/OxmFileProcessor.java index 150bab7..684c2e8 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/OxmFileProcessor.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/OxmFileProcessor.java @@ -40,8 +40,8 @@ import javax.xml.parsers.ParserConfigurationException; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.nodes.NodeIngestor; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -70,7 +70,7 @@ public abstract class OxmFileProcessor { protected SchemaVersion v; protected Document doc = null; protected String apiVersion = null; - protected SchemaVersions schemaVersions; + protected SchemaConfigVersions schemaConfigVersions; protected Map<String, Integer> combinedJavaTypes; protected String apiVersionFmt = null; protected List<String> topLevelPaths = new ArrayList<String>(); @@ -81,8 +81,9 @@ public abstract class OxmFileProcessor { EdgeIngestor ei; NodeIngestor ni; - public OxmFileProcessor(SchemaVersions schemaVersions, NodeIngestor ni, EdgeIngestor ei) { - this.schemaVersions = schemaVersions; + public OxmFileProcessor(SchemaConfigVersions schemaConfigVersions, NodeIngestor ni, + EdgeIngestor ei) { + this.schemaConfigVersions = schemaConfigVersions; this.ni = ni; this.ei = ei; } @@ -137,12 +138,12 @@ public abstract class OxmFileProcessor { this.ei = ei; } - public SchemaVersions getSchemaVersions() { - return schemaVersions; + public SchemaConfigVersions getSchemaConfigVersions() { + return schemaConfigVersions; } - public void setSchemaVersions(SchemaVersions schemaVersions) { - this.schemaVersions = schemaVersions; + public void setSchemaConfigVersions(SchemaConfigVersions schemaConfigVersions) { + this.schemaConfigVersions = schemaConfigVersions; } protected void getTopLevelPaths(XSDElement elem) { diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java index 3b8fa4d..0ded250 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java @@ -49,8 +49,8 @@ import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.EdgeRuleQuery; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.nodes.NodeIngestor; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Element; @@ -72,9 +72,9 @@ public class YAMLfromOXM extends OxmFileProcessor { private String basePath; - public YAMLfromOXM(String basePath, SchemaVersions schemaVersions, NodeIngestor ni, + public YAMLfromOXM(String basePath, SchemaConfigVersions schemaConfigVersions, NodeIngestor ni, EdgeIngestor ei) { - super(schemaVersions, ni, ei); + super(schemaConfigVersions, ni, ei); this.basePath = basePath; } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/GenerateSwagger.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/GenerateSwagger.java index b467e33..c050063 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/GenerateSwagger.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/GenerateSwagger.java @@ -45,7 +45,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; -import org.onap.aai.setup.SchemaVersions; +import org.onap.aai.setup.SchemaConfigVersions; public class GenerateSwagger { @@ -58,16 +58,16 @@ public class GenerateSwagger { // used to check to see if program is run from aai-schema-gen public static final String DEFAULT_RUN_DIR = "aai-schema-gen"; - public static SchemaVersions schemaVersions; + public static SchemaConfigVersions schemaConfigVersions; - public SchemaVersions getSchemaVersions() { - return schemaVersions; + public SchemaConfigVersions getSchemaConfigVersions() { + return schemaConfigVersions; } public static void main(String[] args) throws IOException, TemplateException { // SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class); - String CURRENT_VERSION = schemaVersions.getDefaultVersion().toString(); + String CURRENT_VERSION = schemaConfigVersions.getDefaultVersion().toString(); String schemaDir = System.getProperty("aai.schema.dir"); String versionToGenerate = System.getProperty("aai.generate.version"); String wikiLink = System.getProperty("aai.wiki.link"); diff --git a/aai-schema-gen/src/main/resources/logback.xml b/aai-schema-gen/src/main/resources/logback.xml new file mode 100644 index 0000000..34d802d --- /dev/null +++ b/aai-schema-gen/src/main/resources/logback.xml @@ -0,0 +1,295 @@ +<!-- https://stackoverflow.com/questions/53714853/jsonpath-ignore-the-debug-logs-on-output --> + +<!-- + + ============LICENSE_START======================================================= + org.onap.aai + ================================================================================ + Copyright © 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + +--> +<configuration scan="true" scanPeriod="60 seconds" debug="false"> + <statusListener class="ch.qos.logback.core.status.NopStatusListener"/> + + <property name="namespace" value="aai-schema-gen"/> + + <property name="AJSC_HOME" value="${AJSC_HOME:-.}"/> + <property name="logDirectory" value="${AJSC_HOME}/logs"/> + <!-- Old patterns + <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + //<property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/> + --> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}){'\\|', '!'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> + <!-- Patterns from onap demo --> + <property name="errorPattern" value="%X{LogTimestamp}|%X{RequestID}|%thread|%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{TargetEntity}|%replace(%X{TargetServiceName}){'\\|', '!'}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> + <property name="debugPattern" value="%X{LogTimestamp}|%X{RequestID}|%msg\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t|^%n" /> + + <property name="auditPattern" value="%X{EntryTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||${p_mak}|${p_mdc}|||%msg%n" /> + <property name="metricPattern" value="%X{InvokeTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{TargetEntity}|%replace(%X{TargetServiceName}){'\\|', '!'}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|${p_mak}|${p_mdc}|||%msg%n" /> + <property name="transLogPattern" value="%X{LogTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{RequestID}|%X{ServiceInstanceID}|%-10t|%X{ServerFQDN}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%replace(%replace(%X{ResponseDesc}){'\\|', '!'}){'\r|\n', '^'}|%X{InstanceUUID}|%level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{clientIpAddress}||%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{PartnerName}:%m%n"/> + + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> + <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> + <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern> + %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + </pattern> + </encoder> + </appender> + + <appender name="SANE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/sane.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/sane.log.%d{yyyy-MM-dd}</fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + </pattern> + </encoder> + </appender> + + <appender name="asyncSANE" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="SANE"/> + </appender> + + <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/metrics.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}</fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${metricPattern}</pattern> + </encoder> + </appender> + <appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="METRIC"/> + </appender> + + <appender name="INFO" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/debug.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <appender-ref ref="INFO"/> + <includeCallerData>true</includeCallerData> + </appender> + + <appender name="ERROR" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/error.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> + </filter> + <encoder> + <pattern>${errorPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <appender-ref ref="ERROR"/> + </appender> + + <appender name="AUDIT" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/audit.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${auditPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncAUDIT" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="AUDIT"/> + </appender> + + <appender name="translog" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/translog.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${transLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asynctranslog" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="translog"/> + </appender> + + <appender name="external" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> + </filter> + <file>${logDirectory}/external/external.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + + <appender name="auth" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>DEBUG</level> + </filter> + <file>${logDirectory}/auth/auth.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/auth/auth.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}[%thread] %-5level %logger{1024} - %msg%n</pattern> + </encoder> + </appender> + <appender name="asyncAUTH" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="auth" /> + </appender> + + <logger name="org.onap.aai" level="INFO" additivity="false"> + <appender-ref ref="asyncDEBUG"/> + <appender-ref ref="asyncSANE"/> + </logger> + + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN"/> + <logger name="org.springframework.beans" level="WARN"/> + <logger name="org.springframework.web" level="WARN"/> + <logger name="com.blog.spring.jms" level="WARN"/> + <logger name="com.jayway.jsonpath" level="WARN"/> + + <logger name="com.jayway.jsonpath.internal.path.CompiledPath" level="WARN"/> + + <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet + logging) --> + <logger name="org.codehaus.groovy" level="WARN"/> + <logger name="com.netflix.loadbalancer" level="WARN"/> + + <logger name="org.apache.zookeeper" level="OFF"/> + + <!-- Other Loggers that may help troubleshoot --> + <logger name="net.sf" level="WARN"/> + <logger name="org.apache.commons.httpclient" level="WARN"/> + <logger name="org.apache.commons" level="WARN"/> + <logger name="org.apache.coyote" level="WARN"/> + <logger name="org.apache.jasper" level="WARN"/> + + <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging. + May aid in troubleshooting) --> + <logger name="org.apache.camel" level="WARN"/> + <logger name="org.apache.cxf" level="WARN"/> + <logger name="org.apache.camel.processor.interceptor" level="WARN"/> + <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN"/> + <logger name="org.apache.cxf.service" level="WARN"/> + <logger name="org.restlet" level="WARN"/> + <logger name="org.apache.camel.component.restlet" level="WARN"/> + + <logger name="org.hibernate.validator" level="WARN"/> + <logger name="org.hibernate" level="WARN"/> + <logger name="org.hibernate.ejb" level="OFF"/> + + <!-- logback internals logging --> + <logger name="ch.qos.logback.classic" level="WARN"/> + <logger name="ch.qos.logback.core" level="WARN"/> + + <logger name="org.eclipse.jetty" level="WARN"/> + + <logger name="org.onap.aai.aaf.auth" level="INFO" additivity="false"> + <appender-ref ref="asyncAUTH" /> + </logger> + <logger name="org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog" level="INFO"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.logging.filter.base.AbstractAuditLogFilter" level="INFO"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.aai.logging.ErrorLogHelper" level="WARN"> + <appender-ref ref="asyncERROR"/> + </logger> + <logger name="org.onap.aai.schemaservice.interceptors.post" level="INFO" additivity="false"> + <appender-ref ref="asynctranslog" /> + </logger> + + <logger name="org.apache" level="OFF"/> + <logger name="org.zookeeper" level="OFF"/> + <logger name="org.janusgraph" level="WARN"/> + <logger name="com.att.aft.dme2" level="WARN"/> + + + <root level="INFO"> + <appender-ref ref="external"/> + </root> +</configuration> diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java index 0b99454..9b28e3b 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java @@ -33,11 +33,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.nodes.NodeIngestor; -import org.onap.aai.schemagen.genxsd.*; +import org.onap.aai.schemagen.genxsd.HTMLfromOXM; +import org.onap.aai.schemagen.genxsd.HTMLfromOXMTest; +import org.onap.aai.schemagen.genxsd.XSDElementTest; +import org.onap.aai.schemagen.genxsd.YAMLfromOXM; +import org.onap.aai.schemagen.genxsd.YAMLfromOXMTest; import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforBusiness; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -50,7 +54,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @ContextConfiguration( classes = {SchemaLocationsBean.class, TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class, SwaggerGenerationConfiguration.class, - SchemaVersions.class}) + SchemaConfigVersions.class}) @TestPropertySource(properties = {"schema.uri.base.path = /aai", "schema.xsd.maxoccurs = 5000"}) public class GenerateXsdTest { private static final Logger logger = LoggerFactory.getLogger("GenerateXsd.class"); @@ -67,7 +71,7 @@ public class GenerateXsdTest { HTMLfromOXM htmlFromOxm; @Autowired - SchemaVersions schemaVersions; + SchemaConfigVersions schemaConfigVersions; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -96,7 +100,7 @@ public class GenerateXsdTest { @Test public void test_generateSwaggerFromOxmFile() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -112,7 +116,7 @@ public class GenerateXsdTest { @Test public void test_generateXSDFromOxmFile() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String fileContent = null; try { htmlFromOxm.setXmlVersion(testXML, v); @@ -126,7 +130,7 @@ public class GenerateXsdTest { @Test public void testGetAPIVersion() { - GenerateXsd.apiVersion = schemaVersions.getAppRootVersion().toString(); + GenerateXsd.apiVersion = schemaConfigVersions.getAppRootVersion().toString(); assertThat(GenerateXsd.getAPIVersion(), is("v11")); } diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java index 1469272..046f961 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java @@ -29,7 +29,11 @@ import com.google.common.collect.Multimap; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; import org.junit.AfterClass; import org.junit.Before; @@ -41,9 +45,9 @@ import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforEdges; import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; @@ -51,7 +55,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( - classes = {SchemaVersions.class, SchemaLocationsBean.class, + classes = {SchemaConfigVersions.class, SchemaLocationsBean.class, TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class}) @TestPropertySource( properties = { diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java index d4a6517..46f90ce 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java @@ -40,9 +40,9 @@ import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.schemagen.SwaggerGenerationConfiguration; import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforBusiness; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +54,7 @@ import org.w3c.dom.Element; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( - classes = {SchemaVersions.class, SchemaLocationsBean.class, + classes = {SchemaConfigVersions.class, SchemaLocationsBean.class, TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class, SwaggerGenerationConfiguration.class @@ -71,7 +71,7 @@ public class HTMLfromOXMTest { HTMLfromOXM htmlFromOxm; @Autowired - SchemaVersions schemaVersions; + SchemaConfigVersions schemaConfigVersions; @BeforeClass public static void setUpContext() throws Exception { @@ -102,11 +102,11 @@ public class HTMLfromOXMTest { @Test public void testGetDocumentHeader() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String header = null; try { htmlFromOxm.setXmlVersion(testXML, v); - htmlFromOxm.setSchemaVersions(schemaVersions); + htmlFromOxm.setSchemaConfigVersions(schemaConfigVersions); header = htmlFromOxm.getDocumentHeader(); } catch (Exception e) { e.printStackTrace(); @@ -118,7 +118,7 @@ public class HTMLfromOXMTest { @Test public void testProcess() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String fileContent = null; try { htmlFromOxm.setXmlVersion(testXML, v); @@ -133,7 +133,7 @@ public class HTMLfromOXMTest { @Test public void testProcessWithCombiningJavaTypes() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String fileContent = null; try { setUp(1); @@ -158,7 +158,7 @@ public class HTMLfromOXMTest { bw = Files.newBufferedWriter(path, charset); bw.write(testXML); bw.close(); - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String fileContent = null; try { htmlFromOxm.setXmlVersion(testXML, v); @@ -174,7 +174,7 @@ public class HTMLfromOXMTest { @Test public void testHTMLfromOXMStringVersion() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String fileContent = null; try { htmlFromOxm.setXmlVersion(testXML, v); @@ -190,7 +190,7 @@ public class HTMLfromOXMTest { @Test public void testProcessJavaTypeElement() { String target = "Element=java-type/Customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); Element customer = null; try { htmlFromOxm.setXmlVersion(testXML, v); diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java index 468de16..ac225f0 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java @@ -40,9 +40,9 @@ import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.schemagen.SwaggerGenerationConfiguration; import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforEdges; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +54,7 @@ import org.w3c.dom.Element; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( - classes = {SchemaVersions.class, SchemaLocationsBean.class, + classes = {SchemaConfigVersions.class, SchemaLocationsBean.class, TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class, NodeIngestor.class, SwaggerGenerationConfiguration.class @@ -72,7 +72,7 @@ public class NodesYAMLfromOXMTest { @Autowired NodesYAMLfromOXM nodesYamlFromOxm; @Autowired - SchemaVersions schemaVersions; + SchemaConfigVersions schemaConfigVersions; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -103,7 +103,7 @@ public class NodesYAMLfromOXMTest { @Test public void testGetDocumentHeader() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String header = null; try { @@ -119,7 +119,7 @@ public class NodesYAMLfromOXMTest { @Test public void testProcess() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -142,7 +142,7 @@ public class NodesYAMLfromOXMTest { bw = Files.newBufferedWriter(path, charset); bw.write(testXML); bw.close(); - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -157,7 +157,7 @@ public class NodesYAMLfromOXMTest { @Test public void testNodesYAMLfromOXMStringVersionFile() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -171,7 +171,7 @@ public class NodesYAMLfromOXMTest { @Test public void testAppendDefinitions() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String definitions = null; try { @@ -187,7 +187,7 @@ public class NodesYAMLfromOXMTest { @Test public void testGetXMLRootElementName() { String target = "RootElement=customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); Element customer = null; String root = null; @@ -205,7 +205,7 @@ public class NodesYAMLfromOXMTest { @Test public void testGetXmlRootElementName() { String target = "RootElement=customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String root = null; try { @@ -221,7 +221,7 @@ public class NodesYAMLfromOXMTest { @Test public void testGetJavaTypeElementSwagger() { String target = "Element=java-type/Customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); Element customer = null; try { diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java index 09a8dd4..b955f96 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java @@ -35,15 +35,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.schemagen.GenerateXsd; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {SchemaVersions.class, EdgeIngestor.class}) +@ContextConfiguration(classes = {SchemaConfigVersions.class, EdgeIngestor.class}) @TestPropertySource(properties = {"schema.uri.base.path = /aai"}) @Ignore("This test needs to get major rework done as it is written very poorly") public class PutRelationPathSetTest { @@ -61,14 +61,14 @@ public class PutRelationPathSetTest { "/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/availability-zones/availability-zone/{availability-zone-name}/relationship-list/relationship"; PutRelationPathSet prp = null; @Autowired - SchemaVersions schemaVersions; + SchemaConfigVersions schemaConfigVersions; @Autowired EdgeIngestor edgeIngestor; @Before public void setUpBeforeClass() throws Exception { - v = schemaVersions.getDefaultVersion(); + v = schemaConfigVersions.getDefaultVersion(); relationsFile = new File(GenerateXsd.getYamlDir() + "/relations/" + v.toString() + "/createOrUpdateCloudInfrastructureCloudRegionsCloudRegionAvailabilityZonesAvailabilityZone.json"); diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java index 1d06c38..ed13981 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java @@ -48,9 +48,9 @@ import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.schemagen.SwaggerGenerationConfiguration; import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforBusiness; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -63,9 +63,9 @@ import org.w3c.dom.Element; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( - classes = {SchemaVersions.class, SchemaLocationsBean.class, - TestUtilConfigTranslatorforBusiness.class, SchemaVersions.class, EdgeIngestor.class, - NodeIngestor.class, SwaggerGenerationConfiguration.class + classes = {SchemaConfigVersions.class, SchemaLocationsBean.class, + TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class, + SwaggerGenerationConfiguration.class }) @TestPropertySource(properties = {"schema.uri.base.path = /aai", "schema.xsd.maxoccurs = 5000"}) @@ -88,7 +88,7 @@ public class YAMLfromOXMTest { YAMLfromOXM yamlFromOxm; @Autowired - SchemaVersions schemaVersions; + SchemaConfigVersions schemaConfigVersions; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -131,7 +131,7 @@ public class YAMLfromOXMTest { @Test public void AtestIngestors() throws EdgeRuleNotFoundException { Multimap<String, EdgeRule> results = - edgeIngestor.getAllRules(schemaVersions.getDefaultVersion()); + edgeIngestor.getAllRules(schemaConfigVersions.getDefaultVersion()); SortedSet<String> ss = new TreeSet<String>(results.keySet()); for (String key : ss) { results.get(key).stream().filter((i) -> ((!i.isPrivateEdge()))).forEach((i) -> { @@ -139,13 +139,13 @@ public class YAMLfromOXMTest { System.out.println(ed.getRuleKey()); }); } - Document doc = nodeIngestor.getSchema(schemaVersions.getDefaultVersion()); + Document doc = nodeIngestor.getSchema(schemaConfigVersions.getDefaultVersion()); assertNotNull(doc); } @Test public void testGetDocumentHeader() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String header = null; try { @@ -160,7 +160,7 @@ public class YAMLfromOXMTest { @Test public void testProcess() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -183,7 +183,7 @@ public class YAMLfromOXMTest { bw = Files.newBufferedWriter(path, charset); bw.write(testXML); bw.close(); - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -199,7 +199,7 @@ public class YAMLfromOXMTest { @Test public void testYAMLfromOXMStringVersionFile() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -220,7 +220,7 @@ public class YAMLfromOXMTest { // TODO Auto-generated catch block e1.printStackTrace(); } - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String fileContent = null; try { @@ -235,7 +235,7 @@ public class YAMLfromOXMTest { @Test public void testAppendDefinitions() { - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String definitions = null; try { @@ -252,7 +252,7 @@ public class YAMLfromOXMTest { @Test public void testGetXMLRootElementName() { String target = "RootElement=customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); Element customer = null; String root = null; @@ -270,7 +270,7 @@ public class YAMLfromOXMTest { @Test public void testGetXmlRootElementName() { String target = "RootElement=customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); String root = null; try { @@ -286,7 +286,7 @@ public class YAMLfromOXMTest { @Test public void testGetJavaTypeElementSwagger() { String target = "Element=java-type/Customer"; - SchemaVersion v = schemaVersions.getAppRootVersion(); + SchemaVersion v = schemaConfigVersions.getAppRootVersion(); String apiVersion = v.toString(); Element customer = null; try { diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforBusiness.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforBusiness.java index fdc2002..cfa51c4 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforBusiness.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforBusiness.java @@ -25,16 +25,16 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.AAIConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; -public class TestUtilConfigTranslatorforBusiness extends ConfigTranslator { +public class TestUtilConfigTranslatorforBusiness extends AAIConfigTranslator { public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, - SchemaVersions schemaVersions) { - super(bean, schemaVersions); + SchemaConfigVersions schemaConfigVersions) { + super(bean, schemaConfigVersions); } @Override diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforDataLink.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforDataLink.java index 7fdcc34..e1522fa 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforDataLink.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforDataLink.java @@ -26,15 +26,15 @@ import java.util.Map; import java.util.TreeMap; import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; public class TestUtilConfigTranslatorforDataLink extends ConfigTranslator { public TestUtilConfigTranslatorforDataLink(SchemaLocationsBean bean, - SchemaVersions schemaVersions) { - super(bean, schemaVersions); + SchemaConfigVersions schemaConfigVersions) { + super(bean, schemaConfigVersions); } @Override diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforEdges.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforEdges.java index ca45b9d..ae0ede9 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforEdges.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/testutils/TestUtilConfigTranslatorforEdges.java @@ -25,16 +25,16 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.AAIConfigTranslator; +import org.onap.aai.setup.SchemaConfigVersions; import org.onap.aai.setup.SchemaLocationsBean; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; -public class TestUtilConfigTranslatorforEdges extends ConfigTranslator { +public class TestUtilConfigTranslatorforEdges extends AAIConfigTranslator { public TestUtilConfigTranslatorforEdges(SchemaLocationsBean bean, - SchemaVersions schemaVersions) { - super(bean, schemaVersions); + SchemaConfigVersions schemaConfigVersions) { + super(bean, schemaConfigVersions); } @Override diff --git a/aai-schema-gen/src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json b/aai-schema-gen/src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json index c25f1fb..c69b741 100644 --- a/aai-schema-gen/src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json +++ b/aai-schema-gen/src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json @@ -1,39 +1,39 @@ { - "rules": [ - { - "from": "service-subscription", - "to": "customer", - "label": "org.onap.relationships.inventory.BelongsTo", - "direction": "OUT", - "multiplicity": "MANY2ONE", - "contains-other-v": "!${direction}", - "delete-other-v": "!${direction}", - "prevent-delete": "NONE", - "default": "true", - "description":"" - }, - { - "from": "service-instance", - "to": "service-subscription", - "label": "org.onap.relationships.inventory.BelongsTo", - "direction": "OUT", - "multiplicity": "MANY2ONE", - "contains-other-v": "!${direction}", - "delete-other-v": "!${direction}", - "prevent-delete": "NONE", - "default": "true", - "description":"" - }, - { - "from": "service-subscription", - "to": "tenant", - "label": "org.onap.relationships.inventory.Uses", - "direction": "OUT", - "multiplicity": "MANY2MANY", - "contains-other-v": "NONE", - "delete-other-v": "NONE", - "prevent-delete": "NONE", - "default": "true", - "description":"" - } ] + "rules": [ + { + "from": "service-subscription", + "to": "customer", + "label": "org.onap.relationships.inventory.BelongsTo", + "direction": "OUT", + "multiplicity": "MANY2ONE", + "contains-other-v": "!${direction}", + "delete-other-v": "!${direction}", + "prevent-delete": "NONE", + "default": "true", + "description":"" + }, + { + "from": "service-instance", + "to": "service-subscription", + "label": "org.onap.relationships.inventory.BelongsTo", + "direction": "OUT", + "multiplicity": "MANY2ONE", + "contains-other-v": "!${direction}", + "delete-other-v": "!${direction}", + "prevent-delete": "NONE", + "default": "true", + "description":"" + }, + { + "from": "service-subscription", + "to": "tenant", + "label": "org.onap.relationships.inventory.Uses", + "direction": "OUT", + "multiplicity": "MANY2MANY", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "default": "true", + "description":"" + } ] } diff --git a/aai-schema-gen/src/test/resources/dbedgerules/EdgeDescriptionRules_test.json b/aai-schema-gen/src/test/resources/dbedgerules/EdgeDescriptionRules_test.json deleted file mode 100644 index c25f1fb..0000000 --- a/aai-schema-gen/src/test/resources/dbedgerules/EdgeDescriptionRules_test.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "rules": [ - { - "from": "service-subscription", - "to": "customer", - "label": "org.onap.relationships.inventory.BelongsTo", - "direction": "OUT", - "multiplicity": "MANY2ONE", - "contains-other-v": "!${direction}", - "delete-other-v": "!${direction}", - "prevent-delete": "NONE", - "default": "true", - "description":"" - }, - { - "from": "service-instance", - "to": "service-subscription", - "label": "org.onap.relationships.inventory.BelongsTo", - "direction": "OUT", - "multiplicity": "MANY2ONE", - "contains-other-v": "!${direction}", - "delete-other-v": "!${direction}", - "prevent-delete": "NONE", - "default": "true", - "description":"" - }, - { - "from": "service-subscription", - "to": "tenant", - "label": "org.onap.relationships.inventory.Uses", - "direction": "OUT", - "multiplicity": "MANY2MANY", - "contains-other-v": "NONE", - "delete-other-v": "NONE", - "prevent-delete": "NONE", - "default": "true", - "description":"" - } ] -} |