diff options
Diffstat (limited to 'catalog-dao/src/test')
8 files changed, 295 insertions, 296 deletions
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java index 83b68920b9..c0d9e4644c 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java @@ -17,10 +17,10 @@ package org.openecomp.sdc.be.dao.cassandra; import com.google.common.collect.ImmutableListMultimap; -import com.thinkaurelius.titan.core.TitanVertex; -import com.thinkaurelius.titan.graphdb.relations.StandardVertexProperty; -import com.thinkaurelius.titan.graphdb.types.system.EmptyVertex; -import com.thinkaurelius.titan.graphdb.types.system.ImplicitKey; +import org.janusgraph.core.JanusGraphVertex; +import org.janusgraph.graphdb.relations.StandardVertexProperty; +import org.janusgraph.graphdb.types.system.EmptyVertex; +import org.janusgraph.graphdb.types.system.ImplicitKey; import java.util.HashMap; import org.junit.Test; import org.mockito.Mockito; @@ -85,7 +85,7 @@ public class HealingPipelineDaoTest { } @Test - public void testPipelineFilter3AttributesTitanVertex() { + public void testPipelineFilter3AttributesJanusGraphVertex() { // init data HealingPipelineDao healingPipelineDao = new HealingPipelineDao(); healingPipelineDao.setHealVersion(7); @@ -95,16 +95,16 @@ public class HealingPipelineDaoTest { assertEquals(2, healingPipelineDao.getHealersForVertex(GraphEdgeLabels.CAPABILITY.getProperty(), HealVersionBuilder.build(5)).size()); - TitanVertex titanVertex = Mockito.mock(TitanVertex.class); + JanusGraphVertex janusGraphVertex = Mockito.mock(JanusGraphVertex.class); final int version = 5; StandardVertexProperty vertexProperty = new StandardVertexProperty(1, ImplicitKey.ID, new EmptyVertex(), version, (byte) 1); - Mockito.when(titanVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty())).thenReturn(vertexProperty); + Mockito.when(janusGraphVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty())).thenReturn(vertexProperty); // perform test - Optional optional = healingPipelineDao.performGraphReadHealing(titanVertex, GraphEdgeLabels.CAPABILITY); + Optional optional = healingPipelineDao.performGraphReadHealing(janusGraphVertex, GraphEdgeLabels.CAPABILITY); assertTrue(optional.isPresent()); - final TitanVertex changedVertex = (TitanVertex) optional.get(); + final JanusGraphVertex changedVertex = (JanusGraphVertex) optional.get(); //validate result assertNotNull(changedVertex); @@ -112,7 +112,7 @@ public class HealingPipelineDaoTest { } @Test - public void testPipelineFilterGenericTitanDao() { + public void testPipelineFilterGenericJanusGraphDao() { // init data HealingPipelineDao healingPipelineDao = new HealingPipelineDao(); healingPipelineDao.setHealVersion(7); @@ -140,7 +140,7 @@ public class HealingPipelineDaoTest { } @Test - public void testPipelineFilterTitanGraph1Attributes() { + public void testPipelineFilterJanusGraph1Attributes() { // init data HealingPipelineDao healingPipelineDao = new HealingPipelineDao(); healingPipelineDao.setHealVersion(7); @@ -217,9 +217,9 @@ public class HealingPipelineDaoTest { .put(GraphEdgeLabels.ATTRIBUTE.getProperty(), new GraphNodeHealTestMock(4)) .put(GraphEdgeLabels.ATTRIBUTE.getProperty(), new GraphNodeHealTestMock(5)) .put(GraphEdgeLabels.ATTRIBUTE.getProperty(), new GraphNodeHealTestMock(6)) - .put(GraphEdgeLabels.CAPABILITY.getProperty(), new TitanVertexHealTestMock(4)) - .put(GraphEdgeLabels.CAPABILITY.getProperty(), new TitanVertexHealTestMock(5)) - .put(GraphEdgeLabels.CAPABILITY.getProperty(), new TitanVertexHealTestMock(6)).build(); + .put(GraphEdgeLabels.CAPABILITY.getProperty(), new JanusGraphVertexHealTestMock(4)) + .put(GraphEdgeLabels.CAPABILITY.getProperty(), new JanusGraphVertexHealTestMock(5)) + .put(GraphEdgeLabels.CAPABILITY.getProperty(), new JanusGraphVertexHealTestMock(6)).build(); } public GraphEdge createGraphEdge(GraphEdgeLabels graphEdgeLabels){ @@ -247,7 +247,7 @@ public class HealingPipelineDaoTest { } - private class GraphNodeHealTestMock extends AbstractTitanVertexHeal { + private class GraphNodeHealTestMock extends AbstractJanusGraphVertexHeal { private HealVersion healVersion; public GraphNodeHealTestMock(int i) { @@ -266,10 +266,10 @@ public class HealingPipelineDaoTest { } - private class TitanVertexHealTestMock implements Heal<TitanVertex> { + private class JanusGraphVertexHealTestMock implements Heal<JanusGraphVertex> { private HealVersion healVersion; - public TitanVertexHealTestMock(int i) { + public JanusGraphVertexHealTestMock(int i) { healVersion = HealVersionBuilder.build(i); } @@ -279,7 +279,7 @@ public class HealingPipelineDaoTest { } @Override - public void healData(TitanVertex parentV) { + public void healData(JanusGraphVertex parentV) { } } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtilsTest.java index 641eec5773..b3fd59e8b6 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtilsTest.java @@ -1,21 +1,21 @@ -package org.openecomp.sdc.be.dao.titan; +package org.openecomp.sdc.be.dao.janusgraph; -import com.thinkaurelius.titan.graphdb.query.TitanPredicate; +import org.janusgraph.graphdb.query.JanusGraphPredicate; import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Test; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; -public class TitanUtilsTest { +public class JanusGraphUtilsTest { @Test public void testBuildNotInPredicate() throws Exception { String propKey = ""; Collection<T> notInCollection = null; - Map<String, Entry<TitanPredicate, Object>> result; + Map<String, Entry<JanusGraphPredicate, Object>> result; // default test - result = TitanUtils.buildNotInPredicate(propKey, notInCollection); + result = JanusGraphUtils.buildNotInPredicate(propKey, notInCollection); } }
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java index b336bc65e9..8ce20191fd 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.be.dao.jsongraph; -import com.thinkaurelius.titan.core.TitanVertex; +import org.janusgraph.core.JanusGraphVertex; import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -70,7 +70,7 @@ public class GraphVertexTest { @Test public void testGetVertex() throws Exception { GraphVertex testSubject; - TitanVertex result; + JanusGraphVertex result; // default test testSubject = createTestSubject(); @@ -81,7 +81,7 @@ public class GraphVertexTest { @Test public void testSetVertex() throws Exception { GraphVertex testSubject; - TitanVertex vertex = null; + JanusGraphVertex vertex = null; // default test testSubject = createTestSubject(); diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoMockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java index 5703e53c9c..72a9d54336 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoMockTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java @@ -1,7 +1,7 @@ package org.openecomp.sdc.be.dao.jsongraph; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphVertex; import fj.data.Either; import mockit.Deencapsulation; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -15,12 +15,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import java.util.HashMap; @@ -28,13 +28,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -public class TitanDaoMockTest { +public class JanusGraphDaoMockTest { @InjectMocks - TitanDao testSubject; + JanusGraphDao testSubject; @Mock - TitanGraphClient titanClient; + JanusGraphClient janusGraphClient; @Before public void setUp() throws Exception { @@ -43,7 +43,7 @@ public class TitanDaoMockTest { @Test public void testCommit() throws Exception { - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test result = testSubject.commit(); @@ -51,7 +51,7 @@ public class TitanDaoMockTest { @Test public void testRollback() throws Exception { - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test result = testSubject.rollback(); @@ -60,7 +60,7 @@ public class TitanDaoMockTest { @Test public void testGetGraph() throws Exception { - Either<TitanGraph, TitanOperationStatus> result; + Either<JanusGraph, JanusGraphOperationStatus> result; // default test @@ -72,14 +72,14 @@ public class TitanDaoMockTest { GraphVertex graphVertex = new GraphVertex(); graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; - TitanGraph tg = Mockito.mock(TitanGraph.class); - Either<TitanGraph, TitanOperationStatus> value = Either.left(tg); + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg); // default test - TitanVertex value2 = Mockito.mock(TitanVertex.class); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); result = testSubject.createVertex(graphVertex); } @@ -88,11 +88,11 @@ public class TitanDaoMockTest { GraphVertex graphVertex = new GraphVertex(); graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); // default test - Mockito.when(titanClient.getGraph()).thenReturn(value); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); result = testSubject.createVertex(graphVertex); } @@ -101,35 +101,35 @@ public class TitanDaoMockTest { GraphVertex graphVertex = new GraphVertex(); graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; - TitanGraph tg = Mockito.mock(TitanGraph.class); - Either<TitanGraph, TitanOperationStatus> value = Either.left(tg); + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg); // default test Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); result = testSubject.createVertex(graphVertex); } @Test public void testGetVertexByPropertyAndLabel() throws Exception { - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test - Mockito.when(titanClient.getGraph()).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR)); + Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)); result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock", VertexTypeEnum.ADDITIONAL_INFORMATION); } @Test public void testGetFirstFoundVertex() throws Exception { - Iterable<TitanVertex> vertices = Mockito.mock(Iterable.class); - Either<GraphVertex, TitanOperationStatus> result; + Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class); + Either<GraphVertex, JanusGraphOperationStatus> result; - Iterator<TitanVertex> value = Mockito.mock(Iterator.class); + Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class); Mockito.when(vertices.iterator()).thenReturn(value); Mockito.when(value.hasNext()).thenReturn(true); - TitanVertex value2 = Mockito.mock(TitanVertex.class); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); Mockito.when(value.next()).thenReturn(value2); // default test @@ -138,13 +138,13 @@ public class TitanDaoMockTest { @Test public void testGetFirstFoundVertexNotFound() throws Exception { - Iterable<TitanVertex> vertices = Mockito.mock(Iterable.class); - Either<GraphVertex, TitanOperationStatus> result; + Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class); + Either<GraphVertex, JanusGraphOperationStatus> result; - Iterator<TitanVertex> value = Mockito.mock(Iterator.class); + Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class); Mockito.when(vertices.iterator()).thenReturn(value); Mockito.when(value.hasNext()).thenReturn(false); - TitanVertex value2 = Mockito.mock(TitanVertex.class); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); Mockito.when(value.next()).thenReturn(value2); // default test @@ -155,14 +155,14 @@ public class TitanDaoMockTest { public void testGetVertexById_1Exception() throws Exception { String id = "mock"; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; - TitanGraph tg = Mockito.mock(TitanGraph.class); - Either<TitanGraph, TitanOperationStatus> value = Either.left(tg); + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg); // default test - TitanVertex value2 = Mockito.mock(TitanVertex.class); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // test 1 result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); @@ -173,13 +173,13 @@ public class TitanDaoMockTest { public void testGetVertexById_1GraphClosed() throws Exception { String id = "mock"; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; Object b; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); // default test - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // test 1 result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); @@ -199,7 +199,7 @@ public class TitanDaoMockTest { @Test public void testCreateAndFill() throws Exception { - TitanVertex vertex = Mockito.mock(TitanVertex.class); + JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); JsonParseFlagEnum parseFlag = null; GraphVertex result; @@ -212,7 +212,7 @@ public class TitanDaoMockTest { public void testParseVertexProperties() throws Exception { GraphVertex graphVertex = new GraphVertex(); - TitanVertex vertex = Mockito.mock(TitanVertex.class); + JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); graphVertex.setVertex(vertex); JsonParseFlagEnum parseFlag = null; @@ -228,11 +228,11 @@ public class TitanDaoMockTest { GraphVertex from = Mockito.mock(GraphVertex.class); GraphVertex to = Mockito.mock(GraphVertex.class); - TitanVertex value = Mockito.mock(TitanVertex.class); + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); Mockito.when(from.getVertex()).thenReturn(value); Mockito.when(to.getVertex()).thenReturn(value); Map<EdgePropertyEnum, Object> properties = new HashMap<>(); - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -257,13 +257,13 @@ public class TitanDaoMockTest { @Test public void testGetByCriteria() throws Exception { Map<GraphPropertyEnum, Object> props = new HashMap<>(); - Either<List<GraphVertex>, TitanOperationStatus> result; + Either<List<GraphVertex>, JanusGraphOperationStatus> result; - TitanGraph tg = Mockito.mock(TitanGraph.class); - Either<TitanGraph, TitanOperationStatus> value = Either.left(tg); - TitanVertex value2 = Mockito.mock(TitanVertex.class); + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props); @@ -273,11 +273,11 @@ public class TitanDaoMockTest { public void testGetByCriteria_1() throws Exception { Map<GraphPropertyEnum, Object> props = new HashMap<>(); - Either<List<GraphVertex>, TitanOperationStatus> result; + Either<List<GraphVertex>, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse); @@ -285,12 +285,12 @@ public class TitanDaoMockTest { @Test public void testGetCatalogVerticies() throws Exception { - Either<Iterator<Vertex>, TitanOperationStatus> result; + Either<Iterator<Vertex>, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); // default test - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.getCatalogOrArchiveVerticies(true); @@ -302,11 +302,11 @@ public class TitanDaoMockTest { GraphVertex parentVertex = new GraphVertex(); EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse); @@ -318,11 +318,11 @@ public class TitanDaoMockTest { Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<Vertex, TitanOperationStatus> result; + Either<Vertex, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag); @@ -335,7 +335,7 @@ public class TitanDaoMockTest { Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<Vertex, TitanOperationStatus> result; + Either<Vertex, JanusGraphOperationStatus> result; // default test @@ -348,7 +348,7 @@ public class TitanDaoMockTest { Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<List<Vertex>, TitanOperationStatus> result; + Either<List<Vertex>, JanusGraphOperationStatus> result; // default test @@ -362,11 +362,11 @@ public class TitanDaoMockTest { EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; Direction direction = null; - Either<List<Vertex>, TitanOperationStatus> result; + Either<List<Vertex>, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = Deencapsulation.invoke(testSubject, "getAdjacentVerticies", new Object[] { Vertex.class, EdgeLabelEnum.class, JsonParseFlagEnum.class, Direction.class }); @@ -378,7 +378,7 @@ public class TitanDaoMockTest { Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<List<Vertex>, TitanOperationStatus> result; + Either<List<Vertex>, JanusGraphOperationStatus> result; // default test @@ -392,7 +392,7 @@ public class TitanDaoMockTest { GraphVertex vertex = null; EdgeLabelEnum label = null; Map<GraphPropertyEnum, Object> properties = null; - Either<Edge, TitanOperationStatus> result; + Either<Edge, JanusGraphOperationStatus> result; // default test @@ -404,11 +404,11 @@ public class TitanDaoMockTest { GraphVertex fromVertex = new GraphVertex(); GraphVertex toVertex = new GraphVertex(); - Either<Edge, TitanOperationStatus> result; + Either<Edge, JanusGraphOperationStatus> result; - Either<TitanGraph, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR); - TitanVertex value2 = Mockito.mock(TitanVertex.class); - Mockito.when(titanClient.getGraph()).thenReturn(value); + Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); // default test result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION); @@ -417,7 +417,7 @@ public class TitanDaoMockTest { @Test public void testDeleteEdgeByDirection() throws Exception { GraphVertex fromVertex = new GraphVertex(); - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION); @@ -426,9 +426,9 @@ public class TitanDaoMockTest { @Test public void testDeleteEdgeByDirectionMock() throws Exception { GraphVertex fromVertex = Mockito.mock(GraphVertex.class); - TitanOperationStatus result; + JanusGraphOperationStatus result; - TitanVertex value = Mockito.mock(TitanVertex.class);; + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);; Mockito.when(fromVertex.getVertex()).thenReturn(value); Iterator<Edge> value2 = Mockito.mock(Iterator.class);; Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2); @@ -443,7 +443,7 @@ public class TitanDaoMockTest { public void testUpdateVertex() throws Exception { GraphVertex graphVertex = new GraphVertex(); - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test @@ -454,7 +454,7 @@ public class TitanDaoMockTest { public void testGetVerticesByUniqueIdAndParseFlag() throws Exception { Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet = new HashMap<>(); - Either<Map<String, GraphVertex>, TitanOperationStatus> result; + Either<Map<String, GraphVertex>, JanusGraphOperationStatus> result; // default test result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet); @@ -475,7 +475,7 @@ public class TitanDaoMockTest { Vertex to = null; EdgeLabelEnum label = null; Edge edgeToCopy = null; - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -491,7 +491,7 @@ public class TitanDaoMockTest { Edge prevEdge = null; EdgeLabelEnum prevLabel = null; EdgeLabelEnum newLabel = null; - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -504,7 +504,7 @@ public class TitanDaoMockTest { Vertex vertex = Mockito.mock(Vertex.class);; Map<GraphPropertyEnum, Object> properties = new HashMap<>(); properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock"); - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -516,9 +516,9 @@ public class TitanDaoMockTest { public void testDisassociateAndDeleteLast() throws Exception { GraphVertex vertex = Mockito.mock(GraphVertex.class); - TitanOperationStatus result; + JanusGraphOperationStatus result; - TitanVertex value = Mockito.mock(TitanVertex.class); + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); Iterator<Edge> mockiter = Mockito.mock(Iterator.class); Edge nextmock = Mockito.mock(Edge.class); Mockito.when(vertex.getVertex()).thenReturn(value); @@ -540,9 +540,9 @@ public class TitanDaoMockTest { public void testDisassociateAndDeleteLastOut() throws Exception { GraphVertex vertex = Mockito.mock(GraphVertex.class); - TitanOperationStatus result; + JanusGraphOperationStatus result; - TitanVertex value = Mockito.mock(TitanVertex.class); + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); Iterator<Edge> mockiter = Mockito.mock(Iterator.class); Edge nextmock = Mockito.mock(Edge.class); Mockito.when(vertex.getVertex()).thenReturn(value); @@ -564,7 +564,7 @@ public class TitanDaoMockTest { public void testDisassociateAndDeleteLastException() throws Exception { GraphVertex vertex = Mockito.mock(GraphVertex.class); - TitanOperationStatus result; + JanusGraphOperationStatus result; Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class); @@ -577,7 +577,7 @@ public class TitanDaoMockTest { GraphVertex vertexA = new GraphVertex(); GraphVertex vertexB = new GraphVertex(); - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java index 2c4b868ff2..9019de9d24 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.be.dao.jsongraph; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import fj.data.Either; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; @@ -10,13 +10,13 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.openecomp.sdc.be.dao.DAOTitanStrategy; +import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.utils.DAOConfDependentTest; import org.slf4j.Logger; @@ -26,25 +26,25 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -public class TitanDaoTest extends DAOConfDependentTest{ +public class JanusGraphDaoTest extends DAOConfDependentTest{ - private static Logger logger = LoggerFactory.getLogger(TitanDaoTest.class); - private TitanDao dao = new TitanDao(new TitanGraphClient(new DAOTitanStrategy())); + private static Logger logger = LoggerFactory.getLogger(JanusGraphDaoTest.class); + private JanusGraphDao dao = new JanusGraphDao(new JanusGraphClient(new DAOJanusGraphStrategy())); @Before public void init(){ - dao.titanClient.createGraph(); + dao.janusGraphClient.createGraph(); } @After public void end(){ - dao.titanClient.cleanupGraph(); + dao.janusGraphClient.cleanupGraph(); } @Test public void testCreateVertex() throws Exception { - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test GraphVertex graphVertex = new GraphVertex(VertexTypeEnum.REQUIREMENTS); @@ -56,7 +56,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ @Test public void testGetVertexByLabel() throws Exception { - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test result = dao.getVertexByLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); @@ -64,7 +64,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ @Test public void testCommit() throws Exception { - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -75,7 +75,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ @Test public void testRollback() throws Exception { - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -85,7 +85,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ @Test public void testGetGraph() throws Exception { - Either<TitanGraph, TitanOperationStatus> result; + Either<JanusGraph, JanusGraphOperationStatus> result; // default test @@ -98,7 +98,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ GraphPropertyEnum name = null; Object value = null; VertexTypeEnum label = null; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test @@ -114,7 +114,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ Object value = null; VertexTypeEnum label = null; JsonParseFlagEnum parseFlag = null; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test @@ -126,7 +126,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ public void testGetVertexById() throws Exception { String id = ""; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // default test @@ -138,7 +138,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ String id = ""; JsonParseFlagEnum parseFlag = null; - Either<GraphVertex, TitanOperationStatus> result; + Either<GraphVertex, JanusGraphOperationStatus> result; // test 1 @@ -181,7 +181,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ VertexTypeEnum type = null; Map<GraphPropertyEnum, Object> props = null; - Either<List<GraphVertex>, TitanOperationStatus> result; + Either<List<GraphVertex>, JanusGraphOperationStatus> result; // default test @@ -194,7 +194,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ VertexTypeEnum type = null; Map<GraphPropertyEnum, Object> props = null; JsonParseFlagEnum parseFlag = null; - Either<List<GraphVertex>, TitanOperationStatus> result; + Either<List<GraphVertex>, JanusGraphOperationStatus> result; // default test @@ -209,7 +209,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ Map<GraphPropertyEnum, Object> props = null; Map<GraphPropertyEnum, Object> hasNotProps = null; JsonParseFlagEnum parseFlag = null; - Either<List<GraphVertex>, TitanOperationStatus> result; + Either<List<GraphVertex>, JanusGraphOperationStatus> result; // default test @@ -219,7 +219,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ @Test public void testGetCatalogVerticies() throws Exception { - Either<Iterator<Vertex>, TitanOperationStatus> result; + Either<Iterator<Vertex>, JanusGraphOperationStatus> result; // default test @@ -232,7 +232,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<List<Vertex>, TitanOperationStatus> result; + Either<List<Vertex>, JanusGraphOperationStatus> result; // default test @@ -245,7 +245,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ Vertex parentVertex = null; EdgeLabelEnum edgeLabel = null; JsonParseFlagEnum parseFlag = null; - Either<List<Vertex>, TitanOperationStatus> result; + Either<List<Vertex>, JanusGraphOperationStatus> result; // default test @@ -257,7 +257,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ Vertex vertex = null; Map<GraphPropertyEnum, Object> properties = null; - TitanOperationStatus result; + JanusGraphOperationStatus result; // default test @@ -303,7 +303,7 @@ public class TitanDaoTest extends DAOConfDependentTest{ String parentId = ""; EdgeLabelEnum label = null; Map<GraphPropertyEnum, Object> properties = null; - Either<Edge, TitanOperationStatus> result; + Either<Edge, JanusGraphOperationStatus> result; // default test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java index e8c6b3cdd1..09ab6a1745 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java @@ -21,13 +21,13 @@ package org.openecomp.sdc.be.resources; import com.google.gson.Gson; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanEdge; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import com.thinkaurelius.titan.core.attribute.Text; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraphEdge; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphVertex; +import org.janusgraph.core.attribute.Text; +import org.janusgraph.core.schema.JanusGraphManagement; import fj.data.Either; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -38,10 +38,10 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -72,12 +72,12 @@ import static org.junit.Assert.assertTrue; @ContextConfiguration("classpath:application-context-test.xml") @TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class }) -public class TitanGenericDaoTest { - private static Logger log = LoggerFactory.getLogger(TitanGenericDaoTest.class.getName()); +public class JanusGraphGenericDaoTest { + private static Logger log = LoggerFactory.getLogger(JanusGraphGenericDaoTest.class.getName()); private static ConfigurationManager configurationManager; - @Resource(name = "titan-generic-dao") - private TitanGenericDao titanDao; + @Resource(name = "janusgraph-generic-dao") + private JanusGraphGenericDao janusGraphDao; @BeforeClass public static void setupBeforeClass() { @@ -86,27 +86,26 @@ public class TitanGenericDaoTest { ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); configurationManager = new ConfigurationManager(configurationSource); - configurationManager.getConfiguration() - .setTitanCfgFile("../catalog-be/src/main/resources/config/titan.properties"); - configurationManager.getConfiguration().setTitanInMemoryGraph(true); + configurationManager.getConfiguration().setJanusGraphCfgFile("../catalog-be/src/main/resources/config/janusgraph.properties"); + configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true); } // @Test public void testcheckEdgeProps() { - TitanGraph graph = titanDao.getGraph().left().value(); - TitanVertex v1 = graph.addVertex(); + JanusGraph graph = janusGraphDao.getGraph().left().value(); + JanusGraphVertex v1 = graph.addVertex(); v1.property("prop1", 123); - TitanVertex v2 = graph.addVertex(); + JanusGraphVertex v2 = graph.addVertex(); v2.property("prop1", 456); - TitanEdge addEdge = v1.addEdge("label11", v2); + JanusGraphEdge addEdge = v1.addEdge("label11", v2); addEdge.property("edgeProp", "my prop edge"); graph.tx().commit(); - Either<TitanVertex, TitanOperationStatus> v11 = titanDao.getVertexByProperty("prop1", 123); + Either<JanusGraphVertex, JanusGraphOperationStatus> v11 = janusGraphDao.getVertexByProperty("prop1", 123); Iterator<Edge> edges = v11.left().value().edges(Direction.OUT, "label11"); Edge edge = edges.next(); // String value = (String)edge.value("edgeProp"); - String value = (String) titanDao.getProperty(edge, "edgeProp"); + String value = (String) janusGraphDao.getProperty(edge, "edgeProp"); log.debug(value); } @@ -118,34 +117,34 @@ public class TitanGenericDaoTest { UserData userData = new UserData("Myname123", "Mylastname", id, "email123", "Tester", UserStatusEnum.ACTIVE.name(), null); - Either<UserData, TitanOperationStatus> newNode = titanDao.createNode(userData, UserData.class); + Either<UserData, JanusGraphOperationStatus> newNode = janusGraphDao.createNode(userData, UserData.class); assertTrue(newNode.isLeft()); log.debug("{}", newNode.left().value()); - titanDao.commit(); + janusGraphDao.commit(); ImmutablePair<String, Object> keyValueId = userData.getKeyValueId(); - Either<UserData, TitanOperationStatus> node = titanDao.getNode(keyValueId.getKey(), keyValueId.getValue(), + Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(), UserData.class); - titanDao.commit(); + janusGraphDao.commit(); assertTrue(node.isLeft()); log.debug("{}", node.left().value()); userData.setRole("Designer"); - node = titanDao.updateNode(userData, UserData.class); + node = janusGraphDao.updateNode(userData, UserData.class); assertTrue(node.isLeft()); log.debug("{}", node.left().value()); assertEquals(null, "Designer", node.left().value().getRole()); - titanDao.commit(); + janusGraphDao.commit(); - node = titanDao.deleteNode(userData, UserData.class); + node = janusGraphDao.deleteNode(userData, UserData.class); assertTrue(node.isLeft()); log.debug("{}", node.left().value()); - titanDao.commit(); + janusGraphDao.commit(); - node = titanDao.getNode(keyValueId.getKey(), keyValueId.getValue(), UserData.class); + node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(), UserData.class); assertTrue(node.isRight()); log.debug("{}", node.right().value()); @@ -159,29 +158,29 @@ public class TitanGenericDaoTest { UserData userData1 = new UserData("Myname123", "Mylastname", id, "email123", "Tester", UserStatusEnum.ACTIVE.name(), null); - Either<UserData, TitanOperationStatus> node1 = titanDao.createNode(userData1, UserData.class); + Either<UserData, JanusGraphOperationStatus> node1 = janusGraphDao.createNode(userData1, UserData.class); assertTrue(node1.isLeft()); log.debug("{}", node1.left().value()); id = "userIddfkoer45abc"; UserData userData2 = new UserData("Mynadyhme123", "Mylasghtname", id, "emaighdl123", "Designer", UserStatusEnum.ACTIVE.name(), null); - Either<UserData, TitanOperationStatus> node2 = titanDao.createNode(userData2, UserData.class); + Either<UserData, JanusGraphOperationStatus> node2 = janusGraphDao.createNode(userData2, UserData.class); assertTrue(node2.isLeft()); log.debug("{}", node2.left().value()); - titanDao.commit(); + janusGraphDao.commit(); ImmutablePair<String, Object> keyValueId1 = userData1.getKeyValueId(); // get first node - Either<UserData, TitanOperationStatus> node = titanDao.getNode(keyValueId1.getKey(), keyValueId1.getValue(), + Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId1.getKey(), keyValueId1.getValue(), UserData.class); assertTrue(node.isLeft()); log.debug("{}", node.left().value()); - titanDao.commit(); + janusGraphDao.commit(); // get all must be 2 + 1 default user = 3 - Either<List<UserData>, TitanOperationStatus> all = titanDao.getAll(NodeTypeEnum.User, UserData.class); + Either<List<UserData>, JanusGraphOperationStatus> all = janusGraphDao.getAll(NodeTypeEnum.User, UserData.class); assertTrue(all.isLeft()); assertTrue(all.left().value().size() > 0); @@ -192,7 +191,7 @@ public class TitanGenericDaoTest { props.put(keyValueId1.getKey(), keyValueId1.getValue()); // get by criteria. must be 1 - Either<List<UserData>, TitanOperationStatus> byCriteria = titanDao.getByCriteria(NodeTypeEnum.User, props, + Either<List<UserData>, JanusGraphOperationStatus> byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.User, props, UserData.class); assertTrue(byCriteria.isLeft()); assertEquals(1, byCriteria.left().value().size()); @@ -200,9 +199,9 @@ public class TitanGenericDaoTest { log.debug("{}", byCriteria.left().value()); // delete all nodes - node = titanDao.deleteNode(userData1, UserData.class); + node = janusGraphDao.deleteNode(userData1, UserData.class); assertTrue(node.isLeft()); - node = titanDao.deleteNode(userData2, UserData.class); + node = janusGraphDao.deleteNode(userData2, UserData.class); assertTrue(node.isLeft()); } @@ -211,7 +210,7 @@ public class TitanGenericDaoTest { String id = "userId12345abc"; UserData userData = new UserData("Myname123", "Mylastname", id, "email123", UserRoleEnum.ADMIN.name(), UserStatusEnum.ACTIVE.name(), null); - titanDao.createNode(userData, UserData.class); + janusGraphDao.createNode(userData, UserData.class); ResourceMetadataData resourceData = new ResourceMetadataData(); resourceData.getMetadataDataDefinition().setName("resourceForLock"); resourceData.getMetadataDataDefinition().setVersion("0.1"); @@ -219,37 +218,37 @@ public class TitanGenericDaoTest { resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "." + resourceData.getMetadataDataDefinition().getVersion()); - titanDao.createNode(resourceData, ResourceMetadataData.class); - titanDao.createRelation(userData, resourceData, GraphEdgeLabels.LAST_MODIFIER, null); - titanDao.commit(); + janusGraphDao.createNode(resourceData, ResourceMetadataData.class); + janusGraphDao.createRelation(userData, resourceData, GraphEdgeLabels.LAST_MODIFIER, null); + janusGraphDao.commit(); - Either<List<Edge>, TitanOperationStatus> eitherEdges = titanDao.getEdgesForNode(userData, Direction.OUT); + Either<List<Edge>, JanusGraphOperationStatus> eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.OUT); assertTrue(eitherEdges.isLeft()); assertEquals(1, eitherEdges.left().value().size()); - eitherEdges = titanDao.getEdgesForNode(userData, Direction.IN); + eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.IN); assertTrue(eitherEdges.isLeft()); assertEquals(0, eitherEdges.left().value().size()); - eitherEdges = titanDao.getEdgesForNode(resourceData, Direction.OUT); + eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.OUT); assertTrue(eitherEdges.isLeft()); assertEquals(0, eitherEdges.left().value().size()); - eitherEdges = titanDao.getEdgesForNode(resourceData, Direction.IN); + eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.IN); assertTrue(eitherEdges.isLeft()); assertEquals(1, eitherEdges.left().value().size()); - eitherEdges = titanDao.getEdgesForNode(resourceData, Direction.BOTH); + eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.BOTH); assertTrue(eitherEdges.isLeft()); assertEquals(1, eitherEdges.left().value().size()); - eitherEdges = titanDao.getEdgesForNode(userData, Direction.BOTH); + eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.BOTH); assertTrue(eitherEdges.isLeft()); assertEquals(1, eitherEdges.left().value().size()); - titanDao.deleteNode(userData, UserData.class); - titanDao.deleteNode(resourceData, ResourceMetadataData.class); - titanDao.commit(); + janusGraphDao.deleteNode(userData, UserData.class); + janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class); + janusGraphDao.commit(); } @Test @@ -263,37 +262,37 @@ public class TitanGenericDaoTest { resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "." + resourceData.getMetadataDataDefinition().getVersion()); - Either<ResourceMetadataData, TitanOperationStatus> resource1 = titanDao.createNode(resourceData, + Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData, ResourceMetadataData.class); assertTrue(resource1.isLeft()); - titanDao.commit(); + janusGraphDao.commit(); String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId(); - Either<GraphNodeLock, TitanOperationStatus> nodeLock = titanDao + Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isRight()); - assertEquals(TitanOperationStatus.NOT_FOUND, nodeLock.right().value()); + assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value()); - TitanOperationStatus status = titanDao.lockElement(resourceData); - assertEquals(TitanOperationStatus.OK, status); + JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData); + assertEquals(JanusGraphOperationStatus.OK, status); - nodeLock = titanDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); + nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isLeft()); assertEquals(lockId, nodeLock.left().value().getUniqueId()); - titanDao.commit(); + janusGraphDao.commit(); - status = titanDao.lockElement(resourceData); - assertEquals(TitanOperationStatus.ALREADY_LOCKED, status); + status = janusGraphDao.lockElement(resourceData); + assertEquals(JanusGraphOperationStatus.ALREADY_LOCKED, status); - status = titanDao.releaseElement(resourceData); - assertEquals(TitanOperationStatus.OK, status); + status = janusGraphDao.releaseElement(resourceData); + assertEquals(JanusGraphOperationStatus.OK, status); - nodeLock = titanDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); + nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isRight()); - assertEquals(TitanOperationStatus.NOT_FOUND, nodeLock.right().value()); - titanDao.deleteNode(resourceData, ResourceMetadataData.class); - titanDao.commit(); + assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value()); + janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class); + janusGraphDao.commit(); } @@ -308,37 +307,37 @@ public class TitanGenericDaoTest { resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "." + resourceData.getMetadataDataDefinition().getVersion()); - Either<ResourceMetadataData, TitanOperationStatus> resource1 = titanDao.createNode(resourceData, + Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData, ResourceMetadataData.class); assertTrue(resource1.isLeft()); - titanDao.commit(); + janusGraphDao.commit(); String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId(); - Either<GraphNodeLock, TitanOperationStatus> nodeLock = titanDao + Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isRight()); - assertEquals(TitanOperationStatus.NOT_FOUND, nodeLock.right().value()); + assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value()); // lock - TitanOperationStatus status = titanDao.lockElement(resourceData); - assertEquals(TitanOperationStatus.OK, status); + JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData); + assertEquals(JanusGraphOperationStatus.OK, status); - nodeLock = titanDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); + nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isLeft()); assertEquals(lockId, nodeLock.left().value().getUniqueId()); long time1 = nodeLock.left().value().getTime(); - titanDao.commit(); + janusGraphDao.commit(); // timeout - configurationManager.getConfiguration().setTitanLockTimeout(2L); + configurationManager.getConfiguration().setJanusGraphLockTimeout(2L); Thread.sleep(5001); // relock - status = titanDao.lockElement(resourceData); - assertEquals(TitanOperationStatus.OK, status); + status = janusGraphDao.lockElement(resourceData); + assertEquals(JanusGraphOperationStatus.OK, status); - nodeLock = titanDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); + nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isLeft()); assertEquals(lockId, nodeLock.left().value().getUniqueId()); @@ -346,15 +345,15 @@ public class TitanGenericDaoTest { assertTrue(time2 > time1); - status = titanDao.releaseElement(resourceData); - assertEquals(TitanOperationStatus.OK, status); + status = janusGraphDao.releaseElement(resourceData); + assertEquals(JanusGraphOperationStatus.OK, status); - nodeLock = titanDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); + nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class); assertTrue(nodeLock.isRight()); - assertEquals(TitanOperationStatus.NOT_FOUND, nodeLock.right().value()); + assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value()); - titanDao.deleteNode(resourceData, ResourceMetadataData.class); - titanDao.commit(); + janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class); + janusGraphDao.commit(); } @@ -369,7 +368,7 @@ public class TitanGenericDaoTest { resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "." + resourceData.getMetadataDataDefinition().getVersion()); - Either<ResourceMetadataData, TitanOperationStatus> resource1 = titanDao.createNode(resourceData, + Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData, ResourceMetadataData.class); assertTrue(resource1.isLeft()); @@ -382,9 +381,9 @@ public class TitanGenericDaoTest { resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "." + resourceData.getMetadataDataDefinition().getVersion()); - Either<ResourceMetadataData, TitanOperationStatus> resource2 = titanDao.createNode(resourceData, + Either<ResourceMetadataData, JanusGraphOperationStatus> resource2 = janusGraphDao.createNode(resourceData, ResourceMetadataData.class); - titanDao.commit(); + janusGraphDao.commit(); Map<String, Object> props = new HashMap<>(); @@ -393,26 +392,26 @@ public class TitanGenericDaoTest { props.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), false); // get by criteria. must be 1 - Either<List<ResourceMetadataData>, TitanOperationStatus> byCriteria = titanDao + Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); assertTrue(byCriteria.isLeft()); - titanDao.deleteNode(resource1.left().value(), ResourceMetadataData.class); + janusGraphDao.deleteNode(resource1.left().value(), ResourceMetadataData.class); - titanDao.deleteNode(resource2.left().value(), ResourceMetadataData.class); - titanDao.commit(); + janusGraphDao.deleteNode(resource2.left().value(), ResourceMetadataData.class); + janusGraphDao.commit(); } // @Test public void testStringSearch() { - TitanGraph graph; + JanusGraph graph; BaseConfiguration conf = new BaseConfiguration(); conf.setProperty("storage.backend", "inmemory"); - graph = TitanFactory.open(conf); + graph = JanusGraphFactory.open(conf); - // TitanManagement graphMgt = graph.getManagementSystem(); - TitanManagement graphMgt = graph.openManagement(); + // JanusGraphManagement graphMgt = graph.getManagementSystem(); + JanusGraphManagement graphMgt = graph.openManagement(); PropertyKey propKey = graphMgt.makePropertyKey("string1").dataType(String.class).make(); graphMgt.buildIndex("string1", Vertex.class).addKey(propKey).unique().buildCompositeIndex(); @@ -423,49 +422,49 @@ public class TitanGenericDaoTest { log.debug("**** predicat index search non case"); - Iterable<TitanVertex> vertices = graph.query().has("string1", Text.REGEX, "my new string 1").vertices(); - Iterator<TitanVertex> iter = vertices.iterator(); + Iterable<JanusGraphVertex> vertices = graph.query().has("string1", Text.REGEX, "my new string 1").vertices(); + Iterator<JanusGraphVertex> iter = vertices.iterator(); while (iter.hasNext()) { Vertex ver = iter.next(); // System.out.println(com.tinkerpop.blueprints.util.ElementHelper.getProperties(ver)); - log.debug("{}", titanDao.getProperties(ver)); + log.debug("{}", janusGraphDao.getProperties(ver)); } } @Test - public void testDuplicateResultDueToTitanBug() { + public void testDuplicateResultDueToJanusGraphBug() { ResourceMetadataData resourceData1 = new ResourceMetadataData(); resourceData1.getMetadataDataDefinition().setUniqueId("A"); ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true); resourceData1.getMetadataDataDefinition().setName("aaaa"); - Either<ResourceMetadataData, TitanOperationStatus> newNode1 = titanDao.createNode(resourceData1, + Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1, ResourceMetadataData.class); assertTrue(newNode1.isLeft()); log.debug("{}", newNode1.left().value()); - // titanDao.commit(); + // janusGraphDao.commit(); Map<String, Object> props = new HashMap<>(); props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true); - Either<List<ResourceMetadataData>, TitanOperationStatus> byCriteria = titanDao + Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); assertTrue(byCriteria.isLeft()); assertEquals("check one result returned", 1, byCriteria.left().value().size()); - // titanDao.commit(); + // janusGraphDao.commit(); ResourceMetadataData resourceToUpdate = new ResourceMetadataData(); ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false); resourceToUpdate.getMetadataDataDefinition().setUniqueId("A"); - Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanDao.updateNode(resourceToUpdate, + Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate, ResourceMetadataData.class); assertTrue(updateNode.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); - byCriteria = titanDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); + byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); assertTrue(byCriteria.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria.right().value()); AdditionalInfoParameterData infoParameterData = new AdditionalInfoParameterData(); @@ -474,11 +473,11 @@ public class TitanGenericDaoTest { idToKey.put("key1", "value1"); infoParameterData.setIdToKey(idToKey); - Either<AdditionalInfoParameterData, TitanOperationStatus> newNode2 = titanDao.createNode(infoParameterData, + Either<AdditionalInfoParameterData, JanusGraphOperationStatus> newNode2 = janusGraphDao.createNode(infoParameterData, AdditionalInfoParameterData.class); assertTrue(newNode2.isLeft()); log.debug("{}", newNode2.left().value()); - // titanDao.commit(); + // janusGraphDao.commit(); Map<String, String> idToKey2 = new HashMap<>(); idToKey2.put("key1", "value2"); @@ -490,24 +489,24 @@ public class TitanGenericDaoTest { // props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), // idToKey2); - Either<List<AdditionalInfoParameterData>, TitanOperationStatus> byCriteria2 = titanDao + Either<List<AdditionalInfoParameterData>, JanusGraphOperationStatus> byCriteria2 = janusGraphDao .getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2, AdditionalInfoParameterData.class); assertTrue(byCriteria2.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria2.right().value()); infoParameterData.setIdToKey(idToKey2); - Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode2 = titanDao.updateNode(infoParameterData, + Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode2 = janusGraphDao.updateNode(infoParameterData, AdditionalInfoParameterData.class); assertTrue(updateNode2.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), idToKey); - byCriteria2 = titanDao.getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2, + byCriteria2 = janusGraphDao.getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2, AdditionalInfoParameterData.class); assertTrue(byCriteria2.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria2.right().value()); ComponentInstanceData resourceInstanceData = new ComponentInstanceData(); @@ -515,33 +514,33 @@ public class TitanGenericDaoTest { resourceInstanceData.getComponentInstDataDefinition().setPosX("22"); resourceInstanceData.getComponentInstDataDefinition().setName("myresource_1"); - Either<ComponentInstanceData, TitanOperationStatus> newNode3 = titanDao.createNode(resourceInstanceData, + Either<ComponentInstanceData, JanusGraphOperationStatus> newNode3 = janusGraphDao.createNode(resourceInstanceData, ComponentInstanceData.class); assertTrue(newNode3.isLeft()); log.debug("{}", newNode3.left().value()); - // titanDao.commit(); + // janusGraphDao.commit(); resourceInstanceData.getComponentInstDataDefinition().setPosX("50"); - Either<ComponentInstanceData, TitanOperationStatus> updateNode3 = titanDao.updateNode(resourceInstanceData, + Either<ComponentInstanceData, JanusGraphOperationStatus> updateNode3 = janusGraphDao.updateNode(resourceInstanceData, ComponentInstanceData.class); assertTrue(updateNode3.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); resourceInstanceData.getComponentInstDataDefinition().setName("myresource_2"); - updateNode3 = titanDao.updateNode(resourceInstanceData, ComponentInstanceData.class); + updateNode3 = janusGraphDao.updateNode(resourceInstanceData, ComponentInstanceData.class); assertTrue(updateNode3.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); Map<String, Object> props3 = new HashMap<>(); props3.put("positionX", "22"); - Either<List<ComponentInstanceData>, TitanOperationStatus> byCriteria3 = titanDao + Either<List<ComponentInstanceData>, JanusGraphOperationStatus> byCriteria3 = janusGraphDao .getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class); assertTrue(byCriteria3.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria3.right().value()); props3.put("positionX", "50"); - byCriteria3 = titanDao.getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class); + byCriteria3 = janusGraphDao.getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class); assertTrue(byCriteria3.isLeft()); /////////////////////////// check integer //////////////////////// @@ -550,33 +549,33 @@ public class TitanGenericDaoTest { artifactData.getArtifactDataDefinition().setUniqueId("ad234"); artifactData.getArtifactDataDefinition().setTimeout(100); - Either<ArtifactData, TitanOperationStatus> newNode4 = titanDao.createNode(artifactData, ArtifactData.class); + Either<ArtifactData, JanusGraphOperationStatus> newNode4 = janusGraphDao.createNode(artifactData, ArtifactData.class); assertTrue(newNode4.isLeft()); log.debug("{}", newNode4.left().value()); - // titanDao.commit(); + // janusGraphDao.commit(); artifactData.getArtifactDataDefinition().setTimeout(50); - Either<ArtifactData, TitanOperationStatus> updateNode4 = titanDao.updateNode(artifactData, ArtifactData.class); + Either<ArtifactData, JanusGraphOperationStatus> updateNode4 = janusGraphDao.updateNode(artifactData, ArtifactData.class); assertTrue(updateNode4.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); Map<String, Object> props4 = new HashMap<>(); props4.put("timeout", 100); - Either<List<ArtifactData>, TitanOperationStatus> byCriteria4 = titanDao.getByCriteria(NodeTypeEnum.ArtifactRef, + Either<List<ArtifactData>, JanusGraphOperationStatus> byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef, props4, ArtifactData.class); assertTrue(byCriteria4.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria4.right().value()); props4.put("timeout", 50); - byCriteria4 = titanDao.getByCriteria(NodeTypeEnum.ArtifactRef, props4, ArtifactData.class); + byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef, props4, ArtifactData.class); assertTrue(byCriteria4.isLeft()); - titanDao.rollback(); + janusGraphDao.rollback(); } @Test - public void testDuplicateResultUSeHasNotQueryDueToTitanBug() { + public void testDuplicateResultUSeHasNotQueryDueToJanusGraphBug() { String name = "bbbb"; @@ -585,46 +584,46 @@ public class TitanGenericDaoTest { ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true); resourceData1.getMetadataDataDefinition().setName(name); - Either<ResourceMetadataData, TitanOperationStatus> newNode1 = titanDao.createNode(resourceData1, + Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1, ResourceMetadataData.class); assertTrue(newNode1.isLeft()); log.debug("{}", newNode1.left().value()); - // titanDao.commit(); + // janusGraphDao.commit(); Map<String, Object> props = new HashMap<>(); props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true); - Either<List<ResourceMetadataData>, TitanOperationStatus> byCriteria = titanDao + Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); assertTrue(byCriteria.isLeft()); assertEquals("check one result returned", 1, byCriteria.left().value().size()); - // titanDao.commit(); + // janusGraphDao.commit(); ResourceMetadataData resourceToUpdate = new ResourceMetadataData(); ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false); resourceToUpdate.getMetadataDataDefinition().setUniqueId("A"); - Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanDao.updateNode(resourceToUpdate, + Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate, ResourceMetadataData.class); assertTrue(updateNode.isLeft()); - // titanDao.commit(); + // janusGraphDao.commit(); // no result where isAbstract = true - byCriteria = titanDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); + byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class); assertTrue(byCriteria.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria.right().value()); // one result where isAbstract != true - byCriteria = titanDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class); + byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class); assertTrue(byCriteria.isLeft()); assertEquals("check one result returned", 1, byCriteria.left().value().size()); props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), false); - byCriteria = titanDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class); + byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class); assertTrue(byCriteria.isRight()); - assertEquals("check one result returned due to titan bug", TitanOperationStatus.NOT_FOUND, + assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND, byCriteria.right().value()); - titanDao.rollback(); + janusGraphDao.rollback(); } diff --git a/catalog-dao/src/test/resources/application-context-test.xml b/catalog-dao/src/test/resources/application-context-test.xml index 24980dfecd..c07512f92c 100644 --- a/catalog-dao/src/test/resources/application-context-test.xml +++ b/catalog-dao/src/test/resources/application-context-test.xml @@ -13,7 +13,7 @@ org.openecomp.sdc.be.dao.impl, org.openecomp.sdc.be.dao.es, org.openecomp.sdc.be.dao.neo4j, - org.openecomp.sdc.be.dao.titan, + org.openecomp.sdc.be.dao.janusgraph, org.openecomp.sdc.be.resources.impl "> diff --git a/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml b/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml index 67c0ec7b20..92cf2a3242 100644 --- a/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml +++ b/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml @@ -25,9 +25,9 @@ beSslPort: 8443 version: 1.0 released: 2012-11-30 -titanCfgFile: src/main/resources/config/titan.properties -titanInMemoryGraph: true -titanLockTimeout: 30 +janusGraphCfgFile: src/main/resources/config/janusgraph.properties +janusGraphInMemoryGraph: true +janusGraphLockTimeout: 30 # Protocols protocols: |