summaryrefslogtreecommitdiffstats
path: root/aai-schema-ingest/src/test/java/org/onap
diff options
context:
space:
mode:
authorThreefoot, Jane (jt6620) <jt6620@att.com>2018-03-29 12:54:05 -0400
committerThreefoot, Jane (jt6620) <jt6620@att.com>2018-03-29 13:12:22 -0400
commitc20ee9965e16166f11a77a15b29204eebac4d08c (patch)
treefb485cbf9b68d3818fd8c257ab3dfb1feff590ac /aai-schema-ingest/src/test/java/org/onap
parent1ea271f2c395172d9f999da5748877b3cdbcd44b (diff)
added schema validation tools
Issue-ID: AAI-879 Change-Id: I028547c97450372252b76286a8b10f4dbed4d2bf Signed-off-by: Threefoot, Jane (jt6620) <jt6620@att.com>
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.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java75
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java42
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java18
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java62
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java63
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/ConfigTranslatorForWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java68
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslator.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java57
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java52
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java53
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java50
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java80
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java65
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java63
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java60
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java67
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java70
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java97
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java58
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java55
30 files changed, 1217 insertions, 37 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 fe43de09..9f6d67a1 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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.*;
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 ac0c302f..74aceb51 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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.*;
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 19aa0ce4..f21246cb 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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.*;
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
new file mode 100644
index 00000000..4bc23542
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
@@ -0,0 +1,75 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+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 org.junit.Test;
+import org.onap.aai.setup.Version;
+
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.Filter;
+import static com.jayway.jsonpath.Criteria.where;
+import static com.jayway.jsonpath.Filter.filter;
+
+public class JsonIngestorTest {
+
+ @Test
+ public void test() {
+ //setup
+ 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);
+
+ List<String> files2 = new ArrayList<>();
+ files2.add("src/test/resources/edgeRules/test.json");
+ input.put(Version.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);
+
+ //test
+ JsonIngestor ji = new JsonIngestor();
+ Map<Version, 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);
+
+ 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);
+ 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
new file mode 100644
index 00000000..6c99a489
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
@@ -0,0 +1,42 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.edges;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TypeAlphabetizerTest {
+
+ @Test
+ public void test() {
+ TypeAlphabetizer alpher = new TypeAlphabetizer();
+ assertTrue("aaa|bbb".equals(alpher.buildAlphabetizedKey("aaa", "bbb")));
+ assertTrue("l-interface|logical-link".equals(alpher.buildAlphabetizedKey("l-interface", "logical-link")));
+ assertTrue("l-interface|logical-link".equals(alpher.buildAlphabetizedKey("logical-link", "l-interface")));
+ assertTrue("|foo".equals(alpher.buildAlphabetizedKey(null, "foo")));
+ assertTrue("|foo".equals(alpher.buildAlphabetizedKey("foo", null)));
+ assertTrue("|".equals(alpher.buildAlphabetizedKey(null, null)));
+ }
+
+}
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 f5135571..bcd58732 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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.junit.Assert.*;
@@ -48,7 +51,7 @@ public class NodeIngestorTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void test() {
+ public void testGetContextForVersion() {
DynamicJAXBContext ctx10 = ni.getContextForVersion(Version.V10);
//should work bc Foo is valid in test_network_v10 schema
@@ -78,4 +81,11 @@ public class NodeIngestorTest {
//should fail bc Quux not in v10 test schema
ctx10.newDynamicEntity("Quux");
}
+
+ @Test
+ public void testHasNodeType() {
+ assertTrue(ni.hasNodeType("foo", Version.V11));
+ assertTrue(ni.hasNodeType("quux", Version.V11));
+ assertFalse(ni.hasNodeType("quux", Version.V10));
+ }
}
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 92500d05..e62cc6ab 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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.junit.Assert.*;
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 f0371b91..9d66551b 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
import static org.junit.Assert.*;
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 3d7b589c..5074f913 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
import static org.junit.Assert.*;
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 3be939f3..f9d6b620 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
import static org.junit.Assert.*;
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 a96ca854..0a22bbb0 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
import static org.junit.Assert.*;
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 7c96b9a6..4604b045 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
import static org.junit.Assert.*;
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
new file mode 100644
index 00000000..d6aee9a2
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadEdgeConfigForValidationTest.java
@@ -0,0 +1,62 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.testutils;
+
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.aai.setup.ConfigTranslator;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.Version;
+
+/**
+ * Good oxm, bad edge rules for rainy day edge rule validation testing
+ */
+public class BadEdgeConfigForValidationTest extends ConfigTranslator {
+
+ public BadEdgeConfigForValidationTest(SchemaLocationsBean bean) {
+ super(bean);
+ }
+
+ @Override
+ public Map<Version, 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);
+ return input;
+ }
+
+ @Override
+ public Map<Version, List<String>> getEdgeFiles() {
+ Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ List<String> files = new ArrayList<>();
+ files.add("src/test/resources/edgeRules/test3-butbad.json");
+ input.put(Version.getLatest(), 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
new file mode 100644
index 00000000..a778e48a
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/BadNodeConfigForValidationTest.java
@@ -0,0 +1,63 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.testutils;
+
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.aai.setup.ConfigTranslator;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.Version;
+
+/**
+ * All schema files here are valid for sunny day validator testing
+ */
+public class BadNodeConfigForValidationTest extends ConfigTranslator {
+
+ public BadNodeConfigForValidationTest(SchemaLocationsBean bean) {
+ super(bean);
+ }
+
+ @Override
+ public Map<Version, 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);
+ return input;
+ }
+
+ @Override
+ public Map<Version, List<String>> getEdgeFiles() {
+ Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ List<String> files = new ArrayList<>();
+ files.add("src/test/resources/edgeRules/test3.json");
+ input.put(Version.getLatest(), 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 b69e3ac3..5e1b6c82 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
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
new file mode 100644
index 00000000..5efa2654
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/testutils/GoodConfigForValidationTest.java
@@ -0,0 +1,68 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.testutils;
+
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.aai.setup.ConfigTranslator;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.Version;
+
+/**
+ * All schema files here are valid for sunny day validator testing
+ */
+public class GoodConfigForValidationTest extends ConfigTranslator {
+
+ public GoodConfigForValidationTest(SchemaLocationsBean bean) {
+ super(bean);
+ }
+
+ @Override
+ public Map<Version, 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()) {
+ input.put(v, files);
+ }
+ return input;
+ }
+
+ @Override
+ public Map<Version, List<String>> getEdgeFiles() {
+ Map<Version, List<String>> input = new EnumMap<>(Version.class);
+ 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(v, files);
+ }
+ 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 f69ba29f..785b7403 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
@@ -1,14 +1,14 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -16,7 +16,10 @@
* 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;
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
new file mode 100644
index 00000000..7078ac3a
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
@@ -0,0 +1,57 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.aai.validation.CheckEverythingStrategy;
+
+public class CheckEverythingStrategyTest {
+
+ @Test
+ public void test() {
+ CheckEverythingStrategy strat = new CheckEverythingStrategy();
+ //no issues so nothing notified, should be fine
+ assertTrue(strat.isOK());
+ assertTrue("No errors found.".equals(strat.getErrorMsg()));
+
+ //simulate post one error
+ String testError1 = "oh noes a problem with the gooble-gobble edge rule!";
+ strat.notifyOnError(testError1);
+ assertFalse(strat.isOK());
+ assertTrue(testError1.equals(strat.getErrorMsg()));
+
+ //simulate multiple found
+ String testError2 = "error 2";
+ String testError3 = "duplicate labels not everything is a fork";
+ strat.notifyOnError(testError2);
+ strat.notifyOnError(testError3);
+ assertFalse(strat.isOK());
+ System.out.println(strat.getErrorMsg());
+ assertTrue(strat.getErrorMsg().contains(testError1));
+ assertTrue(strat.getErrorMsg().contains(testError2));
+ assertTrue(strat.getErrorMsg().contains(testError3));
+ }
+
+}
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
new file mode 100644
index 00000000..69f56007
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
@@ -0,0 +1,52 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation;
+
+import static org.junit.Assert.*;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.aai.validation.AAISchemaValidationException;
+import org.onap.aai.validation.FailFastStrategy;
+
+public class FailFastStrategyTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void test() {
+ FailFastStrategy strat = new FailFastStrategy();
+
+ //simulate no issues found
+ assertTrue(strat.isOK());
+ assertTrue("No errors found.".equals(strat.getErrorMsg()));
+
+ //simulate an issue found
+ String testError = "hi i'm a problem";
+ thrown.expect(AAISchemaValidationException.class);
+ thrown.expectMessage(testError);
+ strat.notifyOnError(testError);
+ }
+
+}
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
new file mode 100644
index 00000000..f0d13d2e
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
@@ -0,0 +1,53 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation;
+
+import static org.junit.Assert.*;
+
+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.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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultVersionValidationModule.class, VersionValidator.class})
+@SpringBootTest
+public class VersionValidatorRainyDayTest {
+ @Autowired
+ VersionValidator validator;
+
+ @Test
+ public void test() {
+ assertFalse(validator.validate());
+ assertTrue(validator.getErrorMsg().contains(Version.V12.toString()));
+ assertTrue(validator.getErrorMsg().contains(Version.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
new file mode 100644
index 00000000..f1950dd6
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
@@ -0,0 +1,50 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation;
+
+import static org.junit.Assert.*;
+
+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.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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultVersionValidationModule.class, VersionValidator.class})
+@SpringBootTest
+public class VersionValidatorSunnyDayTest {
+ @Autowired
+ VersionValidator validator;
+
+ @Test
+ public void test() {
+ assertTrue(validator.validate());
+ }
+
+}
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
new file mode 100644
index 00000000..86aa61d3
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
@@ -0,0 +1,80 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+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 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 com.jayway.jsonpath.DocumentContext;
+
+public class CousinDefaultingValidationModuleTest {
+ private static List<DocumentContext> ctxs;
+ private static CousinDefaultingValidationModule validator;
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ Map<Version, List<String>> testRules = new HashMap<>();
+ List<String> testFiles = new ArrayList<>();
+ testFiles.add("src/test/resources/edgeRules/cousinDefaultValidationTest.json");
+ testRules.put(Version.getLatest(), testFiles);
+
+ JsonIngestor ji = new JsonIngestor();
+ ctxs = ji.ingest(testRules).get(Version.getLatest());
+ validator = new CousinDefaultingValidationModule();
+ }
+
+ @Test
+ public void testValidCousins() {
+ assertTrue("".equals(validator.validate("boop|beep", ctxs)));
+ }
+
+ @Test
+ public void testValidBoth() {
+ assertTrue("".equals(validator.validate("monster|human", ctxs)));
+ }
+
+ @Test
+ public void testValidSingleContains() {
+ assertTrue("".equals(validator.validate("family|baby", ctxs)));
+ }
+
+ @Test
+ public void testInvalidTooManyDefaults() {
+ assertTrue(validator.validate("sheep|wool", ctxs).contains("Multiple set"));
+ }
+
+ @Test
+ public void testInvalidNoDefaults() {
+ assertTrue(validator.validate("cloth|thread", ctxs).contains("None set"));
+ }
+}
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
new file mode 100644
index 00000000..39f2a019
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
@@ -0,0 +1,65 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.edges;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.aai.edges.enums.EdgeField;
+import org.onap.aai.validation.edges.DefaultEdgeFieldsValidationModule;
+import org.onap.aai.validation.edges.EdgeFieldsValidationModule;
+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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {DefaultEdgeFieldsValidationModule.class})
+@SpringBootTest
+public class DefaultEdgeFieldsValidationModuleTest {
+ @Autowired
+ EdgeFieldsValidationModule validator;
+
+ @Test
+ public void test() {
+ Map<String, String> test = new HashMap<>();
+ for (EdgeField f : EdgeField.values()) {
+ test.put(f.toString(), "test");
+ }
+ assertTrue("".equals(validator.verifyFields(test)));
+
+ test.remove(EdgeField.DESCRIPTION.toString());
+ assertTrue("".equals(validator.verifyFields(test))); //bc description is optional
+
+ test.remove(EdgeField.CONTAINS.toString());
+ assertTrue(validator.verifyFields(test).contains("missing required fields: contains-other-v"));
+
+ test.remove(EdgeField.FROM.toString());
+ assertTrue(validator.verifyFields(test).contains("missing required fields: from contains-other-v"));
+ }
+
+}
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
new file mode 100644
index 00000000..5a3a4334
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
@@ -0,0 +1,63 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.edges;
+
+import static org.junit.Assert.*;
+
+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.testutils.BadEdgeConfigForValidationTest;
+import org.onap.aai.validation.CheckEverythingStrategy;
+import org.onap.aai.validation.edges.CousinDefaultingValidationModule;
+import org.onap.aai.validation.edges.DefaultEdgeFieldsValidationModule;
+import org.onap.aai.validation.edges.EdgeRuleValidator;
+import org.onap.aai.validation.edges.NodeTypesValidationModule;
+import org.onap.aai.validation.edges.SingleContainmentValidationModule;
+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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, BadEdgeConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
+ SingleContainmentValidationModule.class, CousinDefaultingValidationModule.class, NodeTypesValidationModule.class,
+ EdgeRuleValidator.class})
+@SpringBootTest
+public class EdgeRuleValidatorRainyDayTest {
+ @Autowired
+ EdgeRuleValidator validator;
+
+ @Test
+ public void test() {
+ assertNotNull(validator); //verify spring wiring OK
+ assertFalse(validator.validate());
+ String errors = validator.getErrorMsg();
+ assertTrue(errors.contains("missing required fields: delete-other-v"));
+ assertTrue(errors.contains("has multiple rules using the same label: org.onap.relationships.inventory.Source"));
+ assertTrue(errors.contains("Invalid node type(s) found: gooble"));
+ }
+}
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
new file mode 100644
index 00000000..20885894
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
@@ -0,0 +1,60 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.edges;
+
+import static org.junit.Assert.*;
+
+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.testutils.GoodConfigForValidationTest;
+import org.onap.aai.validation.CheckEverythingStrategy;
+import org.onap.aai.validation.edges.CousinDefaultingValidationModule;
+import org.onap.aai.validation.edges.DefaultEdgeFieldsValidationModule;
+import org.onap.aai.validation.edges.EdgeRuleValidator;
+import org.onap.aai.validation.edges.NodeTypesValidationModule;
+import org.onap.aai.validation.edges.SingleContainmentValidationModule;
+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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
+ SingleContainmentValidationModule.class, CousinDefaultingValidationModule.class, NodeTypesValidationModule.class,
+ EdgeRuleValidator.class})
+@SpringBootTest
+public class EdgeRuleValidatorSunnyDayTest {
+ @Autowired
+ EdgeRuleValidator validator;
+
+ @Test
+ public void test() {
+ assertNotNull(validator); //verify spring wiring OK
+ assertTrue(validator.validate());
+ assertTrue("No errors found.".equals(validator.getErrorMsg()));
+ }
+}
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
new file mode 100644
index 00000000..a7cb9c2e
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
@@ -0,0 +1,67 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.edges;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, TestUtilConfigTranslator.class, NodeIngestor.class, NodeTypesValidationModule.class})
+@SpringBootTest
+public class NodeTypesValidationModuleTest {
+ @Autowired
+ NodeTypesValidationModule validator;
+
+ @Test
+ public void test() {
+ List<String> testPairs = new ArrayList<>();
+ 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
+ }
+
+ @Test
+ public void testWeirdCases() {
+ List<String> testPairs = new ArrayList<>();
+ testPairs.add("bar|");
+ testPairs.add("|foo");
+ testPairs.add("|");
+ assertTrue("".equals(validator.validate(testPairs, Version.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
new file mode 100644
index 00000000..caf73cb5
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
@@ -0,0 +1,70 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+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 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 com.jayway.jsonpath.DocumentContext;
+
+public class SingleContainmentValidationModuleTest {
+ private static List<DocumentContext> ctxs;
+ private static SingleContainmentValidationModule validator;
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ Map<Version, List<String>> testRules = new HashMap<>();
+ List<String> testFiles = new ArrayList<>();
+ testFiles.add("src/test/resources/edgeRules/containsValidationTest.json");
+ testRules.put(Version.getLatest(), testFiles);
+
+ JsonIngestor ji = new JsonIngestor();
+ ctxs = ji.ingest(testRules).get(Version.getLatest());
+ validator = new SingleContainmentValidationModule();
+ }
+
+ @Test
+ public void testValid() {
+ assertTrue("".equals(validator.validate("human|monster", ctxs)));
+ }
+
+ @Test
+ public void testValidWithNone() {
+ assertTrue("".equals(validator.validate("bread|cheese", ctxs)));
+ }
+
+ @Test
+ public void testInvalid() {
+ assertTrue(validator.validate("box|cat", ctxs).contains("has multiple containment rules"));
+ }
+}
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
new file mode 100644
index 00000000..7f51a6fb
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
@@ -0,0 +1,97 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+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 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 com.jayway.jsonpath.DocumentContext;
+
+public class UniqueLabelValidationModuleTest {
+ private static List<DocumentContext> ctxs;
+ private static UniqueLabelValidationModule validator;
+
+ @BeforeClass
+ public static void setup() {
+ Map<Version, List<String>> testRules = new HashMap<>();
+ 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);
+
+ JsonIngestor ji = new JsonIngestor();
+ ctxs = ji.ingest(testRules).get(Version.getLatest());
+ validator = new UniqueLabelValidationModule();
+ }
+
+ @Test
+ public void testValidSetOneFile() {
+ assertTrue("".equals(validator.validate("human|monster", ctxs)));
+ assertTrue("".equals(validator.validate("monster|human", ctxs)));
+ }
+
+ @Test
+ public void testValidDupLabelButDiffPairs() {
+ assertTrue("".equals(validator.validate("human|strange-and-interesting-plant", ctxs)));
+ assertTrue("".equals(validator.validate("strange-and-interesting-plant|human", ctxs)));
+ }
+
+ @Test
+ public void testValidAcrossFiles() {
+ assertTrue("".equals(validator.validate("human|toaster", ctxs)));
+ assertTrue("".equals(validator.validate("toaster|human", ctxs)));
+ }
+
+ @Test
+ public void testInvalidSetOneFileBothTypes() {
+ assertTrue(validator.validate("sphinx|monster", ctxs).contains("has multiple rules using the same label"));
+ assertTrue(validator.validate("monster|sphinx", ctxs).contains("has multiple rules using the same label"));
+ }
+
+ @Test
+ public void testInvalidSetOneFileJustCousins() {
+ assertTrue(validator.validate("griffin|hippogriff", ctxs).contains("has multiple rules using the same label"));
+ assertTrue(validator.validate("hippogriff|griffin", ctxs).contains("has multiple rules using the same label"));
+ }
+
+ @Test
+ public void testInvalidSetMultipleFiles() {
+ assertTrue(validator.validate("lava|floor", ctxs).contains("has multiple rules using the same label"));
+ assertTrue(validator.validate("floor|lava", ctxs).contains("has multiple rules using the same label"));
+ }
+
+ @Test
+ public void testInvalidCopyInOtherFile() {
+ assertTrue(validator.validate("badger|mushroom", ctxs).contains("has multiple rules using the same label"));
+ }
+}
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
new file mode 100644
index 00000000..d1a60dd8
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
@@ -0,0 +1,58 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.nodes;
+
+import static org.junit.Assert.*;
+
+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.testutils.BadNodeConfigForValidationTest;
+import org.onap.aai.validation.CheckEverythingStrategy;
+import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
+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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, BadNodeConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
+@SpringBootTest
+public class NodeValidatorRainyDayTest {
+ @Autowired
+ NodeValidator validator;
+
+ @Test
+ public void test() {
+ assertNotNull(validator); //check spring wiring ok
+ assertFalse(validator.validate());
+ String result = validator.getErrorMsg();
+ assertTrue(result.contains("LogicalLink"));
+ assertTrue(result.contains("LagInterface"));
+ assertFalse(result.contains("LInterface"));
+ }
+
+}
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
new file mode 100644
index 00000000..6233dfe1
--- /dev/null
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
@@ -0,0 +1,55 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.validation.nodes;
+
+import static org.junit.Assert.*;
+
+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.testutils.GoodConfigForValidationTest;
+import org.onap.aai.validation.CheckEverythingStrategy;
+import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
+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.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {SchemaLocationsBean.class, GoodConfigForValidationTest.class, NodeIngestor.class,
+ CheckEverythingStrategy.class, DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
+@SpringBootTest
+public class NodeValidatorSunnyDayTest {
+ @Autowired
+ NodeValidator validator;
+
+ @Test
+ public void test() {
+ assertNotNull(validator); //check spring wiring ok
+ assertTrue(validator.validate());
+ assertTrue("No errors found.".equals(validator.getErrorMsg()));
+ }
+
+}