summaryrefslogtreecommitdiffstats
path: root/aai-core
diff options
context:
space:
mode:
Diffstat (limited to 'aai-core')
-rw-r--r--aai-core/pom.xml19
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java12
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java46
-rw-r--r--aai-core/src/test/java/org/onap/aai/AAISetup.java47
-rw-r--r--aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java4
-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/DbSerializer_needsFakeRulesTest.java4
7 files changed, 97 insertions, 38 deletions
diff --git a/aai-core/pom.xml b/aai-core/pom.xml
index c3eb5f20..fbf6ff4c 100644
--- a/aai-core/pom.xml
+++ b/aai-core/pom.xml
@@ -66,6 +66,7 @@
<schema.version.edge.label.start>v12</schema.version.edge.label.start>
<schema.version.api.default>v15</schema.version.api.default>
<schema.version.list>v8,v9,v10,v11,v12,v13,v14,v15</schema.version.list>
+ <schema.translator.list>config</schema.translator.list>
<!-- End of Default ONAP Schema Properties -->
</properties>
<profiles>
@@ -170,6 +171,10 @@
<value>${schema.uri.base.path}</value>
</systemProperty>
<systemProperty>
+ <key>schema.translator.list</key>
+ <value>${schema.translator.list}</value>
+ </systemProperty>
+ <systemProperty>
<key>aai.release</key>
<value>${aai.release}</value>
</systemProperty>
@@ -264,6 +269,10 @@
<value>${schema.uri.base.path}</value>
</systemProperty>
<systemProperty>
+ <key>schema.translator.list</key>
+ <value>${schema.translator.list}</value>
+ </systemProperty>
+ <systemProperty>
<key>aai.release</key>
<value>${aai.release}</value>
</systemProperty>
@@ -349,6 +358,10 @@
<value>${schema.uri.base.path}</value>
</systemProperty>
<systemProperty>
+ <key>schema.translator.list</key>
+ <value>${schema.translator.list}</value>
+ </systemProperty>
+ <systemProperty>
<key>aai.release</key>
<value>${aai.release}</value>
</systemProperty>
@@ -449,6 +462,10 @@
<value>${schema.uri.base.path}</value>
</systemProperty>
<systemProperty>
+ <key>schema.translator.list</key>
+ <value>${schema.translator.list}</value>
+ </systemProperty>
+ <systemProperty>
<key>aai.release</key>
<value>${aai.release}</value>
</systemProperty>
@@ -699,7 +716,7 @@
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema-ingest</artifactId>
- <version>1.4.0</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
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 e737f08d..ab74d798 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
@@ -21,7 +21,6 @@
*/
package org.onap.aai.config;
-import org.onap.aai.schema.enums.ObjectMetadata;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,18 +29,19 @@ import org.springframework.context.annotation.Configuration;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.MoxyLoader;
-import org.onap.aai.nodes.NodeIngestor;
-
+import org.springframework.context.annotation.Import;
+@Import({NodesConfiguration.class, EdgesConfiguration.class})
@Configuration
+
public class IntrospectionConfig {
private Map<SchemaVersion, MoxyLoader> moxyInstanceMap = new ConcurrentHashMap<>();
+
@Autowired
- NodeIngestor nodeIngestor;
+ NodesConfiguration nodesConfiguration;
@Bean
public LoaderFactory loaderFactory(SchemaVersions schemaVersions) {
@@ -52,7 +52,7 @@ public class IntrospectionConfig {
public Map<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) {
for(SchemaVersion version : schemaVersions.getVersions()){
if (!moxyInstanceMap.containsKey(version)) {
- moxyInstanceMap.put(version, new MoxyLoader(version, nodeIngestor));
+ moxyInstanceMap.put(version, new MoxyLoader(version, nodesConfiguration.nodeIngestor()));
}
}
return moxyInstanceMap;
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 b00ecfb7..88de78e7 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
@@ -30,33 +30,65 @@ import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.SchemaErrorStrategy;
+import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
+import org.onap.aai.validation.nodes.DuplicateNodeDefinitionValidationModule;
+import org.onap.aai.validation.nodes.NodeValidator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.*;
-
+@Import({NodesConfiguration.class, EdgesConfiguration.class})
@Configuration
+@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
+@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
public class SchemaConfiguration {
+ @Autowired(required = false)
+ NodesConfiguration nodesConfiguration;
+
+ @Autowired(required = false)
+ EdgesConfiguration edgesConfiguration;
+
@Bean
- public EdgeIngestor edgeIngestor(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions){
- return new EdgeIngestor(configTranslator(schemaLocationsBean, schemaVersions), schemaVersions);
+ public EdgeIngestor edgeIngestor(){
+ return edgesConfiguration.edgeIngestor();
}
@Bean
public EdgeSerializer edgeSerializer(EdgeIngestor edgeIngestor){
return new EdgeSerializer(edgeIngestor);
}
-
+
@Bean(name = "nodeIngestor")
- public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) {
- return new NodeIngestor(configTranslator);
+ public NodeIngestor nodeIngestor() {
+ return nodesConfiguration.nodeIngestor();
}
+
@Bean(name = "configTranslator")
+ @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) {
return new AAIConfigTranslator(schemaLocationsBean, schemaVersions);
}
@Bean
+ @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
public SchemaErrorStrategy schemaErrorStrategy(){
return new CheckEverythingStrategy();
- }
+ }
+
+ @Bean
+ @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
+ public DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule(){
+ return new DefaultDuplicateNodeDefinitionValidationModule();
+ }
+
+ @Bean
+ @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
+ public NodeValidator nodeValidator(
+ ConfigTranslator configTranslator,
+ SchemaErrorStrategy schemaErrorStrategy,
+ DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule
+ ){
+ return new NodeValidator(configTranslator, schemaErrorStrategy, duplicateNodeDefinitionValidationModule);
+ }
}
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 b7a4f740..ce8dfe20 100644
--- a/aai-core/src/test/java/org/onap/aai/AAISetup.java
+++ b/aai-core/src/test/java/org/onap/aai/AAISetup.java
@@ -59,7 +59,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
IntrospectionConfig.class,
RestBeanConfig.class
})
-@TestPropertySource(properties = { "schema.uri.base.path = /aai" })
+@TestPropertySource(properties = { "schema.uri.base.path = /aai", "schema.xsd.maxoccurs = 5000" , "schema.translator.list=config"})
public abstract class AAISetup {
@ClassRule
@@ -69,26 +69,29 @@ public abstract class AAISetup {
public final SpringMethodRule springMethodRule = new SpringMethodRule();
@Autowired
- protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
-
- @Autowired
- protected HttpEntry traversalHttpEntry;
-
- @Autowired
- protected HttpEntry traversalUriHttpEntry;
-
- @Autowired
- protected NodeIngestor nodeIngestor;
-
- @Autowired
- protected LoaderFactory loaderFactory;
+ protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
+
+ @Autowired
+ protected HttpEntry traversalHttpEntry;
+
+ @Autowired
+ protected HttpEntry traversalUriHttpEntry;
+
+ @Autowired
+ protected NodeIngestor nodeIngestor;
+
+ @Autowired
+ protected LoaderFactory loaderFactory;
- @Autowired
- protected SchemaVersions schemaVersions;
+ @Autowired
+ protected SchemaVersions schemaVersions;
+
+ @Value("${schema.uri.base.path}")
+ protected String basePath;
- @Value("${schema.uri.base.path}")
- protected String basePath;
-
+ @Value("${schema.xsd.maxoccurs}")
+ protected String maxOccurs;
+
protected static final String SERVICE_NAME = "JUNIT";
@BeforeClass
@@ -98,7 +101,7 @@ public abstract class AAISetup {
System.setProperty("aai.service.name", SERVICE_NAME);
QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/bundleconfig-local/etc/oxm/");
}
-
-
-
+
+
+
}
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 95d0725e..ffb56057 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
@@ -47,6 +47,7 @@ import org.onap.aai.util.AAIConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.onap.aai.db.props.AAIProperties;
@@ -72,6 +73,9 @@ import static org.junit.Assert.*;
IntrospectionConfig.class
})
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
+@TestPropertySource(properties = {
+ "schema.translator.list = config"
+})
public abstract class QueryBuilderTestAbstraction {
protected Loader loader;
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 90fb90ac..5cadb895 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
@@ -47,8 +47,7 @@ public class QueryTestsConfigTranslator extends AbstractConfigTranslator {
Map<SchemaVersion, List<String>> files = new TreeMap<>();
List<String> container = new ArrayList<>();
container.add(file);
- files.put(schemaVersions.getDefaultVersion(), container);
-
+ files.put(schemaVersions.getDefaultVersion(), container);
return files;
}
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 b9d65c5f..1226eda1 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
@@ -44,6 +44,7 @@ import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
import org.onap.aai.setup.SchemaLocationsBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.UnsupportedEncodingException;
@@ -67,6 +68,9 @@ import static org.mockito.Mockito.when;
SpringContextAware.class,
IntrospectionConfig.class
})
+@TestPropertySource(properties = {
+ "schema.translator.list = config"
+})
public class DbSerializer_needsFakeRulesTest {
//to use, set thrown.expect to whatever your test needs