Upgrade SDC from Titan to Janus Graph
Upgrade SDC from Titan to Janus Graph
Change-Id: I67fb8b8e60cc6751697bc5ff2f06754c92803786
Issue-ID: SDC-2296
Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
index 4f74345..8f6d9db 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
@@ -24,7 +24,7 @@
import ch.qos.logback.classic.LoggerContext;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.junit.rules.TestName;
@@ -67,7 +67,7 @@
protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
- protected static TitanGraph titanGraph;
+ protected static JanusGraph janusGraph;
public static Config config;
protected static ITestContext myContext;
@@ -151,7 +151,7 @@
}
@AfterSuite(alwaysRun = true)
- public static void shutdownTitan() throws Exception {
+ public static void shutdownJanusGraph() throws Exception {
performClean();
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
index c44c029..ffdf2fd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
@@ -68,7 +68,7 @@
private String neoDBusername;
private String neoDBpassword;
- private String titanPropertiesFile;
+ private String januGraphPropertiesFile;
private List<String> packages;
private List<String> bugs;
private List<String> resourcesNotToDelete;
@@ -498,12 +498,12 @@
this.neoDBpassword = neoDBpassword;
}
- public String getTitanPropertiesFile() {
- return titanPropertiesFile;
+ public String getjanuGraphPropertiesFile() {
+ return januGraphPropertiesFile;
}
- public void setTitanPropertiesFile(String titanPropertiesFile) {
- this.titanPropertiesFile = titanPropertiesFile;
+ public void setjanuGraphPropertiesFile(String januGraphPropertiesFile) {
+ this.januGraphPropertiesFile = januGraphPropertiesFile;
}
public List<String> getPackages() {
@@ -640,7 +640,7 @@
+ ", importTypesConfigDir=" + importTypesConfigDir + ", testSuites=" + testSuites + ", catalogFeHost="
+ catalogFeHost + ", catalogFePort=" + catalogFePort + ", catalogBePort=" + catalogBePort
+ ", catalogBeTlsPort=" + catalogBeTlsPort + ", neoDBusername=" + neoDBusername + ", neoDBpassword="
- + neoDBpassword + ", titanPropertiesFile=" + titanPropertiesFile + ", packages=" + packages + ", bugs="
+ + neoDBpassword + ", januGraphPropertiesFile=" + januGraphPropertiesFile + ", packages=" + packages + ", bugs="
+ bugs + ", resourcesNotToDelete=" + resourcesNotToDelete + ", resourceCategoriesNotToDelete="
+ resourceCategoriesNotToDelete + ", serviceCategoriesNotToDelete=" + serviceCategoriesNotToDelete
+ ", stopOnClassFailure=" + stopOnClassFailure + ", outputFolder=" + outputFolder + ", reportName="
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
index fc0e33d..bcd00a1 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
@@ -31,7 +31,7 @@
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
-import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState;
+import org.openecomp.sdc.ci.tests.utils.DbUtils.JanusGraphState;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterClass;
@@ -45,7 +45,7 @@
@AfterClass
public static void afterClass() {
- DbUtils.shutDowntitan();
+ DbUtils.shutDownJanusGraph();
}
static Config config = Config.instance();
@@ -55,7 +55,7 @@
@Test
public void testAddingCapabilityTypes() throws IOException {
- TitanState originalState = DbUtils.getCurrentTitanState();
+ JanusGraphState originalState = DbUtils.getCurrentJanusGraphState();
String importResourceDir = config.getImportResourceConfigDir();
@@ -64,20 +64,20 @@
importCapabilityType(capabilityTypes);
Either<Vertex, Boolean> eitherVertex = DbUtils.getVertexByUId("tosca.capabilities.Test.Ci");
AssertJUnit.assertTrue(eitherVertex.isLeft());
- DbUtils.restoreToTitanState(originalState);
+ DbUtils.restoreToJanusGraphState(originalState);
eitherVertex = DbUtils.getVertexByUId("tosca.capabilities.Test.Ci");
AssertJUnit.assertTrue(eitherVertex.isRight());
}
@Test
public void AddingCapabilityNotFound() throws IOException {
- TitanState originalState = DbUtils.getCurrentTitanState();
+ JanusGraphState originalState = DbUtils.getCurrentJanusGraphState();
String importResourceTestsDir = config.getImportResourceTestsConfigDir();
String capabilitiesTests = importResourceTestsDir + File.separator + "capabilityTypesCi.zip";
importCapabilityType(capabilitiesTests);
Either<Vertex, Boolean> eitherVertex = DbUtils.getVertexByUId("tosca.capabilities.NonExsitingCapability");
AssertJUnit.assertTrue(eitherVertex.isRight());
- DbUtils.restoreToTitanState(originalState);
+ DbUtils.restoreToJanusGraphState(originalState);
}
public static Integer importAllCapabilityTypes() throws IOException {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
index dea9084..5ba7062 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
@@ -21,10 +21,10 @@
package org.openecomp.sdc.ci.tests.utils;
import com.google.gson.*;
-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 org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
@@ -43,8 +43,8 @@
public class DbUtils {
- private static String titanConfigFilePath;
- private static TitanGraph titanGraph;
+ private static String janusGraphConfigFilePath;
+ private static JanusGraph janusGraph;
public static void cleanAllAudits() throws IOException {
@@ -74,11 +74,11 @@
}
public Either<Vertex, Boolean> getVertexByUId(String uid) {
- TitanGraph titanGraph = getTitanGraph();
+ JanusGraph janusGraph = getJanusGraph();
Either<Vertex, Boolean> result = Either.right(false);
- // Iterator<Vertex> vertexItr = titanGraph.getVertices().iterator();
+ // Iterator<Vertex> vertexItr = janusGraph.getVertices().iterator();
- Iterator<TitanVertex> vertexItr = titanGraph.query().vertices().iterator();
+ Iterator<JanusGraphVertex> vertexItr = janusGraph.query().vertices().iterator();
while (vertexItr.hasNext()) {
Vertex vertex = vertexItr.next();
// String uidFoundVal = vertex.getProperty("uid");
@@ -90,14 +90,14 @@
return result;
}
- public static TitanState getCurrentTitanState() {
- TitanGraph titanGraph = getTitanGraph();
+ public static JanusGraphState getCurrentJanusGraphState() {
+ JanusGraph janusGraph = getJanusGraph();
List<Vertex> vertices = new ArrayList<>();
List<Edge> edges = new ArrayList<>();
- // Iterator<Edge> edgesItr = titanGraph.getEdges().iterator();
- Iterator<TitanEdge> edgesItr = titanGraph.query().edges().iterator();
- // Iterator<Vertex> verticesItr = titanGraph.getVertices().iterator();
- Iterator<TitanVertex> verticesItr = titanGraph.query().vertices().iterator();
+ // Iterator<Edge> edgesItr = janusGraph.getEdges().iterator();
+ Iterator<JanusGraphEdge> edgesItr = janusGraph.query().edges().iterator();
+ // Iterator<Vertex> verticesItr = janusGraph.getVertices().iterator();
+ Iterator<JanusGraphVertex> verticesItr = janusGraph.query().vertices().iterator();
while (edgesItr.hasNext()) {
edges.add(edgesItr.next());
}
@@ -105,43 +105,43 @@
vertices.add(verticesItr.next());
}
- TitanState currState = new TitanState(edges, vertices);
+ JanusGraphState currState = new JanusGraphState(edges, vertices);
return currState;
}
//
- private static TitanGraph getTitanGraph() {
- if (titanGraph == null) {
- titanGraph = TitanFactory.open(titanConfigFilePath);
+ private static JanusGraph getJanusGraph() {
+ if (janusGraph == null) {
+ janusGraph = JanusGraphFactory.open(janusGraphConfigFilePath);
}
- return titanGraph;
+ return janusGraph;
}
- public void restoreToTitanState(TitanState titanStateToRestoreTo) {
+ public void restoreToJanusGraphState(JanusGraphState janusGraphStateToRestoreTo) {
List<Vertex> verticesToRemove = new ArrayList<>(), verticesToAdd = new ArrayList<>();
List<Edge> edgesToRemove = new ArrayList<>(), edgesToAdd = new ArrayList<>();
- TitanState currentTitanState = getCurrentTitanState();
+ JanusGraphState currentJanusGraphState = getCurrentJanusGraphState();
List<Edge> joinedEdges = new ArrayList<>();
- joinedEdges.addAll(titanStateToRestoreTo.edges);
- joinedEdges.retainAll(currentTitanState.edges);
+ joinedEdges.addAll(janusGraphStateToRestoreTo.edges);
+ joinedEdges.retainAll(currentJanusGraphState.edges);
List<Vertex> joinedVertices = new ArrayList<>();
- joinedVertices.addAll(titanStateToRestoreTo.vertices);
- joinedVertices.retainAll(currentTitanState.vertices);
+ joinedVertices.addAll(janusGraphStateToRestoreTo.vertices);
+ joinedVertices.retainAll(currentJanusGraphState.vertices);
- edgesToRemove.addAll(currentTitanState.edges);
+ edgesToRemove.addAll(currentJanusGraphState.edges);
edgesToRemove.removeAll(joinedEdges);
- verticesToRemove.addAll(currentTitanState.vertices);
+ verticesToRemove.addAll(currentJanusGraphState.vertices);
verticesToRemove.removeAll(joinedVertices);
- edgesToAdd.addAll(titanStateToRestoreTo.edges);
+ edgesToAdd.addAll(janusGraphStateToRestoreTo.edges);
edgesToAdd.removeAll(joinedEdges);
- verticesToAdd.addAll(titanStateToRestoreTo.vertices);
+ verticesToAdd.addAll(janusGraphStateToRestoreTo.vertices);
verticesToAdd.removeAll(joinedVertices);
modifyGraphAccordingToDelta(verticesToRemove, verticesToAdd, edgesToRemove, edgesToAdd);
@@ -151,24 +151,24 @@
private void modifyGraphAccordingToDelta(List<Vertex> verticesToRemove, List<Vertex> verticesToAdd,
List<Edge> edgesToRemove, List<Edge> edgesToAdd) {
- TitanGraph titanGraph = getTitanGraph();
+ JanusGraph janusGraph = getJanusGraph();
for (Vertex vertex : verticesToRemove) {
- // titanGraph.removeVertex(vertex);
+ // janusGraph.removeVertex(vertex);
vertex.remove();
}
for (Vertex vertex : verticesToAdd) {
- TitanVertex titanVertex = titanGraph.addVertex();
- copyProperties(vertex, titanVertex);
+ JanusGraphVertex janusGraphVertex = janusGraph.addVertex();
+ copyProperties(vertex, janusGraphVertex);
}
for (Edge edge : edgesToRemove) {
- // titanGraph.removeEdge(edge);
+ // janusGraph.removeEdge(edge);
edge.remove();
}
for (Edge edge : edgesToAdd) {
- // Element addedEdge = titanGraph.addEdge(edge.getId(),
+ // Element addedEdge = janusGraph.addEdge(edge.getId(),
// edge.getVertex(Direction.OUT), edge.getVertex(Direction.IN),
// edge.getLabel());
@@ -181,8 +181,8 @@
}
- // titanGraph.commit();
- titanGraph.tx().commit();
+ // janusGraph.commit();
+ janusGraph.tx().commit();
}
@@ -197,26 +197,26 @@
}
- public static class TitanState {
+ public static class JanusGraphState {
private List<Edge> edges;
private List<Vertex> vertices;
- private TitanState(List<Edge> edges, List<Vertex> vertices) {
+ private JanusGraphState(List<Edge> edges, List<Vertex> vertices) {
this.edges = edges;
this.vertices = vertices;
}
@Override
public String toString() {
- return "TitanState [edges=" + edges.size() + ", vertices=" + vertices.size() + "]";
+ return "JanusGraphState [edges=" + edges.size() + ", vertices=" + vertices.size() + "]";
}
}
- public void shutDowntitan() {
- if (titanGraph != null) {
- // titanGraph.shutdown();
- titanGraph.close();
+ public void shutDownJanusGraph() {
+ if (janusGraph != null) {
+ // janusGraph.shutdown();
+ janusGraph.close();
}
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java b/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
index 803e190..322a317 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/post/Install.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.post;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import java.io.File;
@@ -30,39 +30,39 @@
public static void main(String[] args) {
if (args == null || args.length == 0) {
- System.out.println("Usage: org.openecomp.sdc.post.Install path_to_titan.properties");
+ System.out.println("Usage: org.openecomp.sdc.post.Install path_to_janusgraph.properties");
System.exit(1);
}
- String titanPropsFile = args[0];
+ String janusGraphPropsFile = args[0];
- if (!isFileExists(titanPropsFile)) {
+ if (!isFileExists(janusGraphPropsFile)) {
System.exit(2);
}
- if (!createTitanSchema(titanPropsFile)) {
+ if (!createJanusGraphSchema(janusGraphPropsFile)) {
System.exit(3);
}
System.exit(0);
}
- private static boolean createTitanSchema(String titanPropsFile) {
- TitanGraphClient titanGraphClient = new TitanGraphClient(new DAOTitanStrategy());
- TitanOperationStatus status = titanGraphClient.createGraph(titanPropsFile);
- if (TitanOperationStatus.OK == status) {
- System.out.println("Titan schema ,indexes and default values created successfully.");
+ private static boolean createJanusGraphSchema(String janusGraphPropsFile) {
+ JanusGraphClient janusGraphClient = new JanusGraphClient(new DAOJanusGraphStrategy());
+ JanusGraphOperationStatus status = janusGraphClient.createGraph(janusGraphPropsFile);
+ if (JanusGraphOperationStatus.OK == status) {
+ System.out.println("JanusGraph schema ,indexes and default values created successfully.");
return true;
} else {
System.out.println(
- "Problem while creating titan schema ,indexes and default values. (" + status.name() + ")");
+ "Problem while creating janusgraph schema ,indexes and default values. (" + status.name() + ")");
return false;
}
}
- private static boolean isFileExists(String titanPropsFile) {
- File f = new File(titanPropsFile);
+ private static boolean isFileExists(String janusGraphPropsFile) {
+ File f = new File(janusGraphPropsFile);
if (!f.exists()) {
- System.out.println(titanPropsFile + " not found");
+ System.out.println(janusGraphPropsFile + " not found");
return false;
}
return true;
diff --git a/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml b/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
index 21294e7..4ef9ce4 100644
--- a/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
+++ b/test-apis-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -30,7 +30,7 @@
importTypesConfigDir: src/test/resources/CI/importTypesTest
-titanPropertiesFile: src/main/resources/ci/conf/titan.properties
+janusGraphPropertiesFile: src/main/resources/ci/conf/janusgraph.properties
cassandraHost: 127.0.0.1
cassandraAuthenticate: false
cassandraUsername: koko
@@ -47,7 +47,7 @@
stopOnClassFailure: false
-#List of non-abstract resources to keep during titan cleanup between tests
+#List of non-abstract resources to keep during janus graph cleanup between tests
#Only 1.0 version will be kept
resourcesNotToDelete:
- Compute
diff --git a/test-apis-ci/src/main/resources/ci/conf/titan.properties b/test-apis-ci/src/main/resources/ci/conf/janusgraph.properties
similarity index 100%
rename from test-apis-ci/src/main/resources/ci/conf/titan.properties
rename to test-apis-ci/src/main/resources/ci/conf/janusgraph.properties
diff --git a/test-apis-ci/src/main/resources/ci/conf/log4j.properties b/test-apis-ci/src/main/resources/ci/conf/log4j.properties
index d313e92..02f7830 100644
--- a/test-apis-ci/src/main/resources/ci/conf/log4j.properties
+++ b/test-apis-ci/src/main/resources/ci/conf/log4j.properties
@@ -26,7 +26,7 @@
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n
log4j.logger.org.apache.cassandra.service.StorageProxy=INFO
-log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
+log4j.logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout
log4j.additivity.org.openecomp.sdc.ci.tests.utils=false
diff --git a/test-apis-ci/src/main/resources/log4j.properties b/test-apis-ci/src/main/resources/log4j.properties
index d313e92..02f7830 100644
--- a/test-apis-ci/src/main/resources/log4j.properties
+++ b/test-apis-ci/src/main/resources/log4j.properties
@@ -26,7 +26,7 @@
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n
log4j.logger.org.apache.cassandra.service.StorageProxy=INFO
-log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
+log4j.logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout
log4j.additivity.org.openecomp.sdc.ci.tests.utils=false
diff --git a/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml b/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
index 70a3e55..ba1526d 100644
--- a/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
+++ b/test-apis-ci/src/test/resources/config/test-apis-ci/configuration.yaml
@@ -26,15 +26,15 @@
toscaConformanceLevel: 8.0
minToscaConformanceLevel: 3.0
-titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
-titanInMemoryGraph: false
-titanLockTimeout: 1800
+janusGraphCfgFile: /home/vagrant/catalog-be/config/catalog-be/janusgraph.properties
+janusGraphInMemoryGraph: false
+janusGraphLockTimeout: 1800
-# The interval to try and reconnect to titan DB when it is down during ASDC startup:
-titanReconnectIntervalInSeconds: 3
+# The interval to try and reconnect to janusGraph DB when it is down during ASDC startup:
+janusGraphReconnectIntervalInSeconds: 3
-# The read timeout towards Titan DB when health check is invoked:
-titanHealthCheckReadTimeout: 1
+# The read timeout towards JanusGraph DB when health check is invoked:
+janusGraphHealthCheckReadTimeout: 1
# The interval to try and reconnect to Elasticsearch when it is down during ASDC startup:
esReconnectIntervalInSeconds: 3