diff options
Diffstat (limited to 'aai-core/src/test/java')
17 files changed, 589 insertions, 60 deletions
diff --git a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java index 4c472ccc..fbff5d06 100644 --- a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java +++ b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java @@ -19,9 +19,9 @@ */ package org.onap.aai.dbmap; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; import org.hamcrest.CoreMatchers; import org.junit.*; import org.onap.aai.AAISetup; @@ -44,7 +44,7 @@ public class AAIGraphTest extends AAISetup{ @Test public void getRealtimeInstanceConnectionName() throws Exception { - TitanManagement graphMgt = AAIGraph.getInstance().getGraph().openManagement(); + JanusGraphManagement graphMgt = AAIGraph.getInstance().getGraph().openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName, containsString(SERVICE_NAME)); assertThat(connectionInstanceName, containsString("realtime")); @@ -55,7 +55,7 @@ public class AAIGraphTest extends AAISetup{ @Test public void getCachedInstanceConnectionName() throws Exception { - TitanManagement graphMgt = AAIGraph.getInstance().getGraph(DBConnectionType.CACHED).openManagement(); + JanusGraphManagement graphMgt = AAIGraph.getInstance().getGraph(DBConnectionType.CACHED).openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName, containsString(SERVICE_NAME)); assertThat(connectionInstanceName, containsString("cached")); @@ -64,9 +64,9 @@ public class AAIGraphTest extends AAISetup{ } @Test - public void titanGraphOpenNameTest() throws Exception{ - TitanGraph graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(SERVICE_NAME).withGraphType("graphType").buildConfiguration()); - TitanManagement graphMgt = graph.openManagement(); + public void JanusGraphOpenNameTest() throws Exception{ + JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(SERVICE_NAME).withGraphType("graphType").buildConfiguration()); + JanusGraphManagement graphMgt = graph.openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName,matchesPattern("^\\d+_[\\w\\-\\d]+_" + SERVICE_NAME + "_graphType_\\d+\\(current\\)$")); graphMgt.rollback(); diff --git a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java index 27efbdb2..621f24d8 100644 --- a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java +++ b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.introspection.sideeffect; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.apache.commons.io.IOUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -41,7 +41,7 @@ import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeProperty; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.FileInputStream; @@ -60,7 +60,7 @@ import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DataCopyTest { - private static TitanGraph graph; + private static JanusGraph graph; private final static Version version = Version.getLatest(); private final static ModelType introspectorFactoryType = ModelType.MOXY; private final static DBConnectionType type = DBConnectionType.REALTIME; @@ -84,7 +84,7 @@ public class DataCopyTest { @BeforeClass public static void setup() throws NoSuchFieldException, SecurityException, Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); @@ -107,7 +107,7 @@ public class DataCopyTest { @Before public void initMock() { MockitoAnnotations.initMocks(this); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); diff --git a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java index 59fe8b86..d44c6cc3 100644 --- a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java +++ b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java @@ -19,12 +19,17 @@ */ package org.onap.aai.introspection.sideeffect; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.janusgraph.core.JanusGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; import org.junit.*; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; @@ -37,10 +42,11 @@ import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; +import org.onap.aai.serialization.db.AAIDirection; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeProperty; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -49,16 +55,17 @@ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.Arrays; import java.util.Collection; +import java.util.Iterator; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DataLinkTest extends AAISetup { - private static TitanGraph graph; + private static JanusGraph graph; private final static Version version = Version.getLatest(); private final static ModelType introspectorFactoryType = ModelType.MOXY; private final static DBConnectionType type = DBConnectionType.REALTIME; @@ -82,7 +89,7 @@ public class DataLinkTest extends AAISetup { @BeforeClass public static void setup() throws NoSuchFieldException, SecurityException, Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); graph.traversal().addV("aai-node-type", "vpn-binding", "vpn-id", "addKey", AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/addKey").as("v1") @@ -113,7 +120,7 @@ public class DataLinkTest extends AAISetup { @Before public void initMock() { MockitoAnnotations.initMocks(this); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); @@ -131,6 +138,24 @@ public class DataLinkTest extends AAISetup { TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); Graph g = graph.newTransaction(); GraphTraversalSource traversal = g.traversal(); +// Graph g = graph.newTransaction(); +// GraphTraversalSource traversal = g; + System.out.println("Begin method inventory:"); + Iterator<Vertex> vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+";id= "+v.id()); + } + Direction d = null; + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(spy.tx()).thenReturn(g); @@ -158,23 +183,80 @@ public class DataLinkTest extends AAISetup { obj.setValue("route-target-role", "modifyRoleKey2"); TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); +// Graph g = graph.newTransaction(); +// GraphTraversalSource traversal = g; Graph g = graph.newTransaction(); GraphTraversalSource traversal = g.traversal(); + System.out.println("Begin method inventory:"); + Iterator<Vertex> vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Direction d = null; + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); + when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); +// when(spy.tx()).thenReturn(graph); when(spy.tx()).thenReturn(g); when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); when(prop.orElse(null)).thenReturn(obj.getURI()); DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); SideEffectRunner runner = new SideEffectRunner .Builder(spy, serializer).addSideEffect(DataLinkWriter.class).build(); - + System.out.println("Traversal Source: "+traversal.toString()); + vertexItr = traversal.V(); + System.out.println("Begin method inventory:"); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); + try { runner.execute(obj, self); + } catch(Exception e) { - assertEquals("route-target vertex found", true, traversal.V() - .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext()); - assertEquals("previous link removed", true, traversal.V() - .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNot("linked").hasNext()); + } +// runner.execute(obj, self); + System.out.println("=================\n"); + vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + assertThat("new route-target vertex found with/or without link", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").hasNext(),is(true)); + assertThat("new route-target vertex found", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext(),is(true)); + assertThat("previous link removed", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").has("linked").hasNext(),is(not(true))); + assertThat("previous vertex still exists", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNext(),is(true)); g.tx().rollback(); } diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java index 02e9efa1..e901c65f 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java @@ -37,7 +37,7 @@ import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.rest.RestTokens; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.MultivaluedHashMap; @@ -82,12 +82,12 @@ public class GraphTraversalTest extends AAISetup { @Before public void configure() throws Exception { dbEngine = - new TitanDBEngine(queryStyle, + new JanusGraphDBEngine(queryStyle, LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST), false); dbEnginev9 = - new TitanDBEngine(queryStyle, + new JanusGraphDBEngine(queryStyle, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9), false); } diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java new file mode 100644 index 00000000..f56d6f62 --- /dev/null +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java @@ -0,0 +1,447 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (C) 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========================================================= + */ + +/*package org.onap.aai.parsers.query; + +import static org.hamcrest.CoreMatchers.startsWith; +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.onap.aai.db.AAIProperties; +import org.onap.aai.exceptions.AAIException; +import org.onap.aai.introspection.LoaderFactory; +import org.onap.aai.introspection.ModelType; +import org.onap.aai.introspection.Version; +import org.onap.aai.logging.LogLineBuilder; +import org.onap.aai.serialization.engines.QueryStyle; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; +import org.onap.aai.serialization.engines.TransactionalGraphEngine; + +import com.tinkerpop.gremlin.java.GremlinPipeline; +import com.tinkerpop.pipes.IdentityPipe; + +public class GremlinPipelineTraversalTest { + + private TransactionalGraphEngine dbEngine = + new JanusGraphDBEngine(QueryStyle.GREMLINPIPELINE_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v7, new LogLineBuilder("TEST", "TEST")), + false); + + private TransactionalGraphEngine dbEnginev6 = + new JanusGraphDBEngine(QueryStyle.GREMLINPIPELINE_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v6, new LogLineBuilder("TEST", "TEST")), + false); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + @Test + public void parentQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V().has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getResultType()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals("dependent",false, query.isDependent()); + + + } + + @Test + public void childQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("physical-location-id", "key1").has("aai-node-type", "complex") + .in("org.onap.relationships.inventory.BelongsTo") + .has("target-pe", "key2").has("availability-zone-name", "key3"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for complex", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getParentResultType()); + assertEquals( + "result type should be ctag-pool", + "ctag-pool", + query.getResultType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void namingExceptions() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("cvlan-tag", 655); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "contaner type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void getAll() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("aai-node-type", "cvlan-tag"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void getItemAffectedByDefaultCloudRegion() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + QueryParser query = dbEnginev6.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25") + .in("org.onap.relationships.inventory.BelongsTo") + .has("tenant-id", "key1") + .in("org.onap.relationships.inventory.BelongsTo") + .has("vserver-id", "key2") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-name", "key3"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25") + .in("org.onap.relationships.inventory.BelongsTo") + .has("tenant-id", "key1") + .in("org.onap.relationships.inventory.BelongsTo") + .has("vserver-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for vserver", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be vserver", + "vserver", + query.getParentResultType()); + assertEquals( + "result type should be l-interface", + "l-interface", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/tenants/tenant").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + + .has("tenant-name", "Tenant1"); + + .has("tenant-name", "Tenant2"); + + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for cloud-region", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be cloud-region", + "cloud-region", + query.getParentResultType()); + assertEquals( + "result type should be tenant", + "tenant", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getPluralViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vnfcs").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("prov-status", "up"); + QueryParser query = dbEnginev6.getQueryBuilder().createQueryFromURI(uri, map); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("aai-node-type", "vnfc") + .has("prov-status", "up"); + + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("aai-node-type", "vnfc"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "parent result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnfc", + "vnfc", + query.getResultType()); + assertEquals( + "container type should be empty", + "vnfcs", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getAllQueryParamNamingException() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("cvlan-tag", "333"); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("aai-node-type", "cvlan-tag") + .has("cvlan-tag", 333); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void abstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")); + + GremlinPipeline expectedParent = expected; + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnf", + "vnf", + query.getResultType()); + + assertEquals("dependent",false, query.isDependent()); + + + } + + @Test + public void nonParentAbstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers/pserver/key2/vnf/key1").build(); + thrown.expect(AAIException.class); + thrown.expectMessage(startsWith("AAI_3001")); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + + + } + + @Test + public void parentAbstractTypeWithNesting() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1/vf-modules/vf-module/key2").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")) + .outE().has("isParent", true).inV().has("vf-module-id", "key2"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for ", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be vnf", + "vnf", + query.getParentResultType()); + assertEquals( + "result type should be vf-module", + "vf-module", + query.getResultType()); + + assertEquals("dependent",true, query.isDependent()); + + } +} +*/ diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java index 1a4a2fbd..a2bcf6d0 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java @@ -29,7 +29,7 @@ import org.onap.aai.introspection.ModelInjestor; import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.UriBuilder; @@ -46,7 +46,7 @@ public class LegacyQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java index 9c853e23..19c48801 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java @@ -30,7 +30,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -47,7 +47,7 @@ public class RelationshipGremlinQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java index 597c6675..c92cab27 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java @@ -28,7 +28,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -45,7 +45,7 @@ public class RelationshipQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java index 8a0c727f..1430b87d 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java @@ -32,7 +32,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -48,7 +48,7 @@ public class UniqueRelationshipQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java index 735785b7..edb80bfb 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java @@ -32,7 +32,7 @@ import org.onap.aai.introspection.ModelInjestor; import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.UriBuilder; @@ -46,7 +46,7 @@ public class UniqueURIQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java index 9cdab403..6d45d947 100644 --- a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java +++ b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java @@ -19,7 +19,7 @@ */ package org.onap.aai.query.builder; -import com.thinkaurelius.titan.core.TitanFactory; +import org.janusgraph.core.JanusGraphFactory; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; @@ -56,7 +56,7 @@ public abstract class QueryBuilderTestAbstraction extends AAISetup { @BeforeClass public static void setup() throws Exception { loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); - graph = TitanFactory.build().set("storage.backend", "inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); } @Before diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java index 27d14c94..a2bf5876 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -36,7 +36,7 @@ import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.schema.enums.PropertyMetadata; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -56,7 +56,7 @@ import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DbAliasTest extends AAISetup { - private TitanGraph graph; + private JanusGraph graph; private final Version version = Version.v9; private final ModelType introspectorFactoryType = ModelType.MOXY; @@ -76,9 +76,9 @@ public class DbAliasTest extends AAISetup { @Before public void setup() throws Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java index 3cf43b4a..77513aa3 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanFactory; +import org.janusgraph.core.JanusGraphFactory; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.*; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; @@ -34,7 +34,7 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -80,7 +80,7 @@ public class DbSerializerTest extends AAISetup { @BeforeClass public static void init() throws Exception { - graph = TitanFactory.build().set("storage.backend", "inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); } @@ -88,12 +88,12 @@ public class DbSerializerTest extends AAISetup { public void setup() throws Exception { //createGraph(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - dbEngine = new TitanDBEngine(queryStyle, type, loader); + dbEngine = new JanusGraphDBEngine(queryStyle, type, loader); spy = spy(dbEngine); adminSpy = spy(dbEngine.asAdmin()); - engine = new TitanDBEngine(queryStyle, type, loader); + engine = new JanusGraphDBEngine(queryStyle, type, loader); dbser = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST"); } diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java index 606b6f69..0bdfa150 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java @@ -47,7 +47,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -142,7 +142,7 @@ public class CountQuerySupportTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); serializer = new DBSerializer(version, dbEngine, factoryType, "Junit"); ff = new FormatFactory(loader, serializer); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java index c6aedf9e..27fd78ad 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java @@ -49,7 +49,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -155,7 +155,7 @@ public class MultiFormatTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); TransactionalGraphEngine.Admin spyAdmin = spy(dbEngine.asAdmin()); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java index 5633e4cb..8f4fd359 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java @@ -43,7 +43,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -112,7 +112,7 @@ public class RawFormatTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); serializer = new DBSerializer(version, dbEngine, factoryType, "Junit"); rawFormat = new RawFormat.Builder(loader, serializer, urlBuilder).build(); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java index 23c8abf2..7636b8d7 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java @@ -41,7 +41,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.introspection.exceptions.AAIUnknownObjectException; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import org.onap.aai.serialization.queryformats.utils.UrlBuilder; @@ -149,7 +149,7 @@ public class SimpleFormatTest extends AAISetup { if(loader == null){ loader = LoaderFactory.createLoaderForVersion(factoryType, Version.v10); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); TransactionalGraphEngine.Admin spyAdmin = spy(dbEngine.asAdmin()); |