summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorrv871f <richard.vondadelszen@amdocs.com>2018-09-21 13:42:04 -0400
committerrv871f <richard.vondadelszen@amdocs.com>2018-09-21 15:07:02 -0400
commit595db0f0c860c722aa79e94b464fc10c30a86dd3 (patch)
tree925b500f92331cf05cb90498e4169c12bf7fcc1a /src/test
parent7507624e55109e81185be1acdd8f912e9abfbfcc (diff)
1.3.0 schema ingest changes
Issue-ID: AAI-1670 Change-Id: I402e56f0371f60641190e182bff4c3b954ad8987 Signed-off-by: rv871f <richard.vondadelszen@amdocs.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/aai/schema/OxmModelLoaderTest.java26
-rw-r--r--src/test/resources/config/schemaIngest.properties16
-rw-r--r--src/test/resources/oxm-reader/multiple-oxm/v11/aai_oxm_v11.xml (renamed from src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml)0
-rw-r--r--src/test/resources/oxm-reader/multiple-oxm/v12/aai_oxm_v12.xml (renamed from src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml)0
-rw-r--r--src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_a_v13.xml (renamed from src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml)0
-rw-r--r--src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_b_v13.xml (renamed from src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v10/aai_oxm_v10.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v11/aai_oxm_v11.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v12/aai_oxm_v12.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v13/aai_oxm_v13.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v8/aai_oxm_v8.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml)0
-rw-r--r--src/test/resources/oxm-reader/oxm/v9/aai_oxm_v9.xml (renamed from src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml)0
-rw-r--r--src/test/resources/spring-beans/data-router-oxm.xml14
13 files changed, 51 insertions, 5 deletions
diff --git a/src/test/java/org/onap/aai/schema/OxmModelLoaderTest.java b/src/test/java/org/onap/aai/schema/OxmModelLoaderTest.java
index 060e5ed..f3e9091 100644
--- a/src/test/java/org/onap/aai/schema/OxmModelLoaderTest.java
+++ b/src/test/java/org/onap/aai/schema/OxmModelLoaderTest.java
@@ -20,29 +20,44 @@
*/
package org.onap.aai.schema;
+
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
+
import org.eclipse.persistence.dynamic.DynamicType;
import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.eclipse.persistence.mappings.DatabaseMapping;
import org.junit.Test;
-import org.onap.aai.schema.OxmModelLoader;
+import org.junit.runner.RunWith;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.util.EntityOxmReferenceHelper;
import org.onap.aai.util.ExternalOxmModelProcessor;
-import org.onap.aai.setup.Version;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("file:src/test/resources/spring-beans/data-router-oxm.xml")
public class OxmModelLoaderTest {
+ @Autowired
+ private SchemaVersions schemaVersions;
+ @Autowired
+ private SchemaLocationsBean schemaLocationsBean;
+
@Test
public void testLoadingMultipleOxmFiles() {
+
ArrayList<ExternalOxmModelProcessor> externalOxmModelProcessors = new ArrayList<ExternalOxmModelProcessor>();
externalOxmModelProcessors.add(EntityOxmReferenceHelper.getInstance());
OxmModelLoader.registerExternalOxmModelProcessors(externalOxmModelProcessors);
- OxmModelLoader.loadModels();
+ OxmModelLoader.loadModels(schemaVersions, schemaLocationsBean);
- DynamicJAXBContext jaxbContext = OxmModelLoader.getContextForVersion(Version.getLatest().toString());
+ DynamicJAXBContext jaxbContext = OxmModelLoader.getContextForVersion("v13", schemaVersions, schemaLocationsBean);
DynamicType pserver = jaxbContext.getDynamicType("Pserver");
DynamicType genericVnf = jaxbContext.getDynamicType("GenericVnf");
@@ -63,6 +78,7 @@ public class OxmModelLoaderTest {
String keyName = f.getName().substring(0, f.getName().indexOf("/"));
assertTrue(keyName.equals("vnf-id"));
}
-
+
}
+
}
diff --git a/src/test/resources/config/schemaIngest.properties b/src/test/resources/config/schemaIngest.properties
new file mode 100644
index 0000000..05e5555
--- /dev/null
+++ b/src/test/resources/config/schemaIngest.properties
@@ -0,0 +1,16 @@
+# Properties for the SchemaLocationsBean
+# Properties required by the aai-common - aai-schema-ingest lib as of 1.3.0
+schema.configuration.location=N/A
+schema.nodes.location=src/test/resources/oxm-reader/multiple-oxm/
+schema.edges.location=
+# These versions need to exist if they are included in the list
+schema.version.list=v11,v12,v13
+# Decalares the oxm version to load
+schema.version.api.default=v13
+
+# Don't use these properties in our application, need to be set to prevent an exception on startup (see SchemaVersions bean)
+schema.version.depth.start=v13
+schema.version.related.link.start=v13
+schema.version.app.root.start=v13
+schema.version.namespace.change.start=v13
+schema.version.edge.label.start=v13 \ No newline at end of file
diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml b/src/test/resources/oxm-reader/multiple-oxm/v11/aai_oxm_v11.xml
index 90d023c..90d023c 100644
--- a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml
+++ b/src/test/resources/oxm-reader/multiple-oxm/v11/aai_oxm_v11.xml
diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml b/src/test/resources/oxm-reader/multiple-oxm/v12/aai_oxm_v12.xml
index d9fbcca..d9fbcca 100644
--- a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml
+++ b/src/test/resources/oxm-reader/multiple-oxm/v12/aai_oxm_v12.xml
diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml b/src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_a_v13.xml
index 334d32d..334d32d 100644
--- a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml
+++ b/src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_a_v13.xml
diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml b/src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_b_v13.xml
index 368fcc7..368fcc7 100644
--- a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml
+++ b/src/test/resources/oxm-reader/multiple-oxm/v13/aai_oxm_b_v13.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml b/src/test/resources/oxm-reader/oxm/v10/aai_oxm_v10.xml
index 51eaa34..51eaa34 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml
+++ b/src/test/resources/oxm-reader/oxm/v10/aai_oxm_v10.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml b/src/test/resources/oxm-reader/oxm/v11/aai_oxm_v11.xml
index 90d023c..90d023c 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml
+++ b/src/test/resources/oxm-reader/oxm/v11/aai_oxm_v11.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml b/src/test/resources/oxm-reader/oxm/v12/aai_oxm_v12.xml
index d9fbcca..d9fbcca 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml
+++ b/src/test/resources/oxm-reader/oxm/v12/aai_oxm_v12.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml b/src/test/resources/oxm-reader/oxm/v13/aai_oxm_v13.xml
index 2dfc4f0..2dfc4f0 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml
+++ b/src/test/resources/oxm-reader/oxm/v13/aai_oxm_v13.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml b/src/test/resources/oxm-reader/oxm/v8/aai_oxm_v8.xml
index d666b73..d666b73 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml
+++ b/src/test/resources/oxm-reader/oxm/v8/aai_oxm_v8.xml
diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml b/src/test/resources/oxm-reader/oxm/v9/aai_oxm_v9.xml
index ecffb2f..ecffb2f 100644
--- a/src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml
+++ b/src/test/resources/oxm-reader/oxm/v9/aai_oxm_v9.xml
diff --git a/src/test/resources/spring-beans/data-router-oxm.xml b/src/test/resources/spring-beans/data-router-oxm.xml
new file mode 100644
index 0000000..90e7e97
--- /dev/null
+++ b/src/test/resources/spring-beans/data-router-oxm.xml
@@ -0,0 +1,14 @@
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:task="http://www.springframework.org/schema/task"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
+ http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
+
+ <context:property-placeholder location="file:src/test/resources/config/schemaIngest.properties" ignore-unresolvable="true" />
+
+ <bean id="schemaVersions" class="org.onap.aai.setup.SchemaVersions"/>
+
+ <bean id="schemaLocationsBean" class="org.onap.aai.setup.SchemaLocationsBean"/>
+
+</beans>