From 3aceb7c3254d2568e9aaf358af0143830b5c7916 Mon Sep 17 00:00:00 2001 From: Venkata Harish K Kajur Date: Thu, 17 Aug 2017 15:10:06 -0400 Subject: [AAI-191 Amsterdam] Refactor import statements Also regenerate the xsd, yaml and html files Change-Id: Ie7c6418c811d5ef70b8be5435b84eb5f31f3b31c Signed-off-by: Venkata Harish K Kajur --- .../aai/introspection/sideeffect/DataCopyTest.java | 5 +++-- .../aai/introspection/sideeffect/DataLinkTest.java | 9 +++++---- .../aai/parsers/query/GraphTraversalTest.java | 7 +++---- .../query/RelationshipGremlinQueryTest.java | 4 ++-- .../aai/serialization/db/DbAliasTest.java | 23 +++++++++++----------- .../aai/serialization/db/EdgeRulesTest.java | 9 +-------- .../tinkerpop/TreeBackedVertexTest.java | 22 ++++++++++----------- 7 files changed, 36 insertions(+), 43 deletions(-) (limited to 'aai-core/src/test/java') diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java index 0a66c481..0d40f89f 100644 --- a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java @@ -51,6 +51,7 @@ import org.openecomp.aai.introspection.Version; import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; import org.openecomp.aai.parsers.query.QueryParser; import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.db.EdgeProperty; import org.openecomp.aai.serialization.engines.QueryStyle; import org.openecomp.aai.serialization.engines.TitanDBEngine; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; @@ -90,9 +91,9 @@ public class DataCopyTest { loader); graph.traversal().addV("aai-node-type", "model", "model-invariant-id", "key1").as("v1") - .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key2", "model-version", "testValue").addInE("has", "v1", "isParent", true) + .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key2", "model-version", "testValue").addInE("has", "v1", EdgeProperty.CONTAINS.toString(), true) .addV("aai-node-type", "model", "model-invariant-id", "key3").as("v2") - .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key4").addInE("has", "v2", "isParent", true) + .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key4").addInE("has", "v2", EdgeProperty.CONTAINS.toString(), true) .next(); graph.tx().commit(); } diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java index ef3c3e47..4aafe460 100644 --- a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java @@ -48,6 +48,7 @@ import org.openecomp.aai.introspection.ModelType; import org.openecomp.aai.introspection.Version; import org.openecomp.aai.parsers.query.QueryParser; import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.db.EdgeProperty; import org.openecomp.aai.serialization.engines.QueryStyle; import org.openecomp.aai.serialization.engines.TitanDBEngine; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; @@ -88,13 +89,13 @@ public class DataLinkTest { graph.traversal().addV("aai-node-type", "vpn-binding", "vpn-id", "addKey").as("v1") .addV("aai-node-type", "vpn-binding", "vpn-id", "modifyKey").as("v2") - .addV("aai-node-type", "route-target", "global-route-target", "modifyTargetKey", "route-target-role", "modifyRoleKey", "linked", true).addInE("has", "v2", "isParent", true) + .addV("aai-node-type", "route-target", "global-route-target", "modifyTargetKey", "route-target-role", "modifyRoleKey", "linked", true).addInE("has", "v2", EdgeProperty.CONTAINS.toString(), true) .addV("aai-node-type", "vpn-binding", "vpn-id", "deleteKey").as("v3") - .addV("aai-node-type", "route-target", "global-route-target", "deleteTargetKey", "route-target-role", "deleteRoleKey", "linked", true).addInE("has", "v3", "isParent", true) + .addV("aai-node-type", "route-target", "global-route-target", "deleteTargetKey", "route-target-role", "deleteRoleKey", "linked", true).addInE("has", "v3", EdgeProperty.CONTAINS.toString(), true) .addV("aai-node-type", "vpn-binding", "vpn-id", "getKey").as("v4") - .addV("aai-node-type", "route-target", "global-route-target", "getTargetKey", "route-target-role", "getRoleKey", "linked", true).addInE("has", "v4", "isParent", true) + .addV("aai-node-type", "route-target", "global-route-target", "getTargetKey", "route-target-role", "getRoleKey", "linked", true).addInE("has", "v4", EdgeProperty.CONTAINS.toString(), true) .addV("aai-node-type", "vpn-binding", "vpn-id", "getKeyNoLink").as("v5") - .addV("aai-node-type", "route-target", "global-route-target", "getTargetKeyNoLink", "route-target-role", "getRoleKeyNoLink").addInE("has", "v5", "isParent", true) + .addV("aai-node-type", "route-target", "global-route-target", "getTargetKeyNoLink", "route-target-role", "getRoleKeyNoLink").addInE("has", "v5", EdgeProperty.CONTAINS.toString(), true) .next(); graph.tx().commit(); } diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java index 09d5e9ad..b22a98e6 100644 --- a/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java @@ -56,7 +56,6 @@ import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; import org.openecomp.aai.util.AAIConstants; - @Ignore public class GraphTraversalTest { @@ -489,7 +488,7 @@ public class GraphTraversalTest { QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); GraphTraversal expected = __.start() - .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "vpe", "generic-vnf")); + .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "generic-vnf")); GraphTraversal expectedParent = expected; assertEquals( @@ -535,11 +534,11 @@ public class GraphTraversalTest { QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); GraphTraversal expected = __.start() - .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "vpe", "generic-vnf")) + .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "generic-vnf")) .union(__.out("has").has(AAIProperties.NODE_TYPE, "vf-module")).has("vf-module-id", "key2"); GraphTraversal expectedParent = __.start() - .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "vpe", "generic-vnf")); + .has("vnf-id", "key1").has(AAIProperties.NODE_TYPE, P.within("vce", "generic-vnf")); assertEquals( "gremlin query should be " + expected.toString(), expected.toString(), diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java index b3385e32..3ab45379 100644 --- a/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java @@ -566,11 +566,11 @@ public class RelationshipGremlinQueryTest { String expected = ".has('vnf-id', 'key1')" - + ".has('aai-node-type', P.within('vce','vpe','generic-vnf'))"; + + ".has('aai-node-type', P.within('vce','generic-vnf'))"; String expectedParent = ".has('vnf-id', 'key1')" - + ".has('aai-node-type', P.within('vce','vpe','generic-vnf'))"; + + ".has('aai-node-type', P.within('vce','generic-vnf'))"; assertEquals( "gremlin query should be " + expected, diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java index cc419c67..c96450c2 100644 --- a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java @@ -34,6 +34,7 @@ import java.util.Map; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.junit.After; import org.junit.Before; @@ -57,9 +58,6 @@ import com.thinkaurelius.titan.core.TitanGraph; @Ignore public class DbAliasTest { - - - private TitanGraph graph; private final Version version = Version.v9; private final ModelType introspectorFactoryType = ModelType.MOXY; @@ -78,13 +76,13 @@ public class DbAliasTest { type, loader); } - + @After public void tearDown() { graph.tx().rollback(); graph.close(); } - + @Test public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException { final String property = "persona-model-customization-id"; @@ -109,17 +107,17 @@ public class DbAliasTest { if (map.containsKey(PropertyMetadata.DB_ALIAS)) { dbPropertyName = map.get(PropertyMetadata.DB_ALIAS); } - + assertEquals("dbAlias is ", "model-customization-id", dbPropertyName); assertEquals("dbAlias property exists", "hello", v.property(dbPropertyName).orElse("")); assertEquals("model property does not", "missing", v.property(property).orElse("missing")); - + } - + @Test public void checkOnRead() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException, MalformedURLException { final String property = "persona-model-customization-id"; - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); Vertex v = graph.traversal().addV("vnf-id", "key1", "model-customization-id", "hello").next(); @@ -131,9 +129,10 @@ public class DbAliasTest { DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); Introspector obj = loader.introspectorFromName("generic-vnf"); serializer.dbToObject(Collections.singletonList(v), obj, 0, true, "false"); - + assertEquals("dbAlias property exists", "hello", obj.getValue(property)); - + } - + + } diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java index 3236a68c..faa4d28e 100644 --- a/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java @@ -26,13 +26,11 @@ import java.util.Map; import org.apache.tinkerpop.gremlin.structure.Direction; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Version; import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; -@Ignore public class EdgeRulesTest { @BeforeClass @@ -94,10 +92,5 @@ public class EdgeRulesTest { assertEquals(true, EdgeRules.getInstance(Version.v8).hasEdgeRule("pserver", "complex")); assertEquals(false, EdgeRules.getInstance(Version.v8).hasEdgeRule("model-element", "model-ver")); } - - @Test - public void verifyOldEdgeDeleteSemantics() throws AAIException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { -// assertEquals(DeleteSemantic.ERROR_4_IN_EDGES_OR_CASCADE, EdgeRules.getInstance().getDeleteSemantic("model")); -// assertEquals(DeleteSemantic.CASCADE_TO_CHILDREN, EdgeRules.getInstance(Version.v8).getDeleteSemantic("model")); - } + } diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java index 6b9a9178..7a0a1693 100644 --- a/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java @@ -31,9 +31,9 @@ import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; import org.junit.BeforeClass; -import org.junit.Test; import org.junit.Ignore; - +import org.junit.Test; +import org.openecomp.aai.serialization.db.EdgeProperty; import org.openecomp.aai.serialization.engines.query.GraphTraversalQueryEngine; @Ignore @@ -51,15 +51,15 @@ public class TreeBackedVertexTest { startKey = g.addV(T.label, "vserver").as("v1").property("test", "hello") .addV(T.label, "vserver").as("v2") - .addV(T.label, "interface").property("name", "interface 1").as("v7").addInE("hasChild", "v2").property("isParent", true) - .addV(T.label, "pserver").property("name", "pserver 1").as("v4").addOutE("runsOn", "v1").property("isParent", false) - .addV(T.label, "interface").property("name", "interface 2").as("v3").addInE("hasChild", "v1").property("isParent", true) - .addV(T.label, "address").property("name", "address 1").addInE("hasChild", "v3").property("isParent", true) - .addV(T.label, "address").property("name", "address 2").addInE("hasChild", "v3").property("isParent", true) - .addV(T.label, "complex").property("name", "complex 1").addInE("locatedIn", "v4").property("isParent", false) - .addV(T.label, "interface").property("name", "interface 3").addInE("hasChild", "v4").property("isParent", true) - .addV(T.label, "subnet").property("name", "subnet 1").as("v5").addInE("in", "v3").property("isParent", false) - .addV(T.label, "address").property("name", "address 3").as("v6").addInE("hasChild", "v5").property("isParent", true) + .addV(T.label, "interface").property("name", "interface 1").as("v7").addInE("hasChild", "v2").property(EdgeProperty.CONTAINS.toString(), true) + .addV(T.label, "pserver").property("name", "pserver 1").as("v4").addOutE("runsOn", "v1").property(EdgeProperty.CONTAINS.toString(), false) + .addV(T.label, "interface").property("name", "interface 2").as("v3").addInE("hasChild", "v1").property(EdgeProperty.CONTAINS.toString(), true) + .addV(T.label, "address").property("name", "address 1").addInE("hasChild", "v3").property(EdgeProperty.CONTAINS.toString(), true) + .addV(T.label, "address").property("name", "address 2").addInE("hasChild", "v3").property(EdgeProperty.CONTAINS.toString(), true) + .addV(T.label, "complex").property("name", "complex 1").addInE("locatedIn", "v4").property(EdgeProperty.CONTAINS.toString(), false) + .addV(T.label, "interface").property("name", "interface 3").addInE("hasChild", "v4").property(EdgeProperty.CONTAINS.toString(), true) + .addV(T.label, "subnet").property("name", "subnet 1").as("v5").addInE("in", "v3").property(EdgeProperty.CONTAINS.toString(), false) + .addV(T.label, "address").property("name", "address 3").as("v6").addInE("hasChild", "v5").property(EdgeProperty.CONTAINS.toString(), true) .select("v1").next(); tree = new GraphTraversalQueryEngine(g).findSubGraph((Vertex)startKey); -- cgit 1.2.3-korg