summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-annotations/pom.xml4
-rw-r--r--aai-auth/pom.xml4
-rw-r--r--aai-core/pom.xml4
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java7
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java15
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/Introspector.java22
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/LoaderUtil.java34
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java47
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java99
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java21
-rw-r--r--aai-core/src/main/java/org/onap/aai/parsers/query/QueryParser.java40
-rw-r--r--aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/parsers/uri/URIToRelationshipObject.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java20
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java22
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java4
-rw-r--r--aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java122
-rw-r--r--aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java49
-rw-r--r--aai-core/src/main/java/org/onap/aai/serialization/engines/query/QueryEngine.java11
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/AAIConfig.java43
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/AAIConstants.java9
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/GenerateXsd.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/genxsd/ConfigTranslatorForDocs.java8
-rw-r--r--aai-core/src/test/java/org/onap/aai/AAISetup.java9
-rw-r--r--aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java2
-rw-r--r--aai-core/src/test/java/org/onap/aai/DataLinkSetup.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/HttpTestUtil.java6
-rw-r--r--aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java9
-rw-r--r--aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforDataLink.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/util/GenerateXsdTest.java6
-rw-r--r--aai-core/src/test/java/org/onap/aai/util/genxsd/EdgeDescriptionTest.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/util/genxsd/HTMLfromOXMTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/util/genxsd/NodesYAMLfromOXMTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/util/genxsd/YAMLfromOXMTest.java5
-rw-r--r--aai-rest/pom.xml6
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java88
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/ClientType.java24
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java4
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java8
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java89
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java7
-rw-r--r--aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java8
-rw-r--r--aai-schema-ingest/pom.xml4
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/config/ConfigConfiguration.java8
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/config/EdgesConfiguration.java4
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java5
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java14
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java10
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/nodes/CaseFormatStore.java105
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java51
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java4
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java4
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java4
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java3
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaConfigVersions.java92
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java16
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceVersions.java33
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersion.java24
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java30
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java31
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java2
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java80
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java5
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java8
-rw-r--r--aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties21
-rw-r--r--aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties3
-rw-r--r--aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-wiring-test.properties1
-rw-r--r--aai-utils/pom.xml4
-rw-r--r--docs/release-notes.rst10
-rw-r--r--onap-java-formatter.xml6
-rw-r--r--pom.xml2
-rw-r--r--version.properties2
89 files changed, 1114 insertions, 417 deletions
diff --git a/aai-annotations/pom.xml b/aai-annotations/pom.xml
index f19bd28c..39b7c434 100644
--- a/aai-annotations/pom.xml
+++ b/aai-annotations/pom.xml
@@ -27,12 +27,12 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-annotations</artifactId>
<name>aai-annotations</name>
<packaging>jar</packaging>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<properties>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
</properties>
diff --git a/aai-auth/pom.xml b/aai-auth/pom.xml
index 4bc3f40c..3f46cbb4 100644
--- a/aai-auth/pom.xml
+++ b/aai-auth/pom.xml
@@ -26,11 +26,11 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-auth</artifactId>
<name>aai-auth</name>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<properties>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
diff --git a/aai-core/pom.xml b/aai-core/pom.xml
index 14972f4d..f259c8cf 100644
--- a/aai-core/pom.xml
+++ b/aai-core/pom.xml
@@ -27,11 +27,11 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-core</artifactId>
<name>aai-core</name>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<sonar.language>java</sonar.language>
diff --git a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
index ab74d798..750bc24f 100644
--- a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
+++ b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.MoxyLoader;
import org.springframework.context.annotation.Import;
-@Import({NodesConfiguration.class, EdgesConfiguration.class})
+@Import({ConfigConfiguration.class, SchemaServiceConfiguration.class, NodesConfiguration.class, EdgesConfiguration.class})
@Configuration
public class IntrospectionConfig {
diff --git a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
index 88de78e7..c11d7a56 100644
--- a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
+++ b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
@@ -24,10 +24,10 @@ package org.onap.aai.config;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.AAIConfigTranslator;
-import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.setup.SchemaConfigVersions;
+import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.SchemaErrorStrategy;
import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
@@ -42,6 +42,7 @@ import org.springframework.context.annotation.*;
@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
public class SchemaConfiguration {
+ //TODO : Inject this directly into nodeIngestor
@Autowired(required = false)
NodesConfiguration nodesConfiguration;
@@ -66,7 +67,7 @@ public class SchemaConfiguration {
@Bean(name = "configTranslator")
@ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
- public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) {
+ public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaConfigVersions schemaVersions) {
return new AAIConfigTranslator(schemaLocationsBean, schemaVersions);
}
diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java
index c0a9e201..11b96ae1 100644
--- a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java
+++ b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java
@@ -30,10 +30,7 @@ import org.onap.aai.config.SpringContextAware;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
-import org.onap.aai.introspection.Introspector;
-import org.onap.aai.introspection.Loader;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.*;
import org.onap.aai.logging.LogFormatTools;
import org.onap.aai.schema.enums.PropertyMetadata;
import org.onap.aai.edges.EdgeRule;
@@ -111,16 +108,8 @@ public class SchemaGenerator {
}
}
- // ApplicationContext ctx = SpringContextAware.getApplicationContext();
- // Loader loader =
- // ctx.getBean(LoaderFactory.class).createLoaderForVersion(ModelType.MOXY,
- // AAIProperties.LATEST);
- LoaderFactory loaderFactory = SpringContextAware.getBean(LoaderFactory.class);
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ Loader loader = LoaderUtil.getLatestVersion();
- Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
- // Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY,
- // AAIProperties.LATEST);
Map<String, Introspector> objs = loader.getAllObjects();
Map<String, PropertyKey> seenProps = new HashMap<>();
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
index 269d6330..21299f79 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
@@ -24,9 +24,12 @@ import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
import org.apache.commons.lang.ClassUtils;
import org.eclipse.persistence.exceptions.DynamicException;
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.nodes.CaseFormatStore;
+import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.restcore.MediaType;
import org.onap.aai.schema.enums.ObjectMetadata;
import org.onap.aai.schema.enums.PropertyMetadata;
@@ -50,13 +53,26 @@ public abstract class Introspector implements Cloneable {
private Set<String> uniqueProperties = null;
private Set<String> indexedProperties = null;
private Set<String> allKeys = null;
+
+ protected CaseFormatStore caseFormatStore = null;
+ protected NodeIngestor nodeIngestor;
+
protected Introspector(Object obj) {
+ this.nodeIngestor = SpringContextAware.getBean(NodeIngestor.class);
+ this.caseFormatStore = nodeIngestor.getCaseFormatStore();
}
public abstract boolean hasProperty(String name);
protected String convertPropertyName (String name) {
- return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name);
+ return caseFormatStore
+ .fromLowerHyphenToLowerCamel(name)
+ .orElseGet(
+ () -> {
+ LOGGER.debug("Unable to find {} in the store from lower hyphen to lower camel", name);
+ return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name);
+ }
+ );
}
protected abstract Object get(String name);
@@ -198,7 +214,7 @@ public abstract class Introspector implements Cloneable {
* @param obj the value to be set
* @return
*/
- public void setValue(String name, Object obj) throws IllegalArgumentException {
+ public void setValue(String name, Object obj) {
Object box = this.castValueAccordingToSchema(name, obj);
name = convertPropertyName(name);
@@ -558,8 +574,6 @@ public abstract class Introspector implements Cloneable {
public abstract String marshal(MarshallerProperties properties);
- public abstract Object clone();
-
public abstract Object getUnderlyingObject();
public String marshal(boolean formatted) {
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/LoaderUtil.java b/aai-core/src/main/java/org/onap/aai/introspection/LoaderUtil.java
new file mode 100644
index 00000000..16d87d96
--- /dev/null
+++ b/aai-core/src/main/java/org/onap/aai/introspection/LoaderUtil.java
@@ -0,0 +1,34 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2019 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=========================================================
+ */
+package org.onap.aai.introspection;
+
+import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.setup.SchemaVersions;
+
+public class LoaderUtil {
+
+ public static Loader getLatestVersion(){
+
+ LoaderFactory loaderFactory = SpringContextAware.getBean(LoaderFactory.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
+
+ return loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
+ }
+}
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java b/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
index fa52d62f..35583d7c 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
@@ -32,12 +32,12 @@ import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.introspection.exceptions.AAIUnmarshallingException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.nodes.CaseFormatStore;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.restcore.MediaType;
import org.onap.aai.schema.enums.ObjectMetadata;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.workarounds.NamingExceptions;
-import org.springframework.stereotype.Component;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
@@ -49,19 +49,22 @@ import java.util.stream.Collectors;
public class MoxyLoader extends Loader {
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(MoxyLoader.class);
+
private DynamicJAXBContext jaxbContext = null;
- private EELFLogger LOGGER = EELFManager.getInstance().getLogger(MoxyLoader.class);
private Map<String, Introspector> allObjs = null;
private Map<SchemaVersion, MoxyLoader> moxyLoaderFactory;
private NodeIngestor nodeIngestor;
+ private CaseFormatStore caseFormatStore;
private Set<String> namedProps;
public MoxyLoader(SchemaVersion version, NodeIngestor nodeIngestor) {
super(version, ModelType.MOXY);
this.nodeIngestor = nodeIngestor;
+ this.caseFormatStore = nodeIngestor.getCaseFormatStore();
process(version);
}
@@ -79,6 +82,16 @@ public class MoxyLoader extends Loader {
return IntrospectorFactory.newInstance(ModelType.MOXY, objectFromName(name));
}
+ private boolean containsUpperCase(String str){
+
+ for(int i = 0; i < str.length(); i++){
+ if(Character.isUpperCase(str.charAt(i))){
+ return true;
+ }
+ }
+
+ return false;
+ }
/**
* {@inheritDoc}
*/
@@ -92,10 +105,17 @@ public class MoxyLoader extends Loader {
final String upperCamel;
//Contains any uppercase, then assume it's upper camel
- if (name.matches(".*[A-Z].*")) {
+ if (containsUpperCase(name)) {
upperCamel = sanitizedName;
} else {
- upperCamel = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, sanitizedName);
+ upperCamel = caseFormatStore
+ .fromLowerHyphenToUpperCamel(sanitizedName)
+ .orElseGet(
+ () -> {
+ LOGGER.debug("Unable to find {} in the store for lower hyphen to upper camel", sanitizedName);
+ return CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, sanitizedName);
+ }
+ );
}
try {
@@ -153,7 +173,7 @@ public class MoxyLoader extends Loader {
if (this.allObjs != null) {
return allObjs;
} else {
- ImmutableMap.Builder<String, Introspector> map = new ImmutableMap.Builder<String, Introspector>();
+ ImmutableMap.Builder<String, Introspector> map = new ImmutableMap.Builder<>();
Set<String> objs = objectsInVersion();
for (String objName : objs) {
try {
@@ -178,7 +198,6 @@ public class MoxyLoader extends Loader {
LOGGER.warn("Exception while enumerating objects for API version " + getVersion() + " (returning partial results) " + LogFormatTools.getStackTop(e));
}
- //result.remove("EdgePropNames");
return result;
}
@@ -199,20 +218,4 @@ public class MoxyLoader extends Loader {
public DynamicJAXBContext getJAXBContext() {
return this.jaxbContext;
}
-
- /*
- * Im keeping this for now - Just in case
- */
- /*private static class Helper {
- private static final Map<SchemaVersion, MoxyLoader> INSTANCEMAP = new ConcurrentHashMap<>();
-
- private Helper() {}
-
- private static MoxyLoader getLoaderBySchemaVersion(SchemaVersion v) {
- if (!INSTANCEMAP.containsKey(v)) {
- INSTANCEMAP.put(v, new MoxyLoader(v, nodeIngestor));
- }
- return INSTANCEMAP.get(v);
- }
- }*/
}
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
index f0d487e8..455e7846 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
@@ -23,35 +23,31 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
-
-
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.dynamic.DynamicType;
import org.eclipse.persistence.exceptions.DynamicException;
-import org.eclipse.persistence.jaxb.UnmarshallerProperties;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.eclipse.persistence.mappings.DatabaseMapping;
import org.eclipse.persistence.oxm.XMLField;
import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping;
import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping;
import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.nodes.CaseFormatStore;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.restcore.MediaType;
import org.onap.aai.schema.enums.ObjectMetadata;
import org.onap.aai.schema.enums.PropertyMetadata;
import org.onap.aai.setup.SchemaVersion;
import org.springframework.web.util.UriUtils;
+
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.Map.Entry;
-import java.util.stream.Collectors;
public class MoxyStrategy extends Introspector {
@@ -60,8 +56,6 @@ public class MoxyStrategy extends Introspector {
private DynamicType internalType = null;
private DynamicJAXBContext jaxbContext = null;
private ClassDescriptor cd = null;
- private Marshaller marshaller = null;
- private Unmarshaller unmarshaller = null;
private SchemaVersion version = null;
private Set<String> properties = null;
private Set<String> keys = null;
@@ -69,14 +63,11 @@ public class MoxyStrategy extends Introspector {
private boolean isInitialized = false;
- private NodeIngestor nodeIngestor;
-
protected MoxyStrategy(Object obj) {
super(obj);
/* must look up the correct jaxbcontext for this object */
className = MoxyStrategy.class.getSimpleName();
internalObject = (DynamicEntity)obj;
- nodeIngestor = SpringContextAware.getBean(NodeIngestor.class);
version = nodeIngestor.getVersionFromClassName(internalObject.getClass().getName());
super.loader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(getModelType(), version);
jaxbContext = nodeIngestor.getContextForVersion(version);
@@ -84,15 +75,6 @@ public class MoxyStrategy extends Introspector {
internalType = jaxbContext.getDynamicType(simpleName);
cd = internalType.getDescriptor();
- try {
- marshaller = jaxbContext.createMarshaller();
-
- unmarshaller = jaxbContext.createUnmarshaller();
-
- } catch (JAXBException e) {
-
- }
-
}
private void init() {
@@ -100,21 +82,26 @@ public class MoxyStrategy extends Introspector {
Set<String> props = new LinkedHashSet<>();
for (String s : internalType.getPropertiesNames()) {
- props.add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, s));
+ String value = caseFormatStore
+ .fromLowerCamelToLowerHyphen(s)
+ .orElseGet(
+ () -> {
+ LOGGER.debug("Unable to find {} in the store from lower camel to lower hyphen", s);
+ return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, s);
+ }
+ );
+ props.add(value);
}
props = Collections.unmodifiableSet(props);
this.properties = props;
Set<String> requiredProps = new LinkedHashSet<>();
- requiredProps = new LinkedHashSet<>();
for (DatabaseMapping dm : cd.getMappings()) {
if (dm.getField() instanceof XMLField) {
XMLField x = (XMLField)dm.getField();
- if (x != null) {
- if (x.isRequired()) {
- requiredProps.add(this.removeXPathDescriptor(x.getName()));
- }
+ if (x != null && x.isRequired()) {
+ requiredProps.add(this.removeXPathDescriptor(x.getName()));
}
}
}
@@ -145,7 +132,7 @@ public class MoxyStrategy extends Introspector {
}
@Override
- public void set(String name, Object obj) throws IllegalArgumentException {
+ public void set(String name, Object obj){
internalObject.set(name, obj);
}
@@ -257,10 +244,26 @@ public class MoxyStrategy extends Introspector {
public String getChildName() {
String className = internalObject.getClass().getSimpleName();
- String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className);
+ String lowerHyphen = caseFormatStore
+ .fromUpperCamelToLowerHyphen(className)
+ .orElseGet(
+ () -> {
+ LOGGER.debug("Unable to find {} in the store for upper camel to lower hyphen", className);
+ return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className);
+ }
+ );
if (this.isContainer()) {
- lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().iterator().next()).getSimpleName());
+ String upperCamel = this.getGenericTypeClass(this.getProperties().iterator().next()).getSimpleName();
+
+ lowerHyphen = caseFormatStore
+ .fromUpperCamelToLowerHyphen(upperCamel)
+ .orElseGet(
+ () -> {
+ LOGGER.debug("Unable to find {} in the store for upper camel to lower hyphen", upperCamel);
+ return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, upperCamel);
+ }
+ );
}
return lowerHyphen;
@@ -269,14 +272,12 @@ public class MoxyStrategy extends Introspector {
@Override
public String getName() {
String className = internalObject.getClass().getSimpleName();
- String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className);
- /*
- if (this.isContainer()) {
- lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().get(0)).getSimpleName());
- }*/
-
-
- return lowerHyphen;
+ return caseFormatStore
+ .fromUpperCamelToLowerHyphen(className)
+ .orElseGet(() -> {
+ LOGGER.debug("Unable to find {} in the store for upper camel to lower hyphen", className);
+ return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className);
+ });
}
@Override
@@ -313,7 +314,6 @@ public class MoxyStrategy extends Introspector {
@Override
public String preProcessKey (String key) {
String result = "";
- //String trimmedRestURI = restURI.replaceAll("/[\\w\\-]+?/[\\w\\-]+?$", "");
String[] split = key.split("/");
int i = 0;
for (i = split.length-1; i >= 0; i--) {
@@ -334,6 +334,7 @@ public class MoxyStrategy extends Introspector {
public String marshal(MarshallerProperties properties) {
StringWriter result = new StringWriter();
try {
+ Marshaller marshaller = jaxbContext.createMarshaller();
if (properties.getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)) {
marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE, "application/json");
marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_INCLUDE_ROOT, properties.getIncludeRoot());
@@ -344,31 +345,13 @@ public class MoxyStrategy extends Introspector {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, properties.getFormatted());
marshaller.marshal(this.internalObject, result);
} catch (JAXBException e) {
- //e.printStackTrace();
+ LOGGER.warn("Encountered an jaxb exception during marshalling ", LogFormatTools.getStackTop(e));
}
return result.toString();
}
@Override
- public Object clone() {
- Object result = null;
- try {
- unmarshaller = jaxbContext.createUnmarshaller();
-
- unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json");
- unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
- unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
-
- result = unmarshaller.unmarshal(new StreamSource(new StringReader(this.marshal(true))), this.internalObject.getClass()).getValue();
- } catch (JAXBException e) {
- // TODO Auto-generated catch block
- //e.printStackTrace();
- }
- result = IntrospectorFactory.newInstance(getModelType(), result);
- return result;
- }
- @Override
public ModelType getModelType() {
return ModelType.MOXY;
}
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java b/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java
index 6bf03c17..891876af 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java
@@ -27,10 +27,7 @@ import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.Introspector;
-import org.onap.aai.introspection.Loader;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.*;
import org.onap.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException;
import org.onap.aai.schema.enums.PropertyMetadata;
import org.onap.aai.serialization.db.DBSerializer;
@@ -63,9 +60,7 @@ public abstract class SideEffect {
this.dbEngine = dbEngine;
this.serializer = serializer;
this.self = self;
- LoaderFactory loaderFactory = SpringContextAware.getBean(LoaderFactory.class);
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
- this.latestLoader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion()) ;
+ this.latestLoader = LoaderUtil.getLatestVersion();
}
protected void execute() throws UnsupportedEncodingException, URISyntaxException, AAIException {
@@ -91,9 +86,9 @@ public abstract class SideEffect {
}
return result;
}
-
+
protected Map<String, String> findProperties(Introspector obj, String uriString) throws AAIMissingRequiredPropertyException {
-
+
final Map<String, String> result = new HashMap<>();
final Set<String> missing = new LinkedHashSet<>();
Matcher m = template.matcher(uriString);
@@ -111,13 +106,13 @@ public abstract class SideEffect {
missing.add(propName);
}
}
-
+
if (!missing.isEmpty() && (properties != missing.size())) {
throw new AAIMissingRequiredPropertyException("Cannot complete " + this.getPropertyMetadata().toString() + " uri. Missing properties " + missing);
}
return result;
}
-
+
protected Optional<String> replaceTemplates(Introspector obj, String uriString) throws AAIMissingRequiredPropertyException {
String result = uriString;
final Map<String, String> propMap = this.findProperties(obj, uriString);
@@ -132,7 +127,7 @@ public abstract class SideEffect {
result = result.replaceFirst("/[^/]+?(?:/\\*)+", "");
return Optional.of(result);
}
-
+
private Optional<String> resolveRelativePath(Optional<String> populatedUri) throws UnsupportedEncodingException {
if (!populatedUri.isPresent()) {
return Optional.empty();
@@ -140,7 +135,7 @@ public abstract class SideEffect {
return Optional.of(populatedUri.get().replaceFirst("\\./", this.serializer.getURIForVertex(self) + "/"));
}
}
-
+
protected abstract boolean replaceWithWildcard();
protected abstract PropertyMetadata getPropertyMetadata();
protected abstract void processURI(Optional<String> completeUri, Entry<String, String> entry) throws URISyntaxException, UnsupportedEncodingException, AAIException, EdgeRuleNotFoundException, AmbiguousRuleChoiceException;
diff --git a/aai-core/src/main/java/org/onap/aai/parsers/query/QueryParser.java b/aai-core/src/main/java/org/onap/aai/parsers/query/QueryParser.java
index 9129911a..d7f1832c 100644
--- a/aai-core/src/main/java/org/onap/aai/parsers/query/QueryParser.java
+++ b/aai-core/src/main/java/org/onap/aai/parsers/query/QueryParser.java
@@ -21,13 +21,12 @@ package org.onap.aai.parsers.query;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.LoaderUtil;
import org.onap.aai.query.builder.QueryBuilder;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
-
import java.net.URI;
/**
@@ -38,17 +37,17 @@ public abstract class QueryParser {
protected Loader loader = null;
protected Loader latestLoader = null;
protected QueryBuilder<Vertex> queryBuilder = null;
-
+
protected QueryBuilder<Vertex> parentQueryBuilder = null;
-
+
protected URI uri = null;
-
+
protected String resultResource = "";
-
+
protected String parentResourceType = "";
-
+
protected String containerResource = "";
-
+
/**
* Instantiates a new query parser.
*
@@ -61,10 +60,11 @@ public abstract class QueryParser {
this.queryBuilder = queryBuilder;
this.loader = loader;
LoaderFactory loaderFactory = SpringContextAware.getBean(LoaderFactory.class);
- SchemaVersion latest = SpringContextAware.getBean(SchemaVersions.class).getDefaultVersion();
+ SchemaVersion latest = ((SchemaVersions) SpringContextAware.getBean("schemaVersions")).getDefaultVersion();
+
this.latestLoader = loaderFactory.createLoaderForVersion(loader.getModelType(), latest);
}
-
+
/**
* Instantiates a new query parser.
*
@@ -74,21 +74,19 @@ public abstract class QueryParser {
protected QueryParser(Loader loader, QueryBuilder<Vertex> queryBuilder) {
this.queryBuilder = queryBuilder;
this.loader = loader;
- LoaderFactory loaderFactory = SpringContextAware.getBean(LoaderFactory.class);
- SchemaVersion latest = SpringContextAware.getBean(SchemaVersions.class).getDefaultVersion();
- this.latestLoader = loaderFactory.createLoaderForVersion(loader.getModelType(), latest);
+ this.latestLoader = LoaderUtil.getLatestVersion();
}
-
+
/**
* Gets the container type.
*
* @return the container type
*/
public String getContainerType() {
-
+
return this.containerResource;
}
-
+
/**
* Gets the parent result type.
*
@@ -97,7 +95,7 @@ public abstract class QueryParser {
public String getParentResultType() {
return this.parentResourceType;
}
-
+
/**
* Gets the result type.
*
@@ -106,7 +104,7 @@ public abstract class QueryParser {
public String getResultType() {
return this.resultResource;
}
-
+
/**
* Gets the query builder.
*
@@ -115,7 +113,7 @@ public abstract class QueryParser {
public QueryBuilder<Vertex> getQueryBuilder() {
return this.queryBuilder;
}
-
+
/**
* Gets the uri.
*
@@ -124,7 +122,7 @@ public abstract class QueryParser {
public URI getUri() {
return this.uri;
}
-
+
/**
* Gets the parent query builder.
*
@@ -137,7 +135,7 @@ public abstract class QueryParser {
return this.queryBuilder;
}
}
-
+
/**
* Checks if is dependent.
*
diff --git a/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java b/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
index 5ab38544..8cbed6d6 100644
--- a/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
+++ b/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
@@ -90,7 +90,7 @@ public class RelationshipToURI {
//TODO proper spring wiring, but that requires a lot of refactoring so for now we have this
ApplicationContext ctx = SpringContextAware.getApplicationContext();
edgeRules = ctx.getBean(EdgeIngestor.class);
- schemaVersions = ctx.getBean(SchemaVersions.class);
+ schemaVersions = (SchemaVersions) ctx.getBean("schemaVersions");
}
/**
diff --git a/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToRelationshipObject.java b/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToRelationshipObject.java
index cbb6ccdb..08eca16d 100644
--- a/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToRelationshipObject.java
+++ b/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToRelationshipObject.java
@@ -131,7 +131,7 @@ public class URIToRelationshipObject implements Parsable {
URI originalUri = parser.getOriginalURI();
URI relatedLink = new URI(this.baseURL + this.originalVersion + "/" + originalUri);
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions)SpringContextAware.getBean("schemaVersions");
if (this.originalVersion.compareTo(schemaVersions.getRelatedLinkVersion()) >= 0) {
//only return the path section of the URI past v10
relatedLink = new URI(relatedLink.getRawPath());
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
index 80122296..bf9dd17f 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
@@ -226,16 +226,18 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
@Override
public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value) {
- boolean bValue = false;
-
- if(value instanceof String){
- bValue = Boolean.valueOf(value.toString());
- } else if(value instanceof Boolean){
- bValue = (Boolean) value;
+ if(value!=null && !"".equals(value)) {
+ boolean bValue = false;
+
+ if(value instanceof String){//"true"
+ bValue = Boolean.valueOf(value.toString());
+ } else if(value instanceof Boolean){//true
+ bValue = (Boolean) value;
+ }
+
+ traversal.has(key, bValue);
+ stepIndex++;
}
-
- traversal.has(key, bValue);
- stepIndex++;
return (QueryBuilder<Vertex>) this;
}
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
index 43925f49..1dc2cfe8 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
@@ -115,16 +115,18 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
@Override
public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value) {
- boolean bValue = false;
-
- if(value instanceof String){
- bValue = Boolean.valueOf(value.toString());
- } else if(value instanceof Boolean){
- bValue = (Boolean) value;
- }
-
- list.add(HAS + key + "', " + bValue + ")");
- stepIndex++;
+
+ if(value!=null && !"".equals(value)) {
+ boolean bValue = false;
+ if(value instanceof String){
+ bValue = Boolean.valueOf(value.toString());
+ } else if(value instanceof Boolean){
+ bValue = (Boolean) value;
+ }
+
+ list.add(HAS + key + "', " + bValue + ")");
+ stepIndex++;
+ }
return (QueryBuilder<Vertex>) this;
}
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
index 777204f2..68cfd5fc 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
@@ -256,6 +256,10 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
public abstract QueryBuilder<Vertex> createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException;
public abstract QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value);
+
+ public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, MissingOptionalParameter value) {
+ return (QueryBuilder<Vertex>) this;
+ }
/**
* Creates the private edge traversal.
*
diff --git a/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java b/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java
index 48d4ba8c..f5ec19d5 100644
--- a/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java
@@ -51,7 +51,7 @@ public class GroovyQueryBuilder extends AAIAbstractGroovyShell {
@Override
public String executeTraversal (TransactionalGraphEngine engine, String traversal, Map<String, Object> params) {
QueryBuilder<Vertex> builder = engine.getQueryBuilder(QueryStyle.GREMLIN_TRAVERSAL);
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
Loader loader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
builder.changeLoader(loader);
diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java
index a23ff1f9..656392a3 100644
--- a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java
+++ b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java
@@ -23,12 +23,13 @@ package org.onap.aai.serialization.db;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
-import com.google.common.collect.Multimap;
import org.apache.commons.collections.IteratorUtils;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.janusgraph.core.SchemaViolationException;
import org.javatuples.Triplet;
import org.onap.aai.concurrent.AaiCallable;
@@ -50,6 +51,7 @@ import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.introspection.sideeffect.*;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.StopWatch;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.parsers.uri.URIParser;
@@ -61,7 +63,6 @@ import org.onap.aai.serialization.db.exceptions.MultipleEdgeRuleFoundException;
import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.serialization.engines.query.QueryEngine;
-import org.onap.aai.serialization.tinkerpop.TreeBackedVertex;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.util.AAIConfig;
@@ -80,15 +81,17 @@ import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
-import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
public class DBSerializer {
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DBSerializer.class);
+ private static final String IMPLICIT_DELETE = "Implicit DELETE";
+
+ private static final String MISSING_REQUIRED_NODE_PROPERTY = "Vertex missing required aai-node-type property";
+
private final TransactionalGraphEngine engine;
private final String sourceOfTruth;
private final ModelType introspectionType;
@@ -116,7 +119,7 @@ public class DBSerializer {
this.engine = engine;
this.sourceOfTruth = sourceOfTruth;
this.introspectionType = introspectionType;
- this.schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
SchemaVersion LATEST = schemaVersions.getDefaultVersion();
this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, LATEST);
this.version = version;
@@ -414,7 +417,57 @@ public class DBSerializer {
for (Vertex toBeRemoved : processedVertexes) {
dependentVertexes.remove(toBeRemoved);
}
- this.deleteItemsWithTraversal(dependentVertexes);
+
+ // If the dependent vertices are not empty, then with
+ // the current behaviour, it should remove the vertices implicitly
+ // We are updating the code to properly log which call
+ // is doing this so the SE can work with the clients making the call to
+ // tell them not to call this API and can hopefully deprecate this
+ // functionality in the future releases
+ if(!dependentVertexes.isEmpty()){
+
+ LoggingContext.responseDescription(IMPLICIT_DELETE);
+
+ // Find all the deletable vertices from the dependent vertices that should be deleted
+ // So for each of the following dependent vertices,
+ // we will use the edge properties and do the cascade delete
+ List<Vertex> impliedDeleteVertices = this.engine.getQueryEngine().findDeletable(dependentVertexes);
+ int impliedDeleteCount = impliedDeleteVertices.size();
+
+ LOGGER.warn(
+ "For the vertex with id {}, doing an implicit delete on update will delete total of {} vertexes",
+ v.id(),
+ impliedDeleteCount
+ );
+
+ String impliedDeleteLogEnabled = AAIConfig.get(AAIConstants.AAI_IMPLIED_DELETE_LOG_ENABLED, "true");
+
+ int impliedDeleteLogLimit = AAIConfig.getInt(AAIConstants.AAI_IMPLIED_DELETE_LOG_LIMIT, "-1");
+
+ if(impliedDeleteLogLimit == -1){
+ impliedDeleteLogLimit = Integer.MAX_VALUE;
+ }
+
+ // If the logging is enabled for implied delete
+ // then log the payload in the latest format
+ if("true".equals(impliedDeleteLogEnabled) &&
+ impliedDeleteCount <= impliedDeleteLogLimit){
+ for(Vertex vertex : impliedDeleteVertices){
+ Introspector introspector = null;
+ try {
+ introspector = getLatestVersionView(vertex);
+ if(LOGGER.isInfoEnabled()){
+ LOGGER.info("Implied delete object in json format {}", introspector.marshal(false));
+ }
+ } catch(Exception ex){
+ LOGGER.warn("Encountered an exception during retrieval of vertex properties with vertex-id {} -> {}", v.id(), LogFormatTools.getStackTop(ex));
+ }
+ }
+ }
+
+ // After all the appropriate logging, calling the delete to delete the affected vertices
+ this.delete(impliedDeleteVertices);
+ }
this.executePostSideEffects(obj, v);
return processedVertexes;
@@ -907,9 +960,7 @@ public class DBSerializer {
String cleanUp = "false";
boolean nodeOnly = false;
StopWatch.conditionalStart();
- Tree<Element> tree = this.engine.getQueryEngine().findSubGraph(v, depth, nodeOnly);
- TreeBackedVertex treeVertex = new TreeBackedVertex(v, tree);
- this.dbToObject(obj, treeVertex, seen, depth, nodeOnly, cleanUp);
+ this.dbToObject(obj, v, seen, depth, nodeOnly, cleanUp);
dbTimeMsecs += StopWatch.stopIfStarted();
return obj;
}
@@ -1033,7 +1084,16 @@ public class DBSerializer {
}
List<Object> relationshipObjList = obj.getValue("relationship");
- String aNodeType = v.property("aai-node-type").value().toString();
+ VertexProperty nodeTypeProperty = v.property(AAIProperties.NODE_TYPE);
+
+ if(!nodeTypeProperty.isPresent()){
+ LoggingContext.responseDescription(MISSING_REQUIRED_NODE_PROPERTY);
+ LOGGER.warn("Not processing the vertex {} because its missing required property aai-node-type", v.id());
+ LoggingContext.remove(LoggingContext.LoggingField.RESPONSE_DESCRIPTION.toString());
+ return null;
+ }
+
+ String aNodeType = nodeTypeProperty.value().toString();
TypeAlphabetizer alphabetizer = new TypeAlphabetizer();
@@ -1053,19 +1113,21 @@ public class DBSerializer {
// from using the edge rules json and get the edge rule out of it
EdgeRuleQuery.Builder queryBuilder = new EdgeRuleQuery.Builder(aNodeType);
for (Vertex cousin : cousins) {
- VertexProperty vertexProperty = cousin.property("aai-node-type");
+ VertexProperty vertexProperty = cousin.property(AAIProperties.NODE_TYPE);
String bNodeType = null;
if(vertexProperty.isPresent()){
- bNodeType = cousin.property("aai-node-type").value().toString();
+ bNodeType = cousin.property(AAIProperties.NODE_TYPE).value().toString();
} else {
// If the vertex is missing the aai-node-type
// Then its either a bad vertex or its in the process
// of getting deleted so we should ignore these vertexes
+ LoggingContext.responseDescription(MISSING_REQUIRED_NODE_PROPERTY);
if(LOGGER.isDebugEnabled()){
LOGGER.debug("For the vertex {}, unable to retrieve the aai-node-type", v.id().toString());
} else {
LOGGER.info("Unable to retrieve the aai-node-type for vertex, for more info enable debug log");
}
+ LoggingContext.remove(LoggingContext.LoggingField.RESPONSE_DESCRIPTION.toString());
continue;
}
if (obj.getVersion().compareTo(schemaVersions.getEdgeLabelVersion()) >= 0) {
@@ -1594,7 +1656,6 @@ public class DBSerializer {
public void deleteItemsWithTraversal(List<Vertex> vertexes) throws IllegalStateException {
for (Vertex v : vertexes) {
- LOGGER.debug("About to delete the vertex with id: " + v.id());
deleteWithTraversal(v);
}
@@ -1610,10 +1671,39 @@ public class DBSerializer {
List<Vertex> results = this.engine.getQueryEngine().findDeletable(startVertex);
for (Vertex v : results) {
- LOGGER.warn("Removing vertex " + v.id().toString());
+ LOGGER.debug("Removing vertex {} with label {}", v.id(), v.label());
+ v.remove();
+ }
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
+
+ /**
+ * Removes the list of vertexes from the graph
+ * <p>
+ * Current the vertex label will just be vertex but
+ * in the future the aai-node-type property will be replaced
+ * by using the vertex label as when retrieving an vertex
+ * and retrieving an single property on an vertex will pre-fetch
+ * all the properties of that vertex and this is due to the following property
+ * <p>
+ * <code>
+ * query.fast-property=true
+ * </code>
+ * <p>
+ * JanusGraph doesn't provide the capability to override that
+ * at a transaction level and there is a plan to move to vertex label
+ * so it is best to utilize this for now and when the change is applied
+ *
+ * @param vertices - list of vertices to delete from the graph
+ */
+ void delete(List<Vertex> vertices){
+ StopWatch.conditionalStart();
+ for (Vertex v : vertices) {
+ LOGGER.debug("Removing vertex {} with label {}", v.id(), v.label());
v.remove();
}
+
dbTimeMsecs += StopWatch.stopIfStarted();
}
diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java
index d072db55..94557b08 100644
--- a/aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java
+++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java
@@ -58,7 +58,7 @@ public class GraphTraversalQueryEngine extends QueryEngine {
/**
* Instantiates a new graph traversal query engine.
*
- * @param graphEngine the graph engine
+ * @param g graph traversal source to traverse the graph
*/
public GraphTraversalQueryEngine(GraphTraversalSource g) {
super(g);
@@ -146,18 +146,47 @@ public class GraphTraversalQueryEngine extends QueryEngine {
*/
@Override
public List<Vertex> findDeletable(Vertex start) {
- @SuppressWarnings("unchecked")
- GraphTraversal<Vertex, Vertex> pipe = this.g
- .V(start).emit(v -> true).repeat(
- __.union(
- __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
- __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
- )
- ).dedup();
+ try {
+ StopWatch.conditionalStart();
+ @SuppressWarnings("unchecked")
+ GraphTraversal<Vertex, Vertex> pipe = this.g
+ .V(start).emit(v -> true).repeat(
+ __.union(
+ __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
+ __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
+ )
+ ).dedup();
- return pipe.toList();
+ return pipe.toList();
+ } finally {
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Vertex> findDeletable(List<Vertex> startVertexes) {
+ try {
+ StopWatch.conditionalStart();
+ Vertex[] vertices = new Vertex[startVertexes.size()];
+ vertices = startVertexes.toArray(vertices);
+ GraphTraversal<Vertex, Vertex> pipe = this.g
+ .V(vertices).emit(v -> true).repeat(
+ __.union(
+ __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
+ __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
+ )
+ ).dedup();
+
+ return pipe.toList();
+ }
+ finally {
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/query/QueryEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/query/QueryEngine.java
index 110f8628..1e2da4b8 100644
--- a/aai-core/src/main/java/org/onap/aai/serialization/engines/query/QueryEngine.java
+++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/query/QueryEngine.java
@@ -37,7 +37,7 @@ public abstract class QueryEngine {
/**
* Instantiates a new query engine.
*
- * @param graphEngine the graph engine
+ * @param g graph traversal source to traverse the graph
*/
public QueryEngine (GraphTraversalSource g) {
this.g = g;
@@ -100,6 +100,15 @@ public abstract class QueryEngine {
*/
public abstract List<Vertex> findDeletable(Vertex start);
+ /**
+ * Find all vertices that should be deleted in a cascade from a delete of start vertexes
+ *
+ * @param startVertexes Specifies the list of start vertexes
+ *
+ * @return the list of vertices to be deleted when start list of vertexes is deleted
+ */
+ public abstract List<Vertex> findDeletable(List<Vertex> startVertexes);
+
/**
* Finds the subgraph under start, including cousins as well as start's children/grandchildren/etc.
* More specifically, this includes start, all its descendants, start's cousins, and start's
diff --git a/aai-core/src/main/java/org/onap/aai/util/AAIConfig.java b/aai-core/src/main/java/org/onap/aai/util/AAIConfig.java
index 5b48127c..86cb635e 100644
--- a/aai-core/src/main/java/org/onap/aai/util/AAIConfig.java
+++ b/aai-core/src/main/java/org/onap/aai/util/AAIConfig.java
@@ -24,10 +24,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Properties;
-import java.util.Timer;
import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.LoggingContext.StatusCode;
@@ -47,7 +44,7 @@ public class AAIConfig {
private static final String GLOBAL_PROP_FILE_NAME = AAIConstants.AAI_CONFIG_FILENAME;
private static Properties serverProps;
private static boolean propsInitialized = false;
-
+
/**
* Instantiates a new AAI config.
*/
@@ -71,11 +68,11 @@ public class AAIConfig {
LoggingContext.statusCode(StatusCode.COMPLETE);
LOGGER.info("Initializing AAIConfig");
-
+
AAIConfig.getConfigFile();
AAIConfig.reloadConfig();
-
- if (AAIConstants.AAI_NODENAME == null || AAIConstants.AAI_NODENAME == "") {
+
+ if (AAIConstants.AAI_NODENAME == null || AAIConstants.AAI_NODENAME == "") {
ErrorLogHelper.logError("AAI_4005", " AAI_NODENAME is not defined");
} else {
LOGGER.info("A&AI Server Node Name = " + AAIConstants.AAI_NODENAME);
@@ -99,9 +96,9 @@ public class AAIConfig {
String propFileName = GLOBAL_PROP_FILE_NAME;
Properties newServerProps = null;
-
+
LOGGER.debug("Reloading config from " + propFileName);
-
+
try(InputStream is = new FileInputStream(propFileName)) {
newServerProps = new Properties();
newServerProps.load(is);
@@ -113,7 +110,7 @@ public class AAIConfig {
ErrorLogHelper.logError("AAI_4002", " " + propFileName + ". IOException: "+e.getMessage());
}
}
-
+
/**
* Gets the.
*
@@ -142,7 +139,7 @@ public class AAIConfig {
*/
public static String get(String key) throws AAIException {
String response = null;
-
+
if (key.equals(AAIConstants.AAI_NODENAME)) {
// Get this from InetAddress rather than the properties file
String nodeName = getNodeName();
@@ -151,16 +148,16 @@ public class AAIConfig {
}
// else get from property file
}
-
+
if (!propsInitialized || (serverProps == null)) {
reloadConfig();
}
-
+
if ((key.endsWith("password") || key.endsWith("passwd") || key.endsWith("apisecret")) && serverProps.containsKey(key+".x")) {
String valx = serverProps.getProperty(key+".x");
return Password.deobfuscate(valx);
}
-
+
if (!serverProps.containsKey(key)) {
throw new AAIException("AAI_4005", "Property key "+key+" cannot be found");
} else {
@@ -180,9 +177,19 @@ public class AAIConfig {
* @throws AAIException the AAI exception
*/
public static int getInt(String key) throws AAIException{
- return Integer.valueOf(AAIConfig.get(key));
+ return Integer.parseInt(AAIConfig.get(key));
}
+ /**
+ * Gets the int.
+ *
+ * @param key the key
+ * @return the int
+ */
+ public static int getInt(String key, String value) {
+ return Integer.parseInt(AAIConfig.get(key, value));
+ }
+
/**
* Gets the server props.
*
@@ -191,7 +198,7 @@ public class AAIConfig {
public static Properties getServerProps() {
return serverProps;
}
-
+
/**
* Gets the node name.
*
@@ -211,8 +218,8 @@ public class AAIConfig {
}
return null;
}
-
-
+
+
/**
* Check if a null or an Empty string is passed in.
*
diff --git a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java
index b735f722..b9fb08f8 100644
--- a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java
+++ b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java
@@ -69,6 +69,15 @@ public final class AAIConstants {
public static final String AAI_NODENAME = "aai.config.nodename";
+ /*
+ * Logs the objects being deleted when an client deletes objects via implied delete during PUT operation
+ */
+ public static final String AAI_IMPLIED_DELETE_LOG_ENABLED = "aai.implied.delete.log.enabled";
+ /*
+ * Specifies how many objects maximum to log
+ */
+ public static final String AAI_IMPLIED_DELETE_LOG_LIMIT = "aai.implied.delete.log.limit";
+
public static final String AAI_BULKCONSUMER_LIMIT = "aai.bulkconsumer.payloadlimit";
public static final String AAI_BULKCONSUMER_OVERRIDE_LIMIT = "aai.bulkconsumer.payloadoverride";
diff --git a/aai-core/src/main/java/org/onap/aai/util/GenerateXsd.java b/aai-core/src/main/java/org/onap/aai/util/GenerateXsd.java
index 97803653..f44663e0 100644
--- a/aai-core/src/main/java/org/onap/aai/util/GenerateXsd.java
+++ b/aai-core/src/main/java/org/onap/aai/util/GenerateXsd.java
@@ -104,7 +104,7 @@ public class GenerateXsd {
return true;
}
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
for (SchemaVersion v : schemaVersions.getVersions()) {
if (v.equals(versionToGen)) {
return true;
diff --git a/aai-core/src/main/java/org/onap/aai/util/genxsd/ConfigTranslatorForDocs.java b/aai-core/src/main/java/org/onap/aai/util/genxsd/ConfigTranslatorForDocs.java
index 0ee9cc83..3a42e437 100644
--- a/aai-core/src/main/java/org/onap/aai/util/genxsd/ConfigTranslatorForDocs.java
+++ b/aai-core/src/main/java/org/onap/aai/util/genxsd/ConfigTranslatorForDocs.java
@@ -23,22 +23,18 @@ package org.onap.aai.util.genxsd;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-import org.springframework.context.annotation.Configuration;
+import org.onap.aai.setup.SchemaConfigVersions;
public class ConfigTranslatorForDocs extends ConfigTranslator {
- public ConfigTranslatorForDocs(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public ConfigTranslatorForDocs(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/AAISetup.java b/aai-core/src/test/java/org/onap/aai/AAISetup.java
index fb914f01..b464ef46 100644
--- a/aai-core/src/test/java/org/onap/aai/AAISetup.java
+++ b/aai-core/src/test/java/org/onap/aai/AAISetup.java
@@ -25,6 +25,7 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.config.IntrospectionConfig;
@@ -34,11 +35,10 @@ import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.config.RestBeanConfig;
import org.onap.aai.rest.db.HttpEntry;
import org.onap.aai.setup.AAIConfigTranslator;
-import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
-import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
import org.onap.aai.util.AAIConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -49,8 +49,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
AAIConfigTranslator.class,
EdgeIngestor.class,
EdgeSerializer.class,
diff --git a/aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java b/aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java
index dc32e932..fb91e316 100644
--- a/aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java
+++ b/aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java
@@ -34,7 +34,7 @@ import org.onap.aai.util.AAIConstants;
*/
public abstract class AbstractConfigTranslator extends ConfigTranslator {
- public AbstractConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public AbstractConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/DataLinkSetup.java b/aai-core/src/test/java/org/onap/aai/DataLinkSetup.java
index 0138f329..125bb111 100644
--- a/aai-core/src/test/java/org/onap/aai/DataLinkSetup.java
+++ b/aai-core/src/test/java/org/onap/aai/DataLinkSetup.java
@@ -22,6 +22,7 @@ package org.onap.aai;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.IntrospectionConfig;
import org.onap.aai.config.RestBeanConfig;
import org.onap.aai.config.SpringContextAware;
@@ -50,8 +51,7 @@ import java.util.Map;
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
TestUtilConfigTranslatorforDataLink.class,
EdgeIngestor.class,
EdgeSerializer.class,
diff --git a/aai-core/src/test/java/org/onap/aai/HttpTestUtil.java b/aai-core/src/test/java/org/onap/aai/HttpTestUtil.java
index 92cb59c5..6add23e0 100644
--- a/aai-core/src/test/java/org/onap/aai/HttpTestUtil.java
+++ b/aai-core/src/test/java/org/onap/aai/HttpTestUtil.java
@@ -138,7 +138,7 @@ public class HttpTestUtil extends RESTAPI {
}
}
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
if(version == null){
version = schemaVersions.getDefaultVersion();
}
@@ -235,7 +235,7 @@ public class HttpTestUtil extends RESTAPI {
}
}
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
if(version == null){
version = schemaVersions.getDefaultVersion();
}
@@ -331,7 +331,7 @@ public class HttpTestUtil extends RESTAPI {
}
}
- SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
+ SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
if(version == null){
version = schemaVersions.getDefaultVersion();
}
diff --git a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java
index a9f5a60f..b26c0b05 100644
--- a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java
+++ b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraphFactory;
import org.junit.*;
import org.junit.runner.RunWith;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.IntrospectionConfig;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.exceptions.AAIException;
@@ -63,8 +64,7 @@ import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
QueryTestsConfigTranslator.class,
NodeIngestor.class,
EdgeIngestor.class,
@@ -88,10 +88,11 @@ public abstract class QueryBuilderTestAbstraction {
protected EdgeSerializer testEdgeSer;
@Autowired
- protected LoaderFactory loaderFactory;
+ protected SchemaVersions schemaVersions;
@Autowired
- protected SchemaVersions schemaVersions;
+ protected LoaderFactory loaderFactory;
+
@BeforeClass
public static void setup() throws Exception {
diff --git a/aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java b/aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java
index b1dc9df6..84c4bdd1 100644
--- a/aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java
+++ b/aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java
@@ -22,6 +22,7 @@ package org.onap.aai.query.builder;
import java.util.*;
import org.onap.aai.AbstractConfigTranslator;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -33,7 +34,7 @@ import org.onap.aai.setup.SchemaVersions;
*/
public class QueryTestsConfigTranslator extends AbstractConfigTranslator {
- public QueryTestsConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public QueryTestsConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java b/aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java
index ef7f25e5..9c37ad99 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java
@@ -22,6 +22,7 @@ package org.onap.aai.serialization.db;
import java.util.*;
import org.onap.aai.AbstractConfigTranslator;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -32,7 +33,7 @@ import org.onap.aai.setup.SchemaVersions;
*/
public class AAICoreFakeEdgesConfigTranslator extends AbstractConfigTranslator {
- public AAICoreFakeEdgesConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public AAICoreFakeEdgesConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java b/aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java
index 18ba9d99..149d2849 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java
@@ -20,6 +20,7 @@
package org.onap.aai.serialization.db;
import org.onap.aai.AbstractConfigTranslator;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -32,7 +33,7 @@ import java.util.*;
*/
public class AAICorePrivateEdgeTestConfigTranslator extends AbstractConfigTranslator {
- public AAICorePrivateEdgeTestConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public AAICorePrivateEdgeTestConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java
index a74ceee8..1ddef28c 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java
@@ -19,6 +19,7 @@
*/
package org.onap.aai.serialization.db;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.util.AAIConstants;
@@ -59,8 +60,7 @@ import static org.mockito.Mockito.when;
//@RunWith(value = Parameterized.class) TODO replace this functionality
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
AAICoreFakeEdgesConfigTranslator.class,
NodeIngestor.class,
EdgeIngestor.class,
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java b/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
index c4ae8889..34ba2ab8 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
@@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.serialization.db.AAICoreFakeEdgesConfigTranslator;
@@ -45,8 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
AAICoreFakeEdgesConfigTranslator.class,
EdgeIngestor.class,
EdgeSerializer.class
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java
index 728416be..154761ae 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
@@ -55,8 +56,7 @@ import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
- SchemaVersions.class,
+ ConfigConfiguration.class,
AAICorePrivateEdgeTestConfigTranslator.class,
EdgeIngestor.class,
EdgeSerializer.class,
diff --git a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
index 02c187ac..6dab1743 100644
--- a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
+++ b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
@@ -29,11 +29,11 @@ import java.util.TreeMap;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.setup.SchemaConfigVersions;
public class TestUtilConfigTranslatorforBusiness extends ConfigTranslator {
- public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforDataLink.java b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforDataLink.java
index 36d5fe77..d82c9d80 100644
--- a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforDataLink.java
+++ b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforDataLink.java
@@ -23,13 +23,13 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.*;
public class TestUtilConfigTranslatorforDataLink extends ConfigTranslator {
- public TestUtilConfigTranslatorforDataLink(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public TestUtilConfigTranslatorforDataLink(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java
index cc4fdd6c..ca6c6740 100644
--- a/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java
+++ b/aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java
@@ -29,11 +29,11 @@ import java.util.TreeMap;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.setup.SchemaConfigVersions;
public class TestUtilConfigTranslatorforEdges extends ConfigTranslator {
- public TestUtilConfigTranslatorforEdges(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public TestUtilConfigTranslatorforEdges(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-core/src/test/java/org/onap/aai/util/GenerateXsdTest.java b/aai-core/src/test/java/org/onap/aai/util/GenerateXsdTest.java
index 1cd226f3..00bbae49 100644
--- a/aai-core/src/test/java/org/onap/aai/util/GenerateXsdTest.java
+++ b/aai-core/src/test/java/org/onap/aai/util/GenerateXsdTest.java
@@ -29,6 +29,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SwaggerGenerationConfiguration;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
@@ -53,12 +54,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaLocationsBean.class,
+ ConfigConfiguration.class,
TestUtilConfigTranslatorforBusiness.class,
EdgeIngestor.class,
NodeIngestor.class,
- SwaggerGenerationConfiguration.class,
- SchemaVersions.class
+ SwaggerGenerationConfiguration.class
})
@TestPropertySource(properties = {
"schema.uri.base.path = /aai"
diff --git a/aai-core/src/test/java/org/onap/aai/util/genxsd/EdgeDescriptionTest.java b/aai-core/src/test/java/org/onap/aai/util/genxsd/EdgeDescriptionTest.java
index 88cf4562..f6684f43 100644
--- a/aai-core/src/test/java/org/onap/aai/util/genxsd/EdgeDescriptionTest.java
+++ b/aai-core/src/test/java/org/onap/aai/util/genxsd/EdgeDescriptionTest.java
@@ -36,6 +36,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
@@ -52,7 +53,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.google.common.collect.Multimap;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaVersions.class, SchemaLocationsBean.class, TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class})
+@ContextConfiguration(classes = {ConfigConfiguration.class, TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class})
@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/schemaIngest/schemaIngestTest.properties"})
diff --git a/aai-core/src/test/java/org/onap/aai/util/genxsd/HTMLfromOXMTest.java b/aai-core/src/test/java/org/onap/aai/util/genxsd/HTMLfromOXMTest.java
index 57835b50..ca63244e 100644
--- a/aai-core/src/test/java/org/onap/aai/util/genxsd/HTMLfromOXMTest.java
+++ b/aai-core/src/test/java/org/onap/aai/util/genxsd/HTMLfromOXMTest.java
@@ -35,6 +35,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SwaggerGenerationConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -57,8 +58,7 @@ import org.w3c.dom.Element;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaVersions.class,
- SchemaLocationsBean.class,
+ ConfigConfiguration.class,
TestUtilConfigTranslatorforBusiness.class,
EdgeIngestor.class,
NodeIngestor.class,
diff --git a/aai-core/src/test/java/org/onap/aai/util/genxsd/NodesYAMLfromOXMTest.java b/aai-core/src/test/java/org/onap/aai/util/genxsd/NodesYAMLfromOXMTest.java
index c839619d..b08ddcee 100644
--- a/aai-core/src/test/java/org/onap/aai/util/genxsd/NodesYAMLfromOXMTest.java
+++ b/aai-core/src/test/java/org/onap/aai/util/genxsd/NodesYAMLfromOXMTest.java
@@ -37,6 +37,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.AAISetup;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SwaggerGenerationConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -56,8 +57,7 @@ import org.w3c.dom.Element;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaVersions.class,
- SchemaLocationsBean.class,
+ ConfigConfiguration.class,
TestUtilConfigTranslatorforEdges.class,
EdgeIngestor.class,
NodeIngestor.class,
diff --git a/aai-core/src/test/java/org/onap/aai/util/genxsd/YAMLfromOXMTest.java b/aai-core/src/test/java/org/onap/aai/util/genxsd/YAMLfromOXMTest.java
index 813ad837..e9a52a39 100644
--- a/aai-core/src/test/java/org/onap/aai/util/genxsd/YAMLfromOXMTest.java
+++ b/aai-core/src/test/java/org/onap/aai/util/genxsd/YAMLfromOXMTest.java
@@ -38,6 +38,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.AAISetup;
+import org.onap.aai.config.ConfigConfiguration;
import org.onap.aai.config.SwaggerGenerationConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
@@ -66,10 +67,8 @@ import com.google.common.collect.Multimap;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {
- SchemaVersions.class,
- SchemaLocationsBean.class,
+ ConfigConfiguration.class,
TestUtilConfigTranslatorforBusiness.class,
- SchemaVersions.class,
EdgeIngestor.class,
NodeIngestor.class,
SwaggerGenerationConfiguration.class
diff --git a/aai-rest/pom.xml b/aai-rest/pom.xml
index 526bf2f2..9cd73473 100644
--- a/aai-rest/pom.xml
+++ b/aai-rest/pom.xml
@@ -29,11 +29,11 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-rest</artifactId>
<name>aai-rest</name>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<properties>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
@@ -92,7 +92,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>4.5.1</version>
+ <version>4.5.5</version>
</dependency>
<!--
Explicitly stating the security spring framework and
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java
new file mode 100644
index 00000000..652f399a
--- /dev/null
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java
@@ -0,0 +1,88 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2019 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=========================================================
+ */
+package org.onap.aai.restclient;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Component;
+import org.springframework.util.MultiValueMap;
+
+import java.util.Collections;
+import java.util.Map;
+
+@Component(value=ClientType.AAI)
+public class AAIRestClient extends TwoWaySSLRestClient{
+
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(AAIRestClient.class);
+
+ @Value("${aai.base.url}")
+ private String baseUrl;
+
+ @Value("${aai.ssl.key-store}")
+ private String keystorePath;
+
+ @Value("${aai.ssl.trust-store}")
+ private String truststorePath;
+
+ @Value("${aai.ssl.key-store-password}")
+ private String keystorePassword;
+
+ @Value("${aai.ssl.trust-store-password}")
+ private String truststorePassword;
+
+ @Override
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ @Override
+ protected String getKeystorePath() {
+ return keystorePath;
+ }
+
+ @Override
+ protected String getTruststorePath() {
+ return truststorePath;
+ }
+
+ @Override
+ protected char[] getKeystorePassword() {
+ return keystorePassword.toCharArray();
+ }
+
+ @Override
+ protected char[] getTruststorePassword() {
+ return truststorePassword.toCharArray();
+ }
+
+ @Override
+ public MultiValueMap<String, String> getHeaders(Map<String, String> headers) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON);
+ httpHeaders.add("Real-Time", "true");
+ headers.forEach(httpHeaders::add);
+ return httpHeaders;
+ }
+
+}
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/ClientType.java b/aai-rest/src/main/java/org/onap/aai/restclient/ClientType.java
new file mode 100644
index 00000000..855bab71
--- /dev/null
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/ClientType.java
@@ -0,0 +1,24 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2019 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=========================================================
+ */
+package org.onap.aai.restclient;
+
+public class ClientType {
+ public static final String AAI = "aai-rest-client";
+}
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java
index 7e3524d7..47fe99d8 100644
--- a/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 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.
@@ -42,7 +42,7 @@ public abstract class NoAuthRestClient extends RestClient{
.requestFactory(new HttpComponentsClientHttpRequestFactory(client))
.build();
- restTemplate.setErrorHandler(new RestClientResponseErrorHandler(getLogger()));
+ restTemplate.setErrorHandler(new RestClientResponseErrorHandler());
}
@Override
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java
index e502e5e5..96cd51e8 100644
--- a/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 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.
@@ -19,6 +19,8 @@
*/
package org.onap.aai.restclient;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
@@ -36,6 +38,8 @@ import java.security.KeyStore;
public abstract class OneWaySSLRestClient extends RestClient {
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(OneWaySSLRestClient.class);
+
private RestTemplate restTemplate;
@PostConstruct
@@ -59,7 +63,7 @@ public abstract class OneWaySSLRestClient extends RestClient {
.requestFactory(new HttpComponentsClientHttpRequestFactory(client))
.build();
- restTemplate.setErrorHandler(new RestClientResponseErrorHandler(getLogger()));
+ restTemplate.setErrorHandler(new RestClientResponseErrorHandler());
}
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java
index a17880f3..6ac51b2f 100644
--- a/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright © 2018 IBM.
* ================================================================================
@@ -32,6 +32,8 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Map;
public abstract class RestClient {
@@ -40,17 +42,82 @@ public abstract class RestClient {
@Value("${spring.application.name}")
protected String appName;
- public ResponseEntity execute(String uri, HttpMethod method, Map<String, String> headers, String body) throws RestClientException {
- HttpEntity httpEntity;
- log.debug("Headers: " + headers.toString());
+ /**
+ * Execute the given http method against the uri with passed headers
+ * @param uri properly encoded, can include query params also properly encoded
+ * @param method http method of the request
+ * @param headers headers for the request
+ * @param body body of the request
+ * @return response of request
+ * @throws RestClientException on internal rest template exception or invalid url
+ */
+ public ResponseEntity execute(String uri, HttpMethod method, Map<String,String> headers, String body) throws RestClientException {
+
+ HttpEntity<String> httpEntity;
+ log.debug ("Headers: {}", headers);
if (body == null) {
- httpEntity = new HttpEntity(getHeaders(headers));
+ httpEntity = new HttpEntity<>(getHeaders(headers));
} else {
- httpEntity = new HttpEntity(body, getHeaders(headers));
+ httpEntity = new HttpEntity<>(body, getHeaders(headers));
}
- String url = getBaseUrl() + uri;
- return getRestTemplate().exchange(url, method, httpEntity, String.class);
+
+ // verify that either the base url ends with '/' or uri starts with '/', adjust uri accordingly.
+ if (getBaseUrl().endsWith("/") && uri.startsWith("/")) {
+ uri = uri.replaceFirst("/", "");
+ } else if (!getBaseUrl().endsWith("/") && !uri.startsWith("/")) {
+ uri = "/" + uri;
+ }
+
+ URI url;
+ try {
+ url = new URI(getBaseUrl() + uri);
+ } catch (URISyntaxException e) {
+ log.error("URL syntax error with url {}{}", getBaseUrl(), uri);
+ throw new RestClientException(e.getMessage());
+ }
+ log.debug("METHOD={},URL={},http={}" + method, url, httpEntity);
+
+ ResponseEntity responseEntity = getRestTemplate().exchange(url, method, httpEntity, String.class);
+ log.debug("RESPONSE={}", responseEntity);
+ return responseEntity;
+ }
+
+ /**
+ * Execute the given http method against the uri with passed headers
+ * @param uri properly encoded, can include query params also properly encoded
+ * @param method http method of the request
+ * @param headers headers for the request
+ * @param body body of the request
+ * @return response of request
+ * @throws RestClientException on internal rest template exception or invalid url
+ */
+ public ResponseEntity execute(String uri, String method, Map<String,String> headers, String body) throws RestClientException{
+ return execute(uri, HttpMethod.valueOf(method), headers, body);
+ }
+
+ /**
+ * Execute the given http method against the uri with passed headers
+ * @param uri properly encoded, can include query params also properly encoded
+ * @param method http method of the request
+ * @param headers headers for the request
+ * @return response of request
+ * @throws RestClientException on internal rest template exception or invalid url
+ */
+ public ResponseEntity execute(String uri, HttpMethod method, Map<String,String> headers) throws RestClientException{
+ return execute(uri, method, headers, null);
+ }
+
+ /**
+ * Execute the given http method against the uri with passed headers
+ * @param uri properly encoded, can include query params also properly encoded
+ * @param method http method of the request
+ * @param headers headers for the request
+ * @return response of request
+ * @throws RestClientException on internal rest template exception or invalid url
+ */
+ public ResponseEntity execute(String uri, String method, Map<String,String> headers) throws RestClientException{
+ return execute(uri, HttpMethod.valueOf(method), headers, null);
}
public ResponseEntity executeResource(String uri, HttpMethod method, Map<String, String> headers, String body) throws RestClientException {
@@ -66,10 +133,6 @@ public abstract class RestClient {
return getRestTemplate().exchange(url, method, httpEntity, Resource.class);
}
- public ResponseEntity execute(String uri, String method, Map<String, String> headers) throws RestClientException {
- return execute(uri, HttpMethod.valueOf(method), headers, null);
- }
-
public ResponseEntity getGetRequest(String content, String uri, Map<String, String> headersMap) {
return this.execute(
uri,
@@ -94,6 +157,4 @@ public abstract class RestClient {
protected abstract MultiValueMap<String, String> getHeaders(Map<String, String> headers);
- protected abstract EELFLogger getLogger();
-
}
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java b/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java
index 1d6486b0..2271a1f5 100644
--- a/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java
@@ -20,6 +20,7 @@
package org.onap.aai.restclient;
import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
@@ -28,11 +29,7 @@ import java.io.IOException;
public class RestClientResponseErrorHandler implements ResponseErrorHandler {
- private EELFLogger logger;
-
- public RestClientResponseErrorHandler(EELFLogger logger) {
- this.logger = logger;
- }
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(RestClientResponseErrorHandler.class);
@Override
public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException {
diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java
index 2fe9500f..dd5deaa6 100644
--- a/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java
+++ b/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 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.
@@ -19,6 +19,8 @@
*/
package org.onap.aai.restclient;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
@@ -36,6 +38,8 @@ import java.security.KeyStore;
public abstract class TwoWaySSLRestClient extends RestClient {
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(TwoWaySSLRestClient.class);
+
private RestTemplate restTemplate;
@PostConstruct
@@ -62,7 +66,7 @@ public abstract class TwoWaySSLRestClient extends RestClient {
.requestFactory(new HttpComponentsClientHttpRequestFactory(client))
.build();
- restTemplate.setErrorHandler(new RestClientResponseErrorHandler(getLogger()));
+ restTemplate.setErrorHandler(new RestClientResponseErrorHandler());
}
diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml
index 14ccd8d4..5b817436 100644
--- a/aai-schema-ingest/pom.xml
+++ b/aai-schema-ingest/pom.xml
@@ -25,11 +25,11 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-schema-ingest</artifactId>
<name>aai-schema-ingest</name>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/ConfigConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/ConfigConfiguration.java
index 9f28cf8f..11f0da6a 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/config/ConfigConfiguration.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/ConfigConfiguration.java
@@ -21,6 +21,7 @@
*/
package org.onap.aai.config;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersions;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -34,9 +35,14 @@ import org.springframework.context.annotation.PropertySource;
@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
public class ConfigConfiguration {
+ @Bean(name = "schemaConfigVersions")
+ public SchemaConfigVersions schemaConfigVersions() {
+ return new SchemaConfigVersions();
+ }
+
@Bean(name = "schemaVersions")
public SchemaVersions schemaVersions() {
- return new SchemaVersions();
+ return schemaConfigVersions();
}
@Bean(name = "schemaLocationsBean")
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/EdgesConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/EdgesConfiguration.java
index e492d213..605dc0cf 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/config/EdgesConfiguration.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/EdgesConfiguration.java
@@ -22,10 +22,10 @@
package org.onap.aai.config;
import org.onap.aai.edges.EdgeIngestor;
-import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -39,6 +39,7 @@ import java.util.Set;
@Import({SchemaServiceConfiguration.class, ConfigConfiguration.class, TranslatorConfiguration.class})
@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
+
@Configuration
public class EdgesConfiguration {
@@ -70,6 +71,7 @@ public class EdgesConfiguration {
}
@Bean(name = "edgeIngestor")
+ @ConditionalOnExpression("'${schema.translators.needed:all}'.contains('edges') || '${schema.translators.needed:all}'.contains('all')")
public EdgeIngestor edgeIngestor() {
return new EdgeIngestor(translators());
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java
index 50738df9..8c520aaa 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java
@@ -24,10 +24,10 @@ package org.onap.aai.config;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.onap.aai.nodes.NodeIngestor;
-import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -38,9 +38,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
@Import({SchemaServiceConfiguration.class, ConfigConfiguration.class, TranslatorConfiguration.class})
@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
+
@Configuration
public class NodesConfiguration {
@@ -75,6 +77,7 @@ public class NodesConfiguration {
}
@Bean(name = "nodeIngestor")
+ @ConditionalOnExpression("'${schema.translators.needed:all}'.contains('nodes') || '${schema.translators.needed:all}'.contains('all')")
public NodeIngestor nodeIngestor() {
return new NodeIngestor(translators());
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java
index 81ef02a8..c6decb03 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java
@@ -21,10 +21,7 @@
*/
package org.onap.aai.config;
-import org.onap.aai.setup.SchemaServiceTranslator;
-import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersionsBean;
-import org.onap.aai.setup.Translator;
+import org.onap.aai.setup.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -41,14 +38,19 @@ public class SchemaServiceConfiguration {
return new SchemaVersionsBean();
}
+ @Bean(name = "schemaServiceVersions")
+ public SchemaServiceVersions schemaServiceVersions() {
+ return schemaVersionsBean().getSchemaVersions();
+ }
+
@Bean(name = "schemaVersions")
public SchemaVersions schemaVersions() {
- return schemaVersionsBean().getSchemaVersions();
+ return schemaServiceVersions();
}
@Bean(name = "schemaServiceTranslator")
public Translator schemaServiceTranslator() {
- return new SchemaServiceTranslator(schemaVersions());
+ return new SchemaServiceTranslator(schemaServiceVersions());
}
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
index 213ff590..5d8c3d55 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
@@ -76,7 +76,6 @@ public class EdgeIngestor {
@Autowired
public EdgeIngestor(Set<Translator> translatorSet) {
- LOGGER.debug("Local Schema files will be fetched");
this.translators = translatorSet;
}
@@ -89,8 +88,8 @@ public class EdgeIngestor {
translateAll(translator);
} catch (Exception e) {
- LOGGER.debug("Error while Processing the translator" + e.getMessage());
- continue;
+ LOGGER.error("Error while Processing the translator" + e.getMessage());
+ throw new ExceptionInInitializerError("EdgeIngestor could not ingest schema");
}
}
if (versionJsonFilesMap.isEmpty() || schemaVersions==null ) {
@@ -98,7 +97,7 @@ public class EdgeIngestor {
}
}
- public void translateAll(Translator translator) {
+ public void translateAll(Translator translator) throws ExceptionInInitializerError{
/*
Use SchemaVersions from the Translator
*/
@@ -115,7 +114,8 @@ public class EdgeIngestor {
try {
jsonPayloads = translator.getJsonPayload(version); // need to change this - need to receive the json files.
} catch (IOException e) {
- LOGGER.info("Exception in retrieving the JSON Payload"+e.getMessage());
+ LOGGER.error("Error in retrieving the JSON Payload" + e.getMessage());
+ throw new ExceptionInInitializerError("EdgeIngestor could not ingest schema");
}
if (jsonPayloads == null || jsonPayloads.isEmpty()) {
continue;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/CaseFormatStore.java b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/CaseFormatStore.java
new file mode 100644
index 00000000..69a153da
--- /dev/null
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/CaseFormatStore.java
@@ -0,0 +1,105 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2019 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=========================================================
+ */
+package org.onap.aai.nodes;
+
+import com.google.common.base.CaseFormat;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * CaseFormatStore stores the converted strings from
+ * lower hyphen (example-object) to lower camel case (exampleObject)
+ * so it avoids the creation of the object for every single request
+ * and cause an issue with taking too much memory just for the conversion
+ */
+public class CaseFormatStore {
+
+ private final Map<String, String> lowerHyphenToLowerCamel = new HashMap<>();
+ private final Map<String, String> lowerHyphenToUpperCamel = new HashMap<>();
+ private final Map<String, String> lowerCamelToLowerHyphen = new HashMap<>();
+ private final Map<String, String> upperCamelToLowerHyphen = new HashMap<>();
+
+ CaseFormatStore(){}
+
+ /**
+ * Parses the document and creates a lower camel case string
+ * upper camel string, lower hyphen and lower camel case
+ *
+ * @param doc Takes an xml document and adds it to the hash maps as appropriate
+ */
+ void parse(Document doc){
+
+ // Get the xml-root-element and add those nodes
+ // with the attribute name and it to the hashmaps
+ // For the attribute with name, it is going to be lower-hyphen
+ // If the attribute is javaAttribute then it will be lower camel case
+ NodeList list = doc.getElementsByTagName("xml-root-element");
+ addCaseFormatForNodesAndProperties(list, "name");
+
+ list = doc.getElementsByTagName("xml-element");
+ addCaseFormatForNodesAndProperties(list, "java-attribute");
+
+ list = doc.getElementsByTagName("xml-any-element");
+ addCaseFormatForNodesAndProperties(list, "java-attribute");
+ }
+
+ private void addCaseFormatForNodesAndProperties(NodeList list, String attributeName) {
+ for (int i = 0; i < list.getLength(); i++) {
+
+ String lowerCamel = null;
+ String lowerHyphen = null;
+
+ if ("java-attribute".equals(attributeName)) {
+ lowerCamel = list.item(i).getAttributes().getNamedItem(attributeName).getNodeValue();
+ lowerHyphen = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, lowerCamel);
+ } else {
+ lowerHyphen = list.item(i).getAttributes().getNamedItem(attributeName).getNodeValue();
+ lowerCamel = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, lowerHyphen);
+ }
+
+ String upperCamel = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, lowerHyphen);
+ lowerHyphenToLowerCamel.put(lowerHyphen, lowerCamel);
+ lowerHyphenToUpperCamel.put(lowerHyphen, upperCamel);
+ upperCamelToLowerHyphen.put(upperCamel, lowerHyphen);
+ lowerCamelToLowerHyphen.put(lowerCamel, lowerHyphen);
+ }
+ }
+
+ public Optional<String> fromLowerHyphenToLowerCamel(String value){
+ return Optional.ofNullable(lowerHyphenToLowerCamel.get(value));
+ }
+
+ public Optional<String> fromLowerHyphenToUpperCamel(String value){
+ return Optional.ofNullable(lowerHyphenToUpperCamel.get(value));
+ }
+
+ public Optional<String> fromUpperCamelToLowerHyphen(String value){
+ return Optional.ofNullable(upperCamelToLowerHyphen.get(value));
+ }
+
+ public Optional<String> fromLowerCamelToLowerHyphen(String value){
+ return Optional.ofNullable(lowerCamelToLowerHyphen.get(value));
+ }
+
+}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
index 69cd51ab..2428a6dd 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
@@ -62,26 +62,25 @@ public class NodeIngestor {
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(NodeIngestor.class);
private static final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\.");
- Map<SchemaVersion, List<String>> filesToIngest;
- private Map<SchemaVersion, DynamicJAXBContext> versionContextMap = new TreeMap<>();
- private Map<SchemaVersion, Set<String>> typesPerVersion = new TreeMap<>();
- private Map<SchemaVersion, Document> schemaPerVersion = new TreeMap<>();
+ private Map<SchemaVersion, DynamicJAXBContext> versionContextMap = new HashMap<>();
+ private Map<SchemaVersion, Set<String>> typesPerVersion = new HashMap<>();
+ private Map<SchemaVersion, Document> schemaPerVersion = new HashMap<>();
private String localSchema;
private SchemaVersions schemaVersions;
private Set<Translator> translators;
-
+
+ private CaseFormatStore caseFormatStore;
//TODO : See if you can get rid of InputStream resets
- /**
+
+ /**
* Instantiates the NodeIngestor bean.
- *
- * @param - ConfigTranslator autowired in by Spring framework which
- * contains the configuration information needed to ingest the desired files.
+ * @param translatorSet
*/
@Autowired
public NodeIngestor(Set<Translator> translatorSet) {
- LOGGER.debug("Local Schema files will be fetched");
this.translators = translatorSet;
+ this.caseFormatStore = new CaseFormatStore();
}
@PostConstruct
@@ -93,8 +92,8 @@ public class NodeIngestor {
translateAll(translator);
} catch (Exception e) {
- LOGGER.info("Error while Processing the translator" + e.getMessage());
- continue;
+ LOGGER.error("Error while Processing the translator" + e.getMessage());
+ throw new ExceptionInInitializerError("NodeIngestor could not ingest schema");
}
}
if (versionContextMap.isEmpty() || schemaPerVersion.isEmpty() || typesPerVersion.isEmpty()) {
@@ -128,7 +127,7 @@ public class NodeIngestor {
final DynamicJAXBContext ctx = ingest(inputStreams);
versionContextMap.put(version, ctx);
- typesPerVersion.put(version, getAllNodeTypes(inputStreams));
+ setAllTypesAndProperties(version, inputStreams);
schemaPerVersion.put(version, createCombinedSchema(inputStreams, version, retrieveLocalSchema));
}
} catch (JAXBException | ParserConfigurationException | SAXException | IOException e) {
@@ -152,8 +151,7 @@ public class NodeIngestor {
return DynamicJAXBContextFactory.createContextFromOXM(this.getClass().getClassLoader(), properties);
}
- private Set<String> getAllNodeTypes(List<InputStream> inputStreams) throws ParserConfigurationException, SAXException, IOException {
- //Reset the InputStream to reset the offset to inital position
+ private void setAllTypesAndProperties(SchemaVersion version, List<InputStream> inputStreams) throws ParserConfigurationException, IOException, SAXException {
Set<String> types = new HashSet<>();
final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
@@ -164,15 +162,20 @@ public class NodeIngestor {
inputStream.reset();
final Document doc = docBuilder.parse(inputStream);
final NodeList list = doc.getElementsByTagName("java-type");
-
- for (int i = 0; i < list.getLength(); i++) {
- String type = list.item(i).getAttributes().getNamedItem("name").getNodeValue();
- types.add(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, type));
- }
+ getAllNodeTypes(list, types);
+ caseFormatStore.parse(doc);
}
- LOGGER.debug("Types size" + types.size());
- return types;
+ LOGGER.debug("Types size {}", types.size());
+ typesPerVersion.put(version, types);
+ }
+
+ private void getAllNodeTypes(NodeList list, Set<String> types){
+
+ for (int i = 0; i < list.getLength(); i++) {
+ String type = list.item(i).getAttributes().getNamedItem("name").getNodeValue();
+ types.add(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, type));
+ }
}
private Document createCombinedSchema(List<InputStream> inputStreams, SchemaVersion version, boolean localSchema) throws ParserConfigurationException, SAXException, IOException {
@@ -274,4 +277,8 @@ public class NodeIngestor {
"</xml-bindings>";
return new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8));
}
+
+ public CaseFormatStore getCaseFormatStore(){
+ return caseFormatStore;
+ }
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java
index 07f522b4..83687a76 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java
@@ -68,8 +68,4 @@ public class SchemaServiceNoAuthClient extends NoAuthRestClient{
return httpHeaders;
}
- @Override
- public EELFLogger getLogger() {
- return logger;
- }
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java
index 3aa3b1da..a3e4de54 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java
@@ -80,8 +80,4 @@ public class SchemaServiceOneWayClient extends OneWaySSLRestClient{
return httpHeaders;
}
- @Override
- public EELFLogger getLogger() {
- return logger;
- }
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java
index db1a50b5..300c5d83 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java
@@ -95,8 +95,4 @@ public class SchemaServiceRestClient extends TwoWaySSLRestClient {
return httpHeaders;
}
- @Override
- public EELFLogger getLogger() {
- return logger;
- }
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java
index 899a520d..4454ad27 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java
@@ -37,7 +37,7 @@ public class AAIConfigTranslator extends ConfigTranslator {
private static final String FILESEP = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
- public AAIConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public AAIConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
index 4e6a6bdf..3ef76d75 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
@@ -25,7 +25,6 @@ import com.att.eelf.configuration.EELFManager;
import org.apache.commons.io.IOUtils;
import org.onap.aai.edges.JsonIngestor;
import org.springframework.beans.factory.annotation.Autowired;
-
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -45,7 +44,7 @@ public abstract class ConfigTranslator extends Translator{
@Autowired
- public ConfigTranslator(SchemaLocationsBean schemaLocationbean, SchemaVersions schemaVersions) {
+ public ConfigTranslator(SchemaLocationsBean schemaLocationbean, SchemaConfigVersions schemaVersions) {
super(schemaVersions);
this.bean = schemaLocationbean;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaConfigVersions.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaConfigVersions.java
new file mode 100644
index 00000000..e23fea26
--- /dev/null
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaConfigVersions.java
@@ -0,0 +1,92 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-18 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=========================================================
+ */
+package org.onap.aai.setup;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component("schemaConfigVersions")
+@ConditionalOnExpression("'${schema.translator.list:config}'.contains('config') || '${schema.service.versions.override:false}'.equals('true')")
+@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
+@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
+public class SchemaConfigVersions extends SchemaVersions {
+
+ @Value("#{'${schema.version.list:''}'.split(',')}")
+ private List<String> apiVersions;
+ @Value("${schema.version.api.default}")
+ private String defaultApiVersion;
+ @Value("${schema.version.edge.label.start:''}")
+ private String edgeLabelStartVersion;
+ @Value("${schema.version.depth.start:''}")
+ private String depthStartVersion;
+ @Value("${schema.version.app.root.start:''}")
+ private String appRootStartVersion;
+ @Value("${schema.version.related.link.start:''}")
+ private String relatedLinkStartVersion;
+ @Value("${schema.version.namespace.change.start:''}")
+ protected String namespaceChangeStartVersion;
+
+ public List<String> getApiVersions() {
+ return apiVersions;
+ }
+
+ public String getDefaultApiVersion() {
+ return defaultApiVersion;
+ }
+
+ public String getEdgeLabelStartVersion() {
+ return edgeLabelStartVersion;
+ }
+
+ public String getDepthStartVersion() {
+ return depthStartVersion;
+ }
+
+ public String getAppRootStartVersion() {
+ return appRootStartVersion;
+ }
+
+ public String getRelatedLinkStartVersion() {
+ return relatedLinkStartVersion;
+ }
+
+ public String getNamespaceChangeStartVersion() {
+ return namespaceChangeStartVersion;
+ }
+
+ @PostConstruct
+ public void initialize() {
+ versionsValue = apiVersions.stream().map(SchemaVersion::new).collect(Collectors.toList());
+ edgeLabelVersionValue = new SchemaVersion(edgeLabelStartVersion);
+ defaultVersionValue = new SchemaVersion(defaultApiVersion);
+ depthVersionValue = new SchemaVersion(depthStartVersion);
+ appRootVersionValue = new SchemaVersion(appRootStartVersion);
+ relatedLinkVersionValue = new SchemaVersion(relatedLinkStartVersion);
+ namespaceChangeVersionValue = new SchemaVersion(namespaceChangeStartVersion);
+ this.validate();
+ }
+
+}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java
index 21082fa1..2d2411fb 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -77,12 +78,13 @@ public class SchemaServiceTranslator extends Translator {
RestClient restClient = restClientFactory.getRestClient(SchemaServiceClientType);
ResponseEntity<Resource> schemaResponse = restClient.getGetResource(content, uri,
headersMap);
- LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode());
+ verifySchemaServiceResponse(schemaResponse.getStatusCode());
+ LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode());
inputStreams.add(schemaResponse.getBody().getInputStream());
return inputStreams;
}
- @Override
+ @Override
public List<String> getJsonPayload(SchemaVersion version) throws IOException {
/*
* Call Schema MS to get versions using RestTemplate
@@ -96,10 +98,18 @@ public class SchemaServiceTranslator extends Translator {
ResponseEntity<String> schemaResponse = restClient.getGetRequest(content, uri,
headersMap);
- LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode());
+ verifySchemaServiceResponse(schemaResponse.getStatusCode());
+ LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode());
inputStreams.add(schemaResponse.getBody());
return inputStreams;
}
+ private void verifySchemaServiceResponse(HttpStatus statusCode) throws IOException {
+ if (statusCode != HttpStatus.OK) {
+ LOGGER.error("Please check the Schema Service. It returned with the status code {}", statusCode);
+ throw new IOException("SchemaService is not available");
+ }
+ }
+
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceVersions.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceVersions.java
index 6594f232..5518ccb2 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceVersions.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceVersions.java
@@ -19,10 +19,17 @@
*/
package org.onap.aai.setup;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.stream.Collectors;
+@Component("schemaServiceVersions")
+@ConditionalOnExpression("'${schema.translator.list}'.contains('schema-service')")
+@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
+@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
public class SchemaServiceVersions extends SchemaVersions {
private List<String> versions;
private String edgeVersion;
@@ -32,9 +39,17 @@ public class SchemaServiceVersions extends SchemaVersions {
private String relatedLinkVersion;
private String namespaceChangeVersion;
+ public List<String> getVersionsAll() {
+ return versions;
+ }
+
+ public void setVersions(List<String> versions) {
+ this.versions = versions;
+ }
@PostConstruct
- public void initializeFromSchemaService() {
+ public void initializeFromSchemaService() throws ExceptionInInitializerError{
+
versionsValue = versions.stream().map(SchemaVersion::new).collect(Collectors.toList());
edgeLabelVersionValue = new SchemaVersion(edgeVersion);
defaultVersionValue = new SchemaVersion(defaultVersion);
@@ -42,7 +57,23 @@ public class SchemaServiceVersions extends SchemaVersions {
appRootVersionValue = new SchemaVersion(appRootVersion);
relatedLinkVersionValue = new SchemaVersion(relatedLinkVersion);
namespaceChangeVersionValue = new SchemaVersion(namespaceChangeVersion);
+
this.validate();
}
+ /*
+ * TODO Change Method names
+ */
+ public void initializeFromSchemaConfig(SchemaConfigVersions schemaConfigVersion) throws ExceptionInInitializerError{
+
+ versions = schemaConfigVersion.getApiVersions();
+ appRootVersion = schemaConfigVersion.getAppRootStartVersion();
+ defaultVersion = schemaConfigVersion.getDefaultApiVersion();
+ depthVersion = schemaConfigVersion.getDepthStartVersion();
+ edgeVersion = schemaConfigVersion.getEdgeLabelStartVersion();
+ namespaceChangeVersion = schemaConfigVersion.getNamespaceChangeStartVersion();
+ relatedLinkVersion = schemaConfigVersion.getRelatedLinkStartVersion();
+ this.initializeFromSchemaService();
+ }
+
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersion.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersion.java
index a1a40e69..8143b5e1 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersion.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersion.java
@@ -21,20 +21,23 @@ package org.onap.aai.setup;
import org.onap.aai.validation.AAISchemaValidationException;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SchemaVersion implements Comparable<SchemaVersion> {
- public static final Pattern VERSION_PATTERN = Pattern.compile("v[1-9][0-9]*");
+ public static final Pattern VERSION_PATTERN = Pattern.compile("v([1-9][0-9]*)");
- private final String value;
+ private final Integer value;
public SchemaVersion(String value){
- if(!VERSION_PATTERN.matcher(value).matches()){
+ Matcher matcher = VERSION_PATTERN.matcher(value);
+
+ if(!matcher.find()){
throw new AAISchemaValidationException("Invalid Schema Version " + value + ", value doesn't match the expected regex: " + VERSION_PATTERN);
+ } else {
+ this.value = Integer.parseInt(matcher.group(1));
}
-
- this.value = value;
}
@Override
@@ -44,6 +47,7 @@ public class SchemaVersion implements Comparable<SchemaVersion> {
@Override
public boolean equals(Object other){
+
if(this == other){
return true;
}
@@ -62,7 +66,7 @@ public class SchemaVersion implements Comparable<SchemaVersion> {
@Override
public String toString(){
- return value;
+ return String.valueOf("v" + value);
}
@Override
@@ -72,12 +76,6 @@ public class SchemaVersion implements Comparable<SchemaVersion> {
return -1;
}
- // Requires to convert to integer to match the past behavior
- // Otherwise the string comparison of versions aren't working as expected
-
- Integer tVal = Integer.parseInt(this.value.replaceAll("v", ""));
- Integer oVal = Integer.parseInt(o.value.replaceAll("v", ""));
-
- return tVal.compareTo(oVal);
+ return this.value.compareTo(o.value);
}
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java
index 028ebdeb..e7f599c6 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java
@@ -28,26 +28,11 @@ import javax.annotation.PostConstruct;
import java.util.List;
import java.util.stream.Collectors;
-@Component
+
@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
public class SchemaVersions {
- @Value("#{'${schema.version.list}'.split(',')}")
- private List<String> apiVersions;
- @Value("${schema.version.api.default}")
- private String defaultApiVersion;
- @Value("${schema.version.edge.label.start}")
- private String edgeLabelStartVersion;
- @Value("${schema.version.depth.start}")
- private String depthStartVersion;
- @Value("${schema.version.app.root.start}")
- private String appRootStartVersion;
- @Value("${schema.version.related.link.start}")
- private String relatedLinkStartVersion;
- @Value("${schema.version.namespace.change.start}")
-
- protected String namespaceChangeStartVersion;
protected List<SchemaVersion> versionsValue;
protected SchemaVersion edgeLabelVersionValue;
protected SchemaVersion defaultVersionValue;
@@ -56,19 +41,6 @@ public class SchemaVersions {
protected SchemaVersion relatedLinkVersionValue;
protected SchemaVersion namespaceChangeVersionValue;
- @PostConstruct
- public void initialize() {
- versionsValue = apiVersions.stream().map(SchemaVersion::new).collect(Collectors.toList());
- edgeLabelVersionValue = new SchemaVersion(edgeLabelStartVersion);
- defaultVersionValue = new SchemaVersion(defaultApiVersion);
- depthVersionValue = new SchemaVersion(depthStartVersion);
- appRootVersionValue = new SchemaVersion(appRootStartVersion);
- relatedLinkVersionValue = new SchemaVersion(relatedLinkStartVersion);
- namespaceChangeVersionValue = new SchemaVersion(namespaceChangeStartVersion);
- this.validate();
- }
-
-
protected void validate() {
String errorMessage = "Invalid, edge label version is not in the api versions list"
+ ", please check schema.version.list and ensure that the"
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java
index 119669d3..dde7cad6 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java
@@ -27,7 +27,6 @@ import org.onap.aai.restclient.RestClientFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
-
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
@@ -41,16 +40,22 @@ public class SchemaVersionsBean {
@Value("${schema.service.versions.endpoint}")
private String versionsUri;
+ @Value("${schema.service.versions.override:false}")
+ private String overrideSchemaService;
+
@Autowired
private RestClientFactory restClientFactory;
+ @Autowired(required = false)
+ private SchemaConfigVersions schemaConfigVersions;
+
@PostConstruct
public void initialize() {
//Call SchemaService to get versions
retrieveAllSchemaVersions();
}
- public void retrieveAllSchemaVersions() {
+ public void retrieveAllSchemaVersions() throws ExceptionInInitializerError{
/*
Call Schema MS to get versions using RestTemplate
*/
@@ -64,8 +69,28 @@ public class SchemaVersionsBean {
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
.create();
schemaVersions = gson.fromJson(schemaResponse.getBody(), SchemaServiceVersions.class);
- schemaVersions.initializeFromSchemaService();
+ if(!validateOverrides(schemaVersions)){
+ throw new ExceptionInInitializerError("The versions requested is not supported by SchemaService");
+ }
+ if("true".equals(overrideSchemaService)){
+ schemaVersions.initializeFromSchemaConfig(schemaConfigVersions);
+ }
+ else{
+ schemaVersions.initializeFromSchemaService();
+ }
+
+ }
+
+ public boolean validateOverrides(SchemaServiceVersions schemaVersions1){
+ boolean versionsAvailable = true;
+ if("true".equals(overrideSchemaService)){
+ versionsAvailable = schemaConfigVersions.getApiVersions().stream().
+ allMatch(
+ (s) -> schemaVersions1.getVersionsAll().contains(s)
+ );
+ }
+ return versionsAvailable;
}
public SchemaServiceVersions getSchemaVersions() {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
index 565c99c8..aca50416 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, ConfigTranslatorForWiringTest.class})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, ConfigTranslatorForWiringTest.class})
@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local.properties"})
@SpringBootTest
public class ConfigTranslatorWiringTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
new file mode 100644
index 00000000..72409bc7
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
@@ -0,0 +1,80 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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=========================================================
+ */
+package org.onap.aai.setup;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.onap.aai.restclient.MockProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties" })
+@ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class, SchemaConfigVersions.class})
+@SpringBootTest
+public class SchemaVersionsBeanOverrideTest {
+
+ //set thrown.expect to whatever a specific test needs
+ //this establishes a default of expecting no exceptions to be thrown
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+ @Autowired
+ SchemaVersionsBean SchemaVersionsBean;
+
+ @Test
+ public void testGetContextForVersion() throws IOException {
+
+ SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
+ assertEquals(versions.getDefaultVersion(), new SchemaVersion("v15"));
+ }
+
+ @Test
+ public void testGetVersions() throws IOException {
+
+ List<SchemaVersion> versions = SchemaVersionsBean.getVersions();
+ assertNotNull(versions);
+ }
+
+ @Test
+ public void testGetters() throws IOException {
+ List<SchemaVersion> versionsList = SchemaVersionsBean.getVersions();
+ assertNotNull(versionsList);
+ SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
+
+ assertEquals(versions.getAppRootVersion(), new SchemaVersion("v11"));
+ assertEquals(versions.getDepthVersion(), new SchemaVersion("v10"));
+ assertEquals(versions.getEdgeLabelVersion(), new SchemaVersion("v12"));
+ assertEquals(versions.getNamespaceChangeVersion(), new SchemaVersion("v11"));
+ assertEquals(versions.getRelatedLinkVersion(), new SchemaVersion("v10"));
+
+ }
+
+}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java
index fa57f976..dd1c0b7c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java
@@ -23,8 +23,7 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.*;
/**
@@ -34,7 +33,7 @@ public class BadEdgeConfigForValidationTest extends ConfigTranslator {
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- public BadEdgeConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public BadEdgeConfigForValidationTest(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java
index 829638fe..90afdcce 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java
@@ -23,8 +23,7 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -37,7 +36,7 @@ public class BadNodeConfigForValidationTest extends ConfigTranslator {
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- public BadNodeConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public BadNodeConfigForValidationTest(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java
index 06e07f9a..e8d10e8c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java
@@ -23,8 +23,7 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,7 @@ import java.util.TreeMap;
public class ConfigTranslatorForWiringTest extends ConfigTranslator {
- public ConfigTranslatorForWiringTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public ConfigTranslatorForWiringTest(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java
index 41f35371..631ce91f 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java
@@ -23,8 +23,8 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaVersions;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -37,7 +37,7 @@ public class GoodConfigForValidationTest extends ConfigTranslator {
private SchemaVersions schemaVersions;
- public GoodConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public GoodConfigForValidationTest(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
this.schemaVersions = schemaVersions;
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java
index 23549e3f..ba3e4ac0 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java
@@ -23,8 +23,7 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,7 @@ import java.util.TreeMap;
public class SchemaIncompleteTranslator extends ConfigTranslator {
- public SchemaIncompleteTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public SchemaIncompleteTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java
index 3704b7cd..8988a1ca 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java
@@ -23,9 +23,8 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.setup.SchemaConfigVersions;
import org.springframework.context.annotation.PropertySource;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -36,7 +35,7 @@ import java.util.TreeMap;
public class TestUtilConfigTranslator extends ConfigTranslator {
public static final SchemaVersion LATEST = new SchemaVersion("v15");
- public TestUtilConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public TestUtilConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
index 2e515ec1..28b0e2da 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
@@ -23,8 +23,7 @@ package org.onap.aai.testutils;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
-
+import org.onap.aai.setup.SchemaConfigVersions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,7 @@ import java.util.TreeMap;
public class TestUtilConfigTranslatorforBusiness extends ConfigTranslator {
- public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
super(bean, schemaVersions);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
index c6fe190d..6ab84d40 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
@@ -20,6 +20,7 @@
package org.onap.aai.validation.nodes;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -30,8 +31,10 @@ import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.SchemaIncompleteTranslator;
+import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -54,6 +57,7 @@ import javax.xml.transform.stream.StreamResult;
@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local.properties" })
@SpringBootTest
+@Ignore
public class NodeValidatorSchemaIncompleteTest {
@Autowired
NodeIngestor ni;
@@ -61,12 +65,12 @@ public class NodeValidatorSchemaIncompleteTest {
//set thrown.expect to whatever a specific test needs
//this establishes a default of expecting no exceptions to be thrown
@Rule
- public ExpectedException thrown = ExpectedException.none();
+ public ExpectedException thrown = ExpectedException.none();
//Throws a NullPointerException because a JavaType is referenced, but not defined
@Test
public void testIncompleteCombinedSchema() throws TransformerException, IOException, IllegalStateException {
- //thrown.expect(NullPointerException.class);
+ thrown.expect(NullPointerException.class);
//TODO Change for Exception
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
diff --git a/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties
new file mode 100644
index 00000000..1ec59405
--- /dev/null
+++ b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties
@@ -0,0 +1,21 @@
+schema.configuration.location=NA
+server.local.startpath=src/main/resources/
+schema.service.base.url=https://localhost:8452/aai/schema-service/v1/
+schema.service.nodes.endpoint=nodes?version=
+schema.service.edges.endpoint=edgerules?version=
+schema.service.versions.endpoint=versions
+#Remove the below once we remove dependencies on schema-version value
+schema.version.list=v8,v9,v10,v11,v12,v13,v14,v15
+schema.version.depth.start=v10
+schema.version.related.link.start=v10
+schema.version.app.root.start=v11
+schema.version.namespace.change.start=v11
+schema.version.edge.label.start=v12
+schema.version.api.default=v15
+schema.local=true
+mock.filename=mockrequests
+spring.application.name=aai
+schema.translator.list=schema-service
+schema.service.client=mock-no-auth
+schema.translators.needed=nodes,edges
+schema.service.versions.override=true
diff --git a/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties
index d27198da..bb5801ab 100644
--- a/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties
+++ b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties
@@ -17,4 +17,5 @@ mock.filename=mockrequests
spring.application.name=aai
schema.translator.list=schema-service
schema.service.client=mock-no-auth
-
+schema.translators.needed=nodes,edges
+#schema.service.versions.override=false
diff --git a/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-wiring-test.properties b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-wiring-test.properties
index f372d06d..9b417044 100644
--- a/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-wiring-test.properties
+++ b/aai-schema-ingest/src/test/resources/forWiringTests/schema-ingest-wiring-test.properties
@@ -18,3 +18,4 @@ mock.filename=edgerequests
spring.application.name=aai
schema.translator.list=schema-service
schema.service.client=mock-no-auth
+schema.translators.needed=edges
diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml
index 8e1b4ca2..8154eb73 100644
--- a/aai-utils/pom.xml
+++ b/aai-utils/pom.xml
@@ -29,11 +29,11 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</parent>
<artifactId>aai-utils</artifactId>
<name>aai-utils</name>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<properties>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 5153d083..b91bbbab 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -6,6 +6,16 @@
AAI Release Notes
==================
+Version: 1.3.2
+--------------
+
+:Release Date: 2019-03-31
+
+**Updates**
+
+AAI demo certificates were going to expire before Dublin release, so they've been refreshed to last until 2020.
+
+- `AAI-2282 <https://jira.onap.org/browse/AAI-2282>`_ Update certifcate for Casablanca 3.0.2
Version: 1.3.1
--------------
diff --git a/onap-java-formatter.xml b/onap-java-formatter.xml
index 920d37b0..368ede19 100644
--- a/onap-java-formatter.xml
+++ b/onap-java-formatter.xml
@@ -58,7 +58,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
@@ -67,7 +67,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
@@ -278,7 +278,7 @@
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
diff --git a/pom.xml b/pom.xml
index 77a55278..dd7ac6bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-common</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>aai-aai-common</name>
<description>Contains all of the common code for resources and traversal repos</description>
diff --git a/version.properties b/version.properties
index e653a662..695ab2b2 100644
--- a/version.properties
+++ b/version.properties
@@ -5,7 +5,7 @@
major_version=1
minor_version=4
-patch_version=1
+patch_version=2
base_version=${major_version}.${minor_version}.${patch_version}