summaryrefslogtreecommitdiffstats
path: root/aai-schema-ingest/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'aai-schema-ingest/src/test/java/org/onap')
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java115
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java59
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java33
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java98
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java24
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java6
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java31
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java31
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java29
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java35
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java82
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java50
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java80
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java15
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java18
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java15
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java18
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java19
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java21
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java88
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java9
34 files changed, 685 insertions, 276 deletions
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
index 9f6d67a1..e8c946d9 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.edges;
@@ -36,17 +34,20 @@ import org.onap.aai.edges.enums.MultiplicityRule;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.TestUtilConfigTranslator;
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 com.google.common.collect.Multimap;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, TestUtilConfigTranslator.class, EdgeIngestor.class})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, TestUtilConfigTranslator.class, EdgeIngestor.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class EdgeIngestorTest {
@Autowired
@@ -82,7 +83,7 @@ public class EdgeIngestorTest {
@Test
public void getRulesTest2() throws EdgeRuleNotFoundException {
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("puppy", "dog").build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("dog", "puppy").build();
Multimap<String, EdgeRule> results = ei.getRules(q);
assertTrue(results.size() == 1);
assertTrue(results.containsKey("dog|puppy"));
@@ -101,8 +102,49 @@ public class EdgeIngestorTest {
}
@Test
+ public void getRulesFlippedTypesTest() throws EdgeRuleNotFoundException {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "logical-link").version(new SchemaVersion("v11")).build();
+ Multimap<String, EdgeRule> results = ei.getRules(q);
+ assertTrue(results.size() == 3);
+ for (EdgeRule r : results.get("l-interface|logical-link")) {
+ if ("org.onap.relationships.inventory.Source".equals(r.getLabel()) ||
+ "org.onap.relationships.inventory.Destination".equals(r.getLabel())) {
+ //these are defined with from=logical-link, to=l-interface, so they must be flipped
+ assertTrue(Direction.IN.equals(r.getDirection()));
+ } else if ("tosca.relationships.network.LinksTo".equals(r.getLabel())) {
+ //this is defined with from=l-interface, to=logical-link, so it shouldn't be flipped
+ assertTrue(Direction.OUT.equals(r.getDirection()));
+ } else {
+ fail("how did you get here");
+ }
+ }
+ }
+
+ @Test
+ public void fromToSameFlipTests() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
+ //getRules, setting from and to
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("bloop","bloop").version(new SchemaVersion("v11")).build();
+ Multimap<String, EdgeRule> results = ei.getRules(q);
+ assertTrue(results.size() == 1);
+ for (EdgeRule r : results.get("bloop|bloop")) {
+ assertTrue(Direction.IN.equals(r.getDirection()));
+ }
+
+ //getRule, setting just from
+ EdgeRuleQuery q2 = new EdgeRuleQuery.Builder("bloop").version(new SchemaVersion("v11")).build();
+ assertTrue(Direction.IN.equals(ei.getRule(q2).getDirection()));
+
+ //getChildRules
+ Multimap<String, EdgeRule> child = ei.getChildRules("bloop", new SchemaVersion("v11"));
+ assertTrue(child.size() == 1);
+ for (EdgeRule r : child.get("bloop|bloop")) {
+ assertTrue(Direction.IN.equals(r.getDirection()));
+ }
+ }
+
+ @Test
public void getRulesTest3() throws EdgeRuleNotFoundException {
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").version(Version.V11).build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").version(new SchemaVersion("v11")).build();
Multimap<String, EdgeRule> results = ei.getRules(q);
assertTrue(results.size() == 4);
assertTrue(results.containsKey("lag-interface|l-interface"));
@@ -120,7 +162,7 @@ public class EdgeIngestorTest {
@Test
public void getRuleSimpleTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("notation", "parent").build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("parent", "notation").build();
EdgeRule result = ei.getRule(q);
assertTrue("parent".equals(result.getFrom()));
assertTrue("notation".equals(result.getTo()));
@@ -134,8 +176,25 @@ public class EdgeIngestorTest {
}
@Test
+ public void getRuleFlippedTypesTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("notation", "parent").build();
+ EdgeRule result = ei.getRule(q);
+ assertTrue("parent".equals(result.getFrom()));
+ assertTrue("notation".equals(result.getTo()));
+ assertTrue("has".equals(result.getLabel()));
+ //direction flipped to match input order per old EdgeRules.java API
+ assertTrue(Direction.IN.equals(result.getDirection()));
+ assertTrue(MultiplicityRule.MANY2MANY.equals(result.getMultiplicityRule()));
+ assertTrue(AAIDirection.OUT.toString().equals(result.getContains()));
+ assertTrue(AAIDirection.NONE.toString().equals(result.getDeleteOtherV()));
+ assertTrue(AAIDirection.NONE.toString().equals(result.getPreventDelete()));
+ assertTrue("parent contains notation".equals(result.getDescription()));
+ }
+
+ @Test
public void getRuleWithDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface","logical-link").version(Version.V11).build();
+
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface","logical-link").version(new SchemaVersion("v11")).build();
EdgeRule res = ei.getRule(q);
assertTrue(res.isDefault());
assertTrue("tosca.relationships.network.LinksTo".equals(res.getLabel()));
@@ -143,7 +202,7 @@ public class EdgeIngestorTest {
@Test
public void getRuleWithNonDefault() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface","logical-link").label("org.onap.relationships.inventory.Source").version(Version.V11).build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface","logical-link").label("org.onap.relationships.inventory.Source").version(new SchemaVersion("v11")).build();
EdgeRule res = ei.getRule(q);
assertFalse(res.isDefault());
assertTrue("org.onap.relationships.inventory.Source".equals(res.getLabel()));
@@ -169,7 +228,7 @@ public class EdgeIngestorTest {
public void getRuleAmbiguousDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
thrown.expect(AmbiguousRuleChoiceException.class);
thrown.expectMessage("Multiple defaults found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed","plant").version(Version.V11).build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed","plant").version(new SchemaVersion("v11")).build();
ei.getRule(q);
}
@@ -177,13 +236,13 @@ public class EdgeIngestorTest {
public void getRuleNoDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
thrown.expect(AmbiguousRuleChoiceException.class);
thrown.expectMessage("No default found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(Version.V11).build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
ei.getRule(q);
}
@Test
public void hasRuleTest() {
- assertTrue(ei.hasRule(new EdgeRuleQuery.Builder("l-interface").version(Version.V11).build()));
+ assertTrue(ei.hasRule(new EdgeRuleQuery.Builder("l-interface").version(new SchemaVersion("v11")).build()));
assertFalse(ei.hasRule(new EdgeRuleQuery.Builder("l-interface").build()));
}
@@ -197,7 +256,7 @@ public class EdgeIngestorTest {
@Test
public void getCousinRulesWithVersionTest() {
- Multimap<String, EdgeRule> results = ei.getCousinRules("foo", Version.V10);
+ Multimap<String, EdgeRule> results = ei.getCousinRules("foo", new SchemaVersion("v10"));
assertTrue(results.size() == 2);
assertTrue(results.containsKey("bar|foo"));
assertTrue(results.get("bar|foo").size() == 2);
@@ -205,16 +264,16 @@ public class EdgeIngestorTest {
@Test
public void getCousinsNoneInVersionTest() {
- Multimap<String, EdgeRule> results = ei.getCousinRules("foo", Version.V11);
+ Multimap<String, EdgeRule> results = ei.getCousinRules("foo", new SchemaVersion("v11"));
assertTrue(results.isEmpty());
}
@Test
public void hasCousinTest() {
assertTrue(ei.hasCousinRule("foo"));
- assertTrue(ei.hasCousinRule("foo", Version.V10));
+ assertTrue(ei.hasCousinRule("foo", new SchemaVersion("v10")));
assertFalse(ei.hasCousinRule("parent"));
- assertFalse(ei.hasCousinRule("foo", Version.V11));
+ assertFalse(ei.hasCousinRule("foo", new SchemaVersion("v11")));
}
@Test
@@ -231,7 +290,7 @@ public class EdgeIngestorTest {
@Test
public void getChildRulesWithVersionTest() {
- Multimap<String, EdgeRule> results = ei.getChildRules("foo", Version.V10);
+ Multimap<String, EdgeRule> results = ei.getChildRules("foo", new SchemaVersion("v10"));
assertTrue(results.size() == 2);
assertTrue(results.containsKey("baz|foo"));
assertTrue(results.containsKey("foo|quux"));
@@ -239,16 +298,16 @@ public class EdgeIngestorTest {
@Test
public void getChildRulesNoneInVersionTest() {
- Multimap<String, EdgeRule> results = ei.getChildRules("foo", Version.V11);
+ Multimap<String, EdgeRule> results = ei.getChildRules("foo", new SchemaVersion("v11"));
assertTrue(results.isEmpty());
}
@Test
public void hasChildTest() {
assertTrue(ei.hasChildRule("foo"));
- assertTrue(ei.hasChildRule("foo", Version.V10));
+ assertTrue(ei.hasChildRule("foo", new SchemaVersion("v10")));
assertFalse(ei.hasChildRule("puppy"));
- assertFalse(ei.hasChildRule("foo", Version.V11));
+ assertFalse(ei.hasChildRule("foo", new SchemaVersion("v11")));
}
@Test
@@ -265,23 +324,23 @@ public class EdgeIngestorTest {
@Test
public void getParentRulesWithVersionTest() {
- Multimap<String, EdgeRule> results = ei.getParentRules("baz", Version.V10);
+ Multimap<String, EdgeRule> results = ei.getParentRules("baz", new SchemaVersion("v10"));
assertTrue(results.size() == 1);
assertTrue(results.containsKey("baz|foo"));
}
@Test
public void getParentRulesNoneInVersionTest() {
- Multimap<String, EdgeRule> results = ei.getParentRules("baz", Version.V11);
+ Multimap<String, EdgeRule> results = ei.getParentRules("baz", new SchemaVersion("v11"));
assertTrue(results.isEmpty());
}
@Test
public void hasParentTest() {
assertTrue(ei.hasParentRule("parent"));
- assertTrue(ei.hasParentRule("quux", Version.V10));
+ assertTrue(ei.hasParentRule("quux", new SchemaVersion("v10")));
assertFalse(ei.hasParentRule("puppy"));
- assertFalse(ei.hasParentRule("foo", Version.V11));
+ assertFalse(ei.hasParentRule("foo", new SchemaVersion("v11")));
}
@Test
@@ -292,7 +351,7 @@ public class EdgeIngestorTest {
@Test
public void getAllRulesTest() throws EdgeRuleNotFoundException {
- Multimap<String, EdgeRule> res = ei.getAllRules(Version.V10);
+ Multimap<String, EdgeRule> res = ei.getAllRules(new SchemaVersion("v10"));
assertTrue(res.size() == 4);
assertTrue(res.containsKey("bar|foo"));
assertTrue(res.get("bar|foo").size() == 2);
@@ -300,7 +359,7 @@ public class EdgeIngestorTest {
assertTrue(res.containsKey("foo|quux"));
thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for version V9.");
- ei.getAllRules(Version.V9);
+ thrown.expectMessage("No rules found for version v9.");
+ ei.getAllRules(new SchemaVersion("v9"));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
index 74aceb51..cf23a702 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.edges;
@@ -28,7 +26,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -39,8 +38,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.google.common.collect.Multimap;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, ConfigTranslatorForWiringTest.class, EdgeIngestor.class})
-@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/forWiringTests/schemaIngestWiringTest.properties"})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, ConfigTranslatorForWiringTest.class, EdgeIngestor.class})
+@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties"})
@SpringBootTest
public class EdgeIngestorWiringTest {
@Autowired
@@ -49,7 +48,7 @@ public class EdgeIngestorWiringTest {
@Test
public void test() throws EdgeRuleNotFoundException {
assertNotNull(ei);
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("quux", "foo").label("dancesWith").version(Version.V10).build();
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("quux", "foo").label("dancesWith").version(new SchemaVersion("v10")).build();
Multimap<String, EdgeRule> results = ei.getRules(q);
assertTrue(results.size() == 1);
assertTrue(results.containsKey("foo|quux"));
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
index f21246cb..da875ffe 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.edges;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
new file mode 100644
index 00000000..4be987e7
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
@@ -0,0 +1,59 @@
+/**
+ * ============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.edges;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.junit.Test;
+
+public class EdgeRuleTest {
+
+ @Test
+ public void testFlipDirection() {
+ Map<String, String> rule = new HashMap<>();
+ rule.put("from", "foo");
+ rule.put("to", "bar");
+ rule.put("label", "links");
+ rule.put("contains-other-v", "NONE");
+ rule.put("delete-other-v", "NONE");
+ rule.put("prevent-delete", "NONE");
+ rule.put("multiplicity", "ONE2ONE");
+ rule.put("direction", "OUT");
+ rule.put("default", "true");
+ rule.put("private", "true");
+
+ EdgeRule r = new EdgeRule(rule);
+
+ r.flipDirection();
+ assertTrue(Direction.IN.equals(r.getDirection()));
+ r.flipDirection();
+ assertTrue(Direction.OUT.equals(r.getDirection()));
+
+ rule.put("direction", "BOTH");
+ EdgeRule r2 = new EdgeRule(rule);
+ r2.flipDirection();
+ assertTrue(Direction.BOTH.equals(r2.getDirection()));
+ }
+
+}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
index 4bc23542..188848b7 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,21 +16,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.edges;
import static org.junit.Assert.*;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.junit.Test;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.Filter;
@@ -39,6 +34,10 @@ import static com.jayway.jsonpath.Filter.filter;
public class JsonIngestorTest {
+ private SchemaVersion LATEST = new SchemaVersion("v14");
+ private SchemaVersion V10 = new SchemaVersion("v10");
+ private SchemaVersion V11 = new SchemaVersion("v11");
+
@Test
public void test() {
//setup
@@ -46,29 +45,29 @@ public class JsonIngestorTest {
files.add("src/test/resources/edgeRules/test.json");
files.add("src/test/resources/edgeRules/test2.json");
files.add("src/test/resources/edgeRules/otherTestRules.json");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- input.put(Version.getLatest(), files);
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(LATEST, files);
List<String> files2 = new ArrayList<>();
files2.add("src/test/resources/edgeRules/test.json");
- input.put(Version.V10, files2);
+ input.put(V10, files2);
List<String> files3 = new ArrayList<>();
files3.add("src/test/resources/edgeRules/test3.json");
files3.add("src/test/resources/edgeRules/defaultEdgesTest.json");
- input.put(Version.V11, files3);
+ input.put(V11, files3);
//test
JsonIngestor ji = new JsonIngestor();
- Map<Version, List<DocumentContext>> results = ji.ingest(input);
+ Map<SchemaVersion, List<DocumentContext>> results = ji.ingest(input);
assertTrue(results.entrySet().size() == 3);
- assertTrue(results.get(Version.getLatest()).size() == 3);
- assertTrue(results.get(Version.V11).size() == 2);
- assertTrue(results.get(Version.V10).size() == 1);
+ assertTrue(results.get(LATEST).size() == 3);
+ assertTrue(results.get(V11).size() == 2);
+ assertTrue(results.get(V10).size() == 1);
Filter f = filter(where("from").is("foo").and("contains-other-v").is("NONE"));
- List<Map<String, String>> filterRes = results.get(Version.V10).get(0).read("$.rules.[?]",f);
+ List<Map<String, String>> filterRes = results.get(V10).get(0).read("$.rules.[?]",f);
assertTrue(filterRes.size() == 2);
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
index 6c99a489..dd5da519 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.edges;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
index bcd58732..5421aa2a 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,30 +16,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.nodes;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import org.eclipse.persistence.dynamic.DynamicEntity;
+import org.eclipse.persistence.jaxb.JAXBContext;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.TestUtilConfigTranslator;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.w3c.dom.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, TestUtilConfigTranslator.class, NodeIngestor.class})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, TestUtilConfigTranslator.class, NodeIngestor.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class NodeIngestorTest {
@Autowired
@@ -52,10 +75,11 @@ public class NodeIngestorTest {
@Test
public void testGetContextForVersion() {
- DynamicJAXBContext ctx10 = ni.getContextForVersion(Version.V10);
+ DynamicJAXBContext ctx10 = ni.getContextForVersion(new SchemaVersion("v10"));
//should work bc Foo is valid in test_network_v10 schema
DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
+
foo10.set("fooId","bar");
assertTrue("bar".equals(foo10.get("fooId")));
@@ -63,9 +87,10 @@ public class NodeIngestorTest {
DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
bar10.set("barId","bar2");
assertTrue("bar2".equals(bar10.get("barId")));
+ XSDOutputResolver outputResolver10 = new XSDOutputResolver();
+ ctx10.generateSchema(outputResolver10);
-
- DynamicJAXBContext ctx11 = ni.getContextForVersion(Version.V11);
+ DynamicJAXBContext ctx11 = ni.getContextForVersion(new SchemaVersion("v11"));
//should work bc Foo.quantity is valid in test_network_v11 schema
DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
@@ -75,7 +100,9 @@ public class NodeIngestorTest {
DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
quux11.set("qManagerName","some guy");
assertTrue("some guy".equals(quux11.get("qManagerName")));
-
+ XSDOutputResolver outputResolver11 = new XSDOutputResolver();
+ ctx11.generateSchema(outputResolver11);
+
thrown.expect(IllegalArgumentException.class);
//should fail bc Quux not in v10 test schema
@@ -84,8 +111,55 @@ public class NodeIngestorTest {
@Test
public void testHasNodeType() {
- assertTrue(ni.hasNodeType("foo", Version.V11));
- assertTrue(ni.hasNodeType("quux", Version.V11));
- assertFalse(ni.hasNodeType("quux", Version.V10));
+ assertTrue(ni.hasNodeType("foo", new SchemaVersion("v11")));
+ assertTrue(ni.hasNodeType("quux", new SchemaVersion("v11")));
+ assertFalse(ni.hasNodeType("quux", new SchemaVersion("v10")));
+ }
+ @Test
+ public void testCombinedSchema() throws TransformerException, IOException {
+ DynamicJAXBContext ctx13 = ni.getContextForVersion(new SchemaVersion("v13"));
+ XSDOutputResolver outputResolver13 = new XSDOutputResolver();
+ ctx13.generateSchema(outputResolver13);
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ printDocument(ni.getSchema(new SchemaVersion("v13")),buffer);
+ String content = new String(Files.readAllBytes(Paths.get("src/test/resources/forWiringTests/aai_oxm_v13.xml")));
+ content = content.replaceAll("\\s+", "");
+ String expected = buffer.toString().replaceAll("\\s+", "");
+ assertThat("OXM:\n"+expected,expected, is(content));
+ }
+
+ public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+
+ transformer.transform(new DOMSource(doc),
+ new StreamResult(new OutputStreamWriter(out, "UTF-8")));
+ }
+
+ private class XSDOutputResolver extends SchemaOutputResolver {
+
+ @Override
+ public Result createOutput(String namespaceUri, String suggestedFileName)
+ throws IOException {
+
+ // create new file
+ // create stream result
+ File temp = File.createTempFile("schema", ".xsd");
+ StreamResult result = new StreamResult(temp);
+ System.out.println("Schema file: "+temp.getAbsolutePath());
+
+ // set system id
+ result.setSystemId(temp.toURI().toURL().toString());
+
+ // return result
+ return result;
+ }
}
}
+
+
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
index e62cc6ab..2749cdb7 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.nodes;
@@ -29,7 +27,8 @@ import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
@@ -38,8 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, ConfigTranslatorForWiringTest.class, NodeIngestor.class})
-@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/forWiringTests/schemaIngestWiringTest.properties"})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, ConfigTranslatorForWiringTest.class, NodeIngestor.class})
+@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties"})
@SpringBootTest
public class NodeIngestorWiringTest {
@Autowired
@@ -47,7 +46,7 @@ public class NodeIngestorWiringTest {
@Test
public void test() {
- DynamicJAXBContext ctx10 = ni.getContextForVersion(Version.V10);
+ DynamicJAXBContext ctx10 = ni.getContextForVersion(new SchemaVersion("v10"));
//should work bc Bar is valid in test_business_v10 schema
DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
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 9d66551b..543284cb 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.setup;
@@ -37,8 +35,8 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, ConfigTranslatorForWiringTest.class})
-@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/forWiringTests/schemaIngestWiringTest.properties"})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, ConfigTranslatorForWiringTest.class})
+@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties"})
@SpringBootTest
public class ConfigTranslatorWiringTest {
@Autowired
@@ -47,15 +45,15 @@ public class ConfigTranslatorWiringTest {
@Test
public void test() {
assertNotNull(ct);
- Map<Version, List<String>> nodes = ct.getNodeFiles();
- assertTrue(nodes.containsKey(Version.V10));
- assertTrue(1 == nodes.get(Version.V10).size());
- assertTrue("src/test/resources/oxm/test_business_v10.xml".equals(nodes.get(Version.V10).get(0)));
+ Map<SchemaVersion, List<String>> nodes = ct.getNodeFiles();
+ assertTrue(nodes.containsKey(new SchemaVersion("v10")));
+ assertTrue(1 == nodes.get(new SchemaVersion("v10")).size());
+ assertTrue("src/test/resources/oxm/test_business_v10.xml".equals(nodes.get(new SchemaVersion("v10")).get(0)));
- Map<Version, List<String>> edges = ct.getEdgeFiles();
- assertTrue(edges.containsKey(Version.V10));
- assertTrue(1 == edges.get(Version.V10).size());
- assertTrue("src/test/resources/edgeRules/test.json".equals(edges.get(Version.V10).get(0)));
+ Map<SchemaVersion, List<String>> edges = ct.getEdgeFiles();
+ assertTrue(edges.containsKey(new SchemaVersion("v10")));
+ assertTrue(1 == edges.get(new SchemaVersion("v10")).size());
+ assertTrue("src/test/resources/edgeRules/test.json".equals(edges.get(new SchemaVersion("v10")).get(0)));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
index 5074f913..2103ac21 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.setup;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
index f9d6b620..aed9c633 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.setup;
@@ -33,7 +31,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {SchemaLocationsBean.class})
-@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/forWiringTests/schemaIngest2.properties"})
+@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest2.properties"})
public class SchemaLocationsBeanEnvVarInjectionTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
index 0a22bbb0..99f2104a 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.setup;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
index 4604b045..150313b3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.setup;
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 d6aee9a2..b2400aab 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,45 +16,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.testutils;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-import org.onap.aai.setup.ConfigTranslator;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.*;
/**
* Good oxm, bad edge rules for rainy day edge rule validation testing
*/
public class BadEdgeConfigForValidationTest extends ConfigTranslator {
- public BadEdgeConfigForValidationTest(SchemaLocationsBean bean) {
- super(bean);
+ public static final SchemaVersion LATEST = new SchemaVersion("v14");
+
+ public BadEdgeConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
}
@Override
- public Map<Version, List<String>> getNodeFiles() {
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
List<String> files = new ArrayList<>();
files.add("src/test/resources/oxm/goodConfigForValidationTest_oxm.xml");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- input.put(Version.getLatest(), files);
+ Map<SchemaVersion, List<String>> input = new HashMap<>();
+ input.put(LATEST, files);
return input;
}
@Override
- public Map<Version, List<String>> getEdgeFiles() {
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
List<String> files = new ArrayList<>();
files.add("src/test/resources/edgeRules/test3-butbad.json");
- input.put(Version.getLatest(), files);
+ input.put(LATEST, files);
return input;
}
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 a778e48a..9de21f31 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,46 +16,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.testutils;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-import org.onap.aai.setup.ConfigTranslator;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.*;
/**
* All schema files here are valid for sunny day validator testing
*/
public class BadNodeConfigForValidationTest extends ConfigTranslator {
- public BadNodeConfigForValidationTest(SchemaLocationsBean bean) {
- super(bean);
+ public static final SchemaVersion LATEST = new SchemaVersion("v14");
+
+ public BadNodeConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
}
@Override
- public Map<Version, List<String>> getNodeFiles() {
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
List<String> files = new ArrayList<>();
files.add("src/test/resources/oxm/goodConfigForValidationTest_oxm.xml");
files.add("src/test/resources/oxm/badConfigForValidationTest_oxm.xml");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- input.put(Version.getLatest(), files);
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(LATEST, files);
return input;
}
@Override
- public Map<Version, List<String>> getEdgeFiles() {
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
List<String> files = new ArrayList<>();
files.add("src/test/resources/edgeRules/test3.json");
- input.put(Version.getLatest(), files);
+ input.put(LATEST, files);
return input;
}
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 5e1b6c82..fc0a3984 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,44 +16,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.testutils;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-import org.onap.aai.setup.ConfigTranslator;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.*;
public class ConfigTranslatorForWiringTest extends ConfigTranslator {
- public ConfigTranslatorForWiringTest(SchemaLocationsBean bean) {
- super(bean);
+ public ConfigTranslatorForWiringTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
}
@Override
- public Map<Version, List<String>> getNodeFiles() {
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
String f = bean.getNodeDirectory() + "test_business_v10.xml";
List<String> files = new ArrayList<>();
files.add(f);
- Map<Version, List<String>> mp = new EnumMap<>(Version.class);
- mp.put(Version.V10, files);
+ Map<SchemaVersion, List<String>> mp = new TreeMap<>();
+ mp.put(new SchemaVersion("v10"), files);
return mp;
}
@Override
- public Map<Version, List<String>> getEdgeFiles() {
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
String f = bean.getEdgeDirectory() + "test.json";
List<String> files = new ArrayList<>();
files.add(f);
- Map<Version, List<String>> mp = new EnumMap<>(Version.class);
- mp.put(Version.V10, files);
+ Map<SchemaVersion, List<String>> mp = new TreeMap<>();
+ mp.put(new SchemaVersion("v10"), files);
return mp;
}
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 5efa2654..dd8d5977 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,49 +16,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.testutils;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
/**
* All schema files here are valid for sunny day validator testing
*/
public class GoodConfigForValidationTest extends ConfigTranslator {
- public GoodConfigForValidationTest(SchemaLocationsBean bean) {
- super(bean);
+ private SchemaVersions schemaVersions;
+
+ public GoodConfigForValidationTest(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
+ this.schemaVersions = schemaVersions;
}
@Override
- public Map<Version, List<String>> getNodeFiles() {
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
List<String> files = new ArrayList<>();
files.add("src/test/resources/oxm/goodConfigForValidationTest_oxm.xml");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- //input.put(Version.getLatest(), files);
- for (Version v : Version.values()) {
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ //input.put(SchemaVersion.getLatest(), files);
+ for (SchemaVersion v : schemaVersions.getVersions()) {
input.put(v, files);
}
return input;
}
@Override
- public Map<Version, List<String>> getEdgeFiles() {
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
List<String> files = new ArrayList<>();
files.add("src/test/resources/edgeRules/test3.json");
- //input.put(Version.getLatest(), files);
- for (Version v : Version.values()) {
+ //input.put(SchemaVersion.getLatest(), files);
+ for (SchemaVersion v : schemaVersions.getVersions()) {
input.put(v, files);
}
return input;
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
new file mode 100644
index 00000000..66f2bea2
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/SchemaIncompleteTranslator.java
@@ -0,0 +1,82 @@
+/**
+ * ============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.testutils;
+
+import java.util.ArrayList;
+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;
+
+public class SchemaIncompleteTranslator extends ConfigTranslator {
+
+ public SchemaIncompleteTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
+ }
+
+ @Override
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
+ List<String> files10 = new ArrayList<>();
+ files10.add("src/test/resources/oxm/test_network_v10.xml");
+ files10.add("src/test/resources/oxm/test_business_v10.xml");
+
+ List<String> files11 = new ArrayList<>();
+ files11.add("src/test/resources/oxm/test_network_v11.xml");
+ files11.add("src/test/resources/oxm/test_business_v11.xml");
+
+ List<String> files12 = new ArrayList<>();
+ files12.add("src/test/resources/oxm/business_oxm_v12.xml");
+
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+
+
+ input.put(new SchemaVersion("v10"), files10);
+ input.put(new SchemaVersion("v11"), files11);
+ input.put(new SchemaVersion("v12"), files12);
+ return input;
+ }
+
+ @Override
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
+ List<String> files = new ArrayList<>();
+ files.add("src/test/resources/edgeRules/test.json");
+ files.add("src/test/resources/edgeRules/test2.json");
+ files.add("src/test/resources/edgeRules/otherTestRules.json");
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(schemaVersions.getDefaultVersion(), files);
+
+ List<String> files2 = new ArrayList<>();
+ files2.add("src/test/resources/edgeRules/test.json");
+ input.put(new SchemaVersion("v10"), files2);
+
+ List<String> files3 = new ArrayList<>();
+ files3.add("src/test/resources/edgeRules/test3.json");
+ files3.add("src/test/resources/edgeRules/defaultEdgesTest.json");
+ input.put(new SchemaVersion("v11"), files3);
+
+ return input;
+ }
+}
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 785b7403..b4756d64 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,29 +16,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.testutils;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-import org.onap.aai.setup.ConfigTranslator;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.*;
public class TestUtilConfigTranslator extends ConfigTranslator {
-
- public TestUtilConfigTranslator(SchemaLocationsBean bean) {
- super(bean);
+
+ public static final SchemaVersion LATEST = new SchemaVersion("v14");
+ public TestUtilConfigTranslator(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
}
@Override
- public Map<Version, List<String>> getNodeFiles() {
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
List<String> files10 = new ArrayList<>();
files10.add("src/test/resources/oxm/test_network_v10.xml");
files10.add("src/test/resources/oxm/test_business_v10.xml");
@@ -47,30 +41,42 @@ public class TestUtilConfigTranslator extends ConfigTranslator {
files11.add("src/test/resources/oxm/test_network_v11.xml");
files11.add("src/test/resources/oxm/test_business_v11.xml");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- input.put(Version.V10, files10);
- input.put(Version.V11, files11);
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(new SchemaVersion("v10"), files10);
+ input.put(new SchemaVersion("v11"), files11);
+
+ List<String> files13 = new ArrayList<>();
+ files13.add("src/test/resources/oxm/business_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/common_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/serviceDesign_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/network_oxm_v13.xml");
+
+ input.put(new SchemaVersion("v10"), files10);
+ input.put(new SchemaVersion("v11"), files11);
+ input.put(new SchemaVersion("v13"), files13);
return input;
}
@Override
- public Map<Version, List<String>> getEdgeFiles() {
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
List<String> files = new ArrayList<>();
files.add("src/test/resources/edgeRules/test.json");
files.add("src/test/resources/edgeRules/test2.json");
files.add("src/test/resources/edgeRules/otherTestRules.json");
- Map<Version, List<String>> input = new EnumMap<>(Version.class);
- input.put(Version.getLatest(), files);
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(LATEST, files);
List<String> files2 = new ArrayList<>();
files2.add("src/test/resources/edgeRules/test.json");
- input.put(Version.V10, files2);
+ input.put(new SchemaVersion("v10"), files2);
List<String> files3 = new ArrayList<>();
files3.add("src/test/resources/edgeRules/test3.json");
files3.add("src/test/resources/edgeRules/defaultEdgesTest.json");
- input.put(Version.V11, files3);
+ input.put(new SchemaVersion("v11"), files3);
return input;
}
}
+
+
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
new file mode 100644
index 00000000..2d753efb
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
@@ -0,0 +1,80 @@
+/**
+ * ============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.testutils;
+
+import java.util.ArrayList;
+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;
+
+public class TestUtilConfigTranslatorforBusiness extends ConfigTranslator {
+
+ public TestUtilConfigTranslatorforBusiness(SchemaLocationsBean bean, SchemaVersions schemaVersions) {
+ super(bean, schemaVersions);
+ }
+
+ @Override
+ public Map<SchemaVersion, List<String>> getNodeFiles() {
+ List<String> files10 = new ArrayList<>();
+// files10.add("src/test/resources/oxm/test_network_v10.xml");
+// files10.add("src/test/resources/oxm/test_business_v10.xml");
+
+ List<String> files11 = new ArrayList<>();
+// files11.add("src/test/resources/oxm/test_network_v11.xml");
+ files11.add("src/test/resources/oxm/business_v11.xml");
+
+ List<String> files13 = new ArrayList<>();
+ files13.add("src/test/resources/oxm/business_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/common_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/serviceDesign_oxm_v13.xml");
+ files13.add("src/test/resources/oxm/network_oxm_v13.xml");
+
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+// input.put(Version.V10, files10);
+ input.put(new SchemaVersion("v11"), files11);
+ input.put(schemaVersions.getDefaultVersion(), files13);
+ return input;
+ }
+
+ @Override
+ public Map<SchemaVersion, List<String>> getEdgeFiles() {
+ List<String> files = new ArrayList<>();
+ files.add("src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json");
+ Map<SchemaVersion, List<String>> input = new TreeMap<>();
+ input.put(schemaVersions.getDefaultVersion(), files);
+
+ List<String> files2 = new ArrayList<>();
+ files2.add("src/test/resources/dbedgerules/test.json");
+// input.put(Version.V10, files2);
+
+ List<String> files3 = new ArrayList<>();
+ files3.add("src/test/resources/dbedgerules/DbEdgeBusinessRules_test.json");
+ input.put(new SchemaVersion("v11"), files3);
+
+ return input;
+ }
+}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
index 7078ac3a..49bb5986 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
index 69f56007..b70d13d6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
index f0d13d2e..8c0ac82c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation;
@@ -28,16 +26,19 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
CheckEverythingStrategy.class, DefaultVersionValidationModule.class, VersionValidator.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class VersionValidatorRainyDayTest {
@Autowired
@@ -46,8 +47,8 @@ public class VersionValidatorRainyDayTest {
@Test
public void test() {
assertFalse(validator.validate());
- assertTrue(validator.getErrorMsg().contains(Version.V12.toString()));
- assertTrue(validator.getErrorMsg().contains(Version.V11.toString()));
+ assertTrue(validator.getErrorMsg().contains(new SchemaVersion("v12").toString()));
+ assertTrue(validator.getErrorMsg().contains(new SchemaVersion("v11").toString()));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
index f1950dd6..ff944aad 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation;
@@ -28,15 +26,25 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.GoodConfigForValidationTest;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
- CheckEverythingStrategy.class, DefaultVersionValidationModule.class, VersionValidator.class})
+@ContextConfiguration(classes = {
+ SchemaLocationsBean.class,
+ SchemaVersions.class,
+ GoodConfigForValidationTest.class,
+ NodeIngestor.class,
+ CheckEverythingStrategy.class,
+ DefaultVersionValidationModule.class,
+ VersionValidator.class
+})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class VersionValidatorSunnyDayTest {
@Autowired
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
index 86aa61d3..a4613813 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
@@ -32,8 +30,7 @@ import java.util.Map;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.edges.JsonIngestor;
-import org.onap.aai.setup.Version;
-import org.onap.aai.validation.edges.CousinDefaultingValidationModule;
+import org.onap.aai.setup.SchemaVersion;
import com.jayway.jsonpath.DocumentContext;
@@ -43,13 +40,15 @@ public class CousinDefaultingValidationModuleTest {
@BeforeClass
public static void setUpBeforeClass() {
- Map<Version, List<String>> testRules = new HashMap<>();
+ Map<SchemaVersion, List<String>> testRules = new HashMap<>();
List<String> testFiles = new ArrayList<>();
testFiles.add("src/test/resources/edgeRules/cousinDefaultValidationTest.json");
- testRules.put(Version.getLatest(), testFiles);
+
+ SchemaVersion LATEST_VERSION = new SchemaVersion("v14");
+ testRules.put(LATEST_VERSION, testFiles);
JsonIngestor ji = new JsonIngestor();
- ctxs = ji.ingest(testRules).get(Version.getLatest());
+ ctxs = ji.ingest(testRules).get(LATEST_VERSION);
validator = new CousinDefaultingValidationModule();
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
index 39f2a019..a1b5fa43 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
index 5a3a4334..2a49e45a 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
@@ -28,6 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.BadEdgeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.edges.CousinDefaultingValidationModule;
@@ -39,13 +38,15 @@ import org.onap.aai.validation.edges.UniqueLabelValidationModule;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, BadEdgeConfigForValidationTest.class, NodeIngestor.class,
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, BadEdgeConfigForValidationTest.class, NodeIngestor.class,
CheckEverythingStrategy.class, DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
SingleContainmentValidationModule.class, CousinDefaultingValidationModule.class, NodeTypesValidationModule.class,
EdgeRuleValidator.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class EdgeRuleValidatorRainyDayTest {
@Autowired
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
index 20885894..af782ccf 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
@@ -28,6 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.edges.CousinDefaultingValidationModule;
@@ -39,13 +38,15 @@ import org.onap.aai.validation.edges.UniqueLabelValidationModule;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, GoodConfigForValidationTest.class, NodeIngestor.class,
CheckEverythingStrategy.class, DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
SingleContainmentValidationModule.class, CousinDefaultingValidationModule.class, NodeTypesValidationModule.class,
EdgeRuleValidator.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class EdgeRuleValidatorSunnyDayTest {
@Autowired
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
index a7cb9c2e..e3efc23c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
@@ -31,16 +29,18 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.Version;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.TestUtilConfigTranslator;
-import org.onap.aai.validation.edges.NodeTypesValidationModule;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, TestUtilConfigTranslator.class, NodeIngestor.class, NodeTypesValidationModule.class})
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, TestUtilConfigTranslator.class, NodeIngestor.class, NodeTypesValidationModule.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class NodeTypesValidationModuleTest {
@Autowired
@@ -52,8 +52,8 @@ public class NodeTypesValidationModuleTest {
testPairs.add("bar|foo");
testPairs.add("foo|foo");
testPairs.add("foo|quux");
- assertTrue("".equals(validator.validate(testPairs, Version.V11)));
- assertTrue(validator.validate(testPairs, Version.V10).contains("Invalid node type(s) found: quux")); //bc no quux in v10
+ assertTrue("".equals(validator.validate(testPairs, new SchemaVersion("v11"))));
+ assertTrue(validator.validate(testPairs, new SchemaVersion("v10")).contains("Invalid node type(s) found: quux")); //bc no quux in v10
}
@Test
@@ -62,6 +62,6 @@ public class NodeTypesValidationModuleTest {
testPairs.add("bar|");
testPairs.add("|foo");
testPairs.add("|");
- assertTrue("".equals(validator.validate(testPairs, Version.V11))); //bc empty just ignored
+ assertTrue("".equals(validator.validate(testPairs, new SchemaVersion("v11")))); //bc empty just ignored
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
index caf73cb5..ae7c23d7 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,40 +16,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
import static org.junit.Assert.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.edges.JsonIngestor;
-import org.onap.aai.setup.Version;
-import org.onap.aai.validation.edges.SingleContainmentValidationModule;
+import org.onap.aai.setup.SchemaVersion;
import com.jayway.jsonpath.DocumentContext;
public class SingleContainmentValidationModuleTest {
private static List<DocumentContext> ctxs;
private static SingleContainmentValidationModule validator;
+ public static final SchemaVersion LATEST = new SchemaVersion("v14");
@BeforeClass
public static void setUpBeforeClass() {
- Map<Version, List<String>> testRules = new HashMap<>();
+ Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
testFiles.add("src/test/resources/edgeRules/containsValidationTest.json");
- testRules.put(Version.getLatest(), testFiles);
+ testRules.put(LATEST, testFiles);
JsonIngestor ji = new JsonIngestor();
- ctxs = ji.ingest(testRules).get(Version.getLatest());
+ ctxs = ji.ingest(testRules).get(LATEST);
validator = new SingleContainmentValidationModule();
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
index 7f51a6fb..3b0ab034 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,41 +16,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.edges;
import static org.junit.Assert.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.edges.JsonIngestor;
-import org.onap.aai.setup.Version;
-import org.onap.aai.validation.edges.UniqueLabelValidationModule;
+import org.onap.aai.setup.SchemaVersion;
import com.jayway.jsonpath.DocumentContext;
public class UniqueLabelValidationModuleTest {
private static List<DocumentContext> ctxs;
private static UniqueLabelValidationModule validator;
-
+ public static final SchemaVersion LATEST = new SchemaVersion("v14");
+
@BeforeClass
public static void setup() {
- Map<Version, List<String>> testRules = new HashMap<>();
+ Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
testFiles.add("src/test/resources/edgeRules/labelValidationTest1.json");
testFiles.add("src/test/resources/edgeRules/labelValidationTest2.json");
- testRules.put(Version.getLatest(), testFiles);
+ testRules.put(LATEST, testFiles);
JsonIngestor ji = new JsonIngestor();
- ctxs = ji.ingest(testRules).get(Version.getLatest());
+ ctxs = ji.ingest(testRules).get(LATEST);
validator = new UniqueLabelValidationModule();
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
index d1a60dd8..a026504f 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.nodes;
@@ -28,6 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
@@ -35,11 +34,13 @@ import org.onap.aai.validation.nodes.NodeValidator;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
CheckEverythingStrategy.class, DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class NodeValidatorRainyDayTest {
@Autowired
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
new file mode 100644
index 00000000..83bf3748
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
@@ -0,0 +1,88 @@
+/**
+ * ============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.validation.nodes;
+
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.onap.aai.nodes.NodeIngestor;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.testutils.SchemaIncompleteTranslator;
+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 org.w3c.dom.Document;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+@Ignore
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, SchemaIncompleteTranslator.class, NodeIngestor.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
+//@SpringBootTest
+public class NodeValidatorSchemaIncompleteTest {
+ @Autowired
+ NodeIngestor ni;
+
+ //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();
+
+ //Throws a NullPointerException because a JavaType is referenced, but not defined
+ @Test
+ public void testIncompleteCombinedSchema() throws TransformerException, IOException, IllegalStateException {
+ thrown.expect(NullPointerException.class);
+
+
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ printDocument(ni.getSchema(new SchemaVersion("v12")),buffer);
+ }
+
+ public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+
+ transformer.transform(new DOMSource(doc),
+ new StreamResult(new OutputStreamWriter(out, "UTF-8")));
+ }
+
+}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
index 6233dfe1..6d0a6a50 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.validation.nodes;
@@ -28,6 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
@@ -35,11 +34,13 @@ import org.onap.aai.validation.nodes.NodeValidator;
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;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
+@ContextConfiguration(classes = {SchemaLocationsBean.class, SchemaVersions.class, GoodConfigForValidationTest.class, NodeIngestor.class,
CheckEverythingStrategy.class, DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
+@TestPropertySource(properties = { "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties" })
@SpringBootTest
public class NodeValidatorSunnyDayTest {
@Autowired