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/asdctool/pom.xml b/asdctool/pom.xml
index 2bb4059..d7ac069 100644
--- a/asdctool/pom.xml
+++ b/asdctool/pom.xml
@@ -222,11 +222,10 @@
</exclusions>
</dependency>
- <!-- TITAN -->
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-core</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -241,6 +240,10 @@
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
+ <exclusion>
+ <artifactId>groovy</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ </exclusion>
</exclusions>
</dependency>
@@ -252,9 +255,9 @@
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-cassandra</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -265,27 +268,6 @@
</dependency>
<dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>tinkergraph-gremlin</artifactId>
- <version>3.0.1-incubating</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-groovy</artifactId>
- <version>3.0.1-incubating</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>groovy</artifactId>
- <groupId>org.codehaus.groovy</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- TITAN end -->
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging}</version>
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
index fbfcb2e..4de50f6 100644
--- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
@@ -12,17 +12,17 @@
end
-template "titan.properties" do
+template "janusgraph.properties" do
sensitive true
- path "/tmp/sdctool/config/titan.properties"
- source "titan.properties.erb"
+ path "/tmp/sdctool/config/janusgraph.properties"
+ source "janusgraph.properties.erb"
mode "0755"
variables({
:DC_NAME => node['cassandra']['datacenter_name'],
:cassandra_ip => node['Nodes']['CS'].first,
:cassandra_pwd => node['cassandra'][:cassandra_password],
:cassandra_usr => node['cassandra'][:cassandra_user],
- :titan_connection_timeout => node['cassandra']['titan_connection_timeout'],
+ :janusgraph_connection_timeout => node['cassandra']['janusgraph_connection_timeout'],
:replication_factor => node['cassandra']['replication_factor']
})
end
@@ -40,7 +40,7 @@
:cassandra_port => node['cassandra']['cassandra_port'],
:rep_factor => node['cassandra']['replication_factor'],
:DC_NAME => node['cassandra']['datacenter_name'],
- :titan_Path => "/tmp/sdctool/config/",
+ :janusgraph_Path => "/tmp/sdctool/config/",
:socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
:socket_read_timeout => node['cassandra']['socket_read_timeout'],
:cassandra_pwd => node['cassandra'][:cassandra_password],
@@ -66,9 +66,9 @@
EOH
end
-bash "excuting-titanSchemaCreation.sh" do
+bash "excuting-janusGraphSchemaCreation.sh" do
code <<-EOH
- chmod +x /tmp/sdctool/scripts/titanSchemaCreation.sh
- /tmp/sdctool/scripts/titanSchemaCreation.sh /tmp/sdctool/config
+ chmod +x /tmp/sdctool/scripts/janusGraphSchemaCreation.sh
+ /tmp/sdctool/scripts/janusGraphSchemaCreation.sh /tmp/sdctool/config
EOH
end
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
index 0a658bb..ab27886 100644
--- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
@@ -29,14 +29,14 @@
toscaConformanceLevel: 9.0
minToscaConformanceLevel: 3.0
-titanCfgFile: <%= @titan_Path %>/titan.properties
-titanInMemoryGraph: false
-titanLockTimeout: 1800
-# The interval to try and reconnect to titan DB when it is down during ASDC startup:
-titanReconnectIntervalInSeconds: 3
+janusGraphCfgFile: <%= @janusgraph_Path %>/janusgraph.properties
+janusGraphInMemoryGraph: false
+janusGraphLockTimeout: 1800
+# 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:
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/janusgraph.properties.erb
similarity index 93%
rename from asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb
rename to asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/janusgraph.properties.erb
index 20a97be..60c24d7 100644
--- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/janusgraph.properties.erb
@@ -3,7 +3,7 @@
storage.port=9160
storage.username=<%= @cassandra_usr %>
storage.password=<%= @cassandra_pwd %>
-storage.connection-timeout=<%= @titan_connection_timeout %>
+storage.connection-timeout=<%= @janusgraph_connection_timeout %>
storage.cassandra.keyspace=sdctitan
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
index 5c7d78e..44bfc53 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.asdctool;
-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.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
@@ -60,12 +60,12 @@
return responseBuilder.build();
}
- public static TitanGraph openGraph(Configuration conf) {
+ public static JanusGraph openGraph(Configuration conf) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- graph = TitanFactory.open(conf);
+ graph = JanusGraphFactory.open(conf);
} catch (Exception e) {
log.error("Failed to start open graph", e);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
index e411b53..53d299e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
@@ -1,20 +1,20 @@
package org.openecomp.sdc.asdctool.configuration;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
-@Import({TitanSpringConfig.class})
+@Import({JanusGraphSpringConfig.class})
public class GetConsumersConfiguration {
@Bean("consumer-operation")
- public ConsumerOperation consumerOperation(TitanGenericDao titanGenericDao) {
- return new ConsumerOperation(titanGenericDao);
+ public ConsumerOperation consumerOperation(JanusGraphGenericDao janusGraphGenericDao) {
+ return new ConsumerOperation(janusGraphGenericDao);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
index 0dd078d..5a82c69 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
@@ -1,10 +1,10 @@
package org.openecomp.sdc.asdctool.configuration;
import org.openecomp.sdc.asdctool.impl.VrfObjectFixHandler;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,24 +13,26 @@
@Configuration
public class VrfObjectFixConfiguration {
- @Bean(name = "titan-dao")
- public TitanDao titanDao(@Qualifier("titan-client") TitanGraphClient titanClient){
- return new TitanDao(titanClient);
+ @Bean(name = "janusgraph-dao")
+ public JanusGraphDao janusGraphDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient){
+ return new JanusGraphDao(janusGraphClient);
}
- @Bean(name = "titan-client")
+ @Bean(name = "janusgraph-client")
@Primary
- public TitanGraphClient titanClient(@Qualifier("dao-client-strategy") TitanClientStrategy titanClientStrategy) {
- return new TitanGraphClient(titanClientStrategy);
+ public JanusGraphClient janusGraphClient(@Qualifier("dao-client-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
}
@Bean(name ="dao-client-strategy")
- public TitanClientStrategy titanClientStrategy() {
- return new DAOTitanStrategy();
+ public JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
}
@Bean
- public VrfObjectFixHandler vrfObjectFixHandler(@Qualifier("titan-dao") TitanDao titanDao){
- return new VrfObjectFixHandler(titanDao);
+ public VrfObjectFixHandler vrfObjectFixHandler(@Qualifier("janusgraph-dao")
+ JanusGraphDao janusGraphDao){
+ return new VrfObjectFixHandler(janusGraphDao);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 03f3e41..cd19c1c 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -8,12 +8,12 @@
import org.openecomp.sdc.be.components.distribution.engine.VfModuleArtifactPayload;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
@@ -25,10 +25,10 @@
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -71,7 +71,7 @@
private static final String UTF8 = "utf-8";
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -140,7 +140,7 @@
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
log.info("Try to fetch resources with properties {} and not {}", hasProps, hasNotProps);
- Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao
+ Either<List<GraphVertex>, JanusGraphOperationStatus> servicesByCriteria = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll);
if (servicesByCriteria.isRight()) {
log.info("Failed to fetch resources {}", servicesByCriteria.right().value());
@@ -182,14 +182,14 @@
writeModuleResultToFile(writer, resource, null);
writer.flush();
}
- titanDao.commit();
+ janusGraphDao.commit();
}
} catch (Exception e) {
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -228,7 +228,7 @@
writer.flush();
}
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
@@ -237,7 +237,7 @@
log.info("Failed to fetch services ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -259,7 +259,7 @@
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
log.info("Try to fetch services with properties {} and not {}", hasProps, hasNotProps);
- Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao
+ Either<List<GraphVertex>, JanusGraphOperationStatus> servicesByCriteria = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll);
if (servicesByCriteria.isRight()) {
log.info("Failed to fetch services {}", servicesByCriteria.right().value());
@@ -290,14 +290,14 @@
}
- titanDao.commit();
+ janusGraphDao.commit();
}
log.info("output file with list of services : {}", fileName);
} catch (Exception e) {
log.info("Failed to fetch services ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -608,7 +608,7 @@
res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS,
EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts);
}
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(component);
}
@@ -639,7 +639,7 @@
res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS,
EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts);
}
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(component);
}
@@ -660,7 +660,7 @@
} catch (IOException e) {
log.error(e.getMessage());
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
log.info(" Fix finished with res {} ***** ", res);
return res;
@@ -688,7 +688,7 @@
Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts();
res = fixDataOnGraph(c.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, EdgeLabelEnum.TOSCA_ARTIFACTS,
arifacts);
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(c);
}
@@ -737,9 +737,9 @@
}
} finally {
if (res)
- titanDao.commit();
+ janusGraphDao.commit();
else
- titanDao.rollback();
+ janusGraphDao.rollback();
}
log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent finished component name {} id {} res {}",
c.getName(), c.getUniqueId(), res);
@@ -751,7 +751,7 @@
log.debug("amount groups to update: VertexTypeEnum {} EdgeLabelEnum {} data size {}", vertexTypeEnum.getName(),
edgeLabelEnum, groups.size());
boolean res = true;
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentId,
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao.getVertexById(componentId,
JsonParseFlagEnum.NoParse);
if (getResponse.isRight()) {
log.debug("Couldn't fetch component unique id {}, error: {}", componentId, getResponse.right().value());
@@ -762,9 +762,9 @@
GraphVertex componentVertex = getResponse.left().value();
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> groupVertexEither = titanDao.getChildVertex(componentVertex,
+ Either<GraphVertex, JanusGraphOperationStatus> groupVertexEither = janusGraphDao.getChildVertex(componentVertex,
edgeLabelEnum, JsonParseFlagEnum.ParseJson);
- if (groupVertexEither.isRight() && groupVertexEither.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (groupVertexEither.isRight() && groupVertexEither.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("no child {} vertex for component unique id {}, error: {}", edgeLabelEnum, componentId,
groupVertexEither.right().value());
return true;
@@ -777,11 +777,11 @@
if (res) {
toscaDataVertex = groupVertexEither.left().value();
toscaDataVertex.setJson(groups);
- Either<GraphVertex, TitanOperationStatus> updatevertexEither = titanDao.updateVertex(toscaDataVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updatevertexEither = janusGraphDao.updateVertex(toscaDataVertex);
if (updatevertexEither.isRight()) {
log.debug("failed to update vertex for component unique id {}, error: {}", componentId,
updatevertexEither.right().value());
- titanDao.rollback();
+ janusGraphDao.rollback();
return false;
}
}
@@ -1081,7 +1081,8 @@
Map<String, List<Component>> result = new HashMap<>();
try {
- Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resultsEither = janusGraphDao
+ .getByCriteria(type, hasProps);
if (resultsEither.isRight()) {
log.error("getVerticesToValidate failed {} ",resultsEither.right().value());
return result;
@@ -1107,7 +1108,7 @@
} else {
compList.add(toscaElement.left().value());
}
- titanDao.commit();
+ janusGraphDao.commit();
});
@@ -1115,7 +1116,7 @@
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
@@ -1161,7 +1162,7 @@
} else {
compListfull.add(toscaElement.left().value());
}
- this.titanDao.commit();
+ this.janusGraphDao.commit();
}
compToFix.put(entry.getKey(), compListfull);
@@ -1174,7 +1175,7 @@
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
index b404404..57a7c25 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
@@ -33,13 +33,13 @@
import java.util.concurrent.atomic.AtomicInteger;
/**
- * simple util class to verify that the titan export json graph is not corrupted
+ * simple util class to verify that the janusgraph export json graph is not corrupted
*/
public class GraphJsonValidator {
private static Logger log = Logger.getLogger(GraphJsonValidator.class.getName());
- public boolean verifyTitanJson(String filePath) throws IOException {
+ public boolean verifyJanusGraphJson(String filePath) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
List<Integer> invalidRows = new ArrayList<>();
AtomicInteger atomicInteger = new AtomicInteger(1);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
index d43b3b8..ee33c82 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
@@ -21,11 +21,11 @@
package org.openecomp.sdc.asdctool.impl;
import com.google.gson.Gson;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
-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.JanusGraphQuery;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.*;
@@ -79,11 +79,11 @@
public boolean importGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String inputFile = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
List<ImmutablePair<String, String>> propertiesCriteriaToDelete = new ArrayList<>();
ImmutablePair<String, String> immutablePair1 = new ImmutablePair<>("healthcheckis", "GOOD");
@@ -113,11 +113,11 @@
public boolean exportGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = exportJsonGraph(graph, outputDirectory);
@@ -140,12 +140,12 @@
public String exportGraphMl(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
String result = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
result = exportGraphMl(graph, outputDirectory);
@@ -164,11 +164,11 @@
public boolean findErrorInJsonGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = findErrorInJsonGraph(graph, outputDirectory);
@@ -189,13 +189,13 @@
return true;
}
- public TitanGraph openGraph(String titanFileLocation) {
+ public JanusGraph openGraph(String janusGraphFileLocation) {
- return TitanFactory.open(titanFileLocation);
+ return JanusGraphFactory.open(janusGraphFileLocation);
}
- public String exportJsonGraph(TitanGraph graph, String outputDirectory) {
+ public String exportJsonGraph(JanusGraph graph, String outputDirectory) {
String result = null;
@@ -231,7 +231,7 @@
}
- public String exportGraphMl(TitanGraph graph, String outputDirectory) {
+ public String exportGraphMl(JanusGraph graph, String outputDirectory) {
String result = null;
String outputFile = outputDirectory + File.separator + EXPORT_GRAPH + System.currentTimeMillis() + ".graphml";
try {
@@ -253,7 +253,7 @@
return builder.create();
}
- public boolean importJsonGraph(TitanGraph graph, String graphJsonFile,
+ public boolean importJsonGraph(JanusGraph graph, String graphJsonFile,
List<ImmutablePair<String, String>> propertiesCriteriaToDelete) {
boolean result = false;
@@ -312,7 +312,7 @@
}
- public String findErrorInJsonGraph(TitanGraph graph, String outputDirectory) {
+ public String findErrorInJsonGraph(JanusGraph graph, String outputDirectory) {
boolean runVertexScan = false;
boolean runEdgeScan = false;
@@ -331,8 +331,8 @@
Vertex vertexTo = null;
Edge edge = null;
- Iterable<TitanEdge> edges = graph.query().edges();
- Iterator<TitanEdge> iterator = edges.iterator();
+ Iterable<JanusGraphEdge> edges = graph.query().edges();
+ Iterator<JanusGraphEdge> iterator = edges.iterator();
while (iterator.hasNext()) {
try {
@@ -344,12 +344,12 @@
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty(STORAGE_BACKEND, INMEMORY);
- TitanGraph openGraph = Utils.openGraph(conf);
+ JanusGraph openGraph = Utils.openGraph(conf);
- TitanVertex addVertexFrom = openGraph.addVertex();
+ JanusGraphVertex addVertexFrom = openGraph.addVertex();
Utils.setProperties(addVertexFrom, Utils.getProperties(vertexFrom));
- TitanVertex addVertexTo = openGraph.addVertex();
+ JanusGraphVertex addVertexTo = openGraph.addVertex();
Utils.setProperties(addVertexTo, Utils.getProperties(vertexTo));
Edge addEdge = addVertexFrom.addEdge(edge.label(), addVertexTo);
@@ -394,9 +394,9 @@
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty(STORAGE_BACKEND, INMEMORY);
- TitanGraph openGraph = Utils.openGraph(conf);
+ JanusGraph openGraph = Utils.openGraph(conf);
- TitanVertex addVertexFrom = openGraph.addVertex();
+ JanusGraphVertex addVertexFrom = openGraph.addVertex();
Utils.setProperties(addVertexFrom, Utils.getProperties(vertex));
log.info(FROM_VERTEX, Utils.getProperties(addVertexFrom));
@@ -426,7 +426,7 @@
}
- Iterable<TitanVertex> vertices2 = graph.query()
+ Iterable<JanusGraphVertex> vertices2 = graph.query()
.has(GraphPropertiesDictionary.HEALTH_CHECK.getProperty(), "GOOD").vertices();
;
@@ -458,17 +458,17 @@
}
- private void removeNodesByLabel(TitanGraph graph, String label) {
- Iterable<TitanVertex> vertices = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), label)
+ private void removeNodesByLabel(JanusGraph graph, String label) {
+ Iterable<JanusGraphVertex> vertices = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), label)
.vertices();
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex next2 = iterator.next();
next2.remove();
}
}
- public String exportUsers(TitanGraph graph, String outputDirectory) {
+ public String exportUsers(JanusGraph graph, String outputDirectory) {
List<Map<String, Object>> users = new ArrayList<>();
String result = null;
@@ -478,11 +478,11 @@
FileWriter fileWriter = null;
try {
- TitanGraphQuery graphQuery = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(),
+ JanusGraphQuery graphQuery = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(),
NodeTypeEnum.User.getName());
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = graphQuery.vertices();
+ Iterable<JanusGraphVertex> vertices = graphQuery.vertices();
if (vertices != null) {
for (Vertex v : vertices) {
@@ -538,11 +538,11 @@
public boolean exportUsers(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = exportUsers(graph, outputDirectory);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java
similarity index 87%
rename from asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java
rename to asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java
index 8b89cc2..fbebe2c 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.*;
-import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
-import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
+import org.janusgraph.core.*;
+import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
@@ -43,34 +43,34 @@
import java.util.HashMap;
import java.util.Map;
-public class TitanGraphInitializer {
+public class JanusGraphInitializer {
- private static Logger logger = LoggerFactory.getLogger(TitanGraphInitializer.class.getName());
- private static TitanGraph graph;
+ private static Logger logger = LoggerFactory.getLogger(JanusGraphInitializer.class.getName());
+ private static JanusGraph graph;
- public static boolean createGraph(String titanCfgFile) {
- logger.info("** createGraph with {}", titanCfgFile);
+ public static boolean createGraph(String janusGraphCfgFile) {
+ logger.info("** createGraph with {}", janusGraphCfgFile);
try {
- logger.info("createGraph : try to load file {}", titanCfgFile);
- graph = TitanFactory.open(titanCfgFile);
+ logger.info("createGraph : try to load file {}", janusGraphCfgFile);
+ graph = JanusGraphFactory.open(janusGraphCfgFile);
if (graph.isClosed()) {
return false;
}
- } catch (TitanException e) {
- logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile, e);
+ } catch (JanusGraphException e) {
+ logger.info("createGraph : failed to open JanusGraph graph with configuration file: {}", janusGraphCfgFile, e);
return false;
}
createIndexesAndDefaults();
- logger.info("** Titan graph created ");
+ logger.info("** JanusGraph graph created ");
return true;
}
private static boolean isVertexExist(Map<String, Object> properties) {
- TitanGraphQuery query = graph.query();
+ JanusGraphQuery query = graph.query();
if (properties != null && !properties.isEmpty()) {
for (Map.Entry<String, Object> entry : properties.entrySet()) {
@@ -127,8 +127,8 @@
private static void createVertexIndixes() {
logger.info("** createVertexIndixes started");
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
+ JanusGraphManagement graphMgt = graph.openManagement();
+ JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
@@ -170,7 +170,7 @@
private static void createEdgeIndixes() {
logger.info("** createEdgeIndixes started");
- TitanManagement graphMgt = graph.openManagement();
+ JanusGraphManagement graphMgt = graph.openManagement();
for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
index d8b8936..883f5e5 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -39,10 +39,10 @@
private static Logger log = Logger.getLogger(ProductLogic.class.getName());
- public boolean deleteAllProducts(String titanFile, String beHost, String bePort, String adminUser) {
+ public boolean deleteAllProducts(String janusGraphFile, String beHost, String bePort, String adminUser) {
log.debug("retrieving all products from graph");
RestUtils restUtils = null;
- List<String> productList = getAllProducts(titanFile);
+ List<String> productList = getAllProducts(janusGraphFile);
restUtils = new RestUtils();
if (productList != null) {
for (String productUid : productList) {
@@ -56,15 +56,15 @@
}
}
- private List<String> getAllProducts(String titanFile) {
- TitanGraph graph = null;
+ private List<String> getAllProducts(String janusGraphFile) {
+ JanusGraph graph = null;
try {
- graph = openGraph(titanFile);
+ graph = openGraph(janusGraphFile);
List<String> productsToDelete = new ArrayList<String>();
Iterable vertices = graph.query()
.has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName()).vertices();
if (vertices != null) {
- Iterator<TitanVertex> iter = vertices.iterator();
+ Iterator<JanusGraphVertex> iter = vertices.iterator();
while (iter.hasNext()) {
Vertex vertex = iter.next();
String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
@@ -88,9 +88,9 @@
}
}
- private TitanGraph openGraph(String titanFileLocation) {
+ private JanusGraph openGraph(String janusGraphFileLocation) {
- return TitanFactory.open(titanFileLocation);
+ return JanusGraphFactory.open(janusGraphFileLocation);
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy
new file mode 100644
index 0000000..9c69a78
--- /dev/null
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy
@@ -0,0 +1,66 @@
+/*
+ * Before starting the migration, please make sure to create a backup of sdctitan keyspace in cassandra
+ *
+ * Usage Instructions :
+ * 1. Download JanusGraph gremlin in-built package from below URL;
+ * https://github.com/JanusGraph/janusgraph/releases/download/v0.3.1/janusgraph-0.3.1-hadoop2.zip
+ * 2. Unzip it and navigate to bin folder.
+ * 3. Run below command.
+ * Command : ./gremlin.sh -l <LOG_LEVEL> -e <Path_To_This_Script_File> <Path_To_Properties_File>
+ * Example : ./gremlin.sh -l ERROR -e /data/scripts/TitanToJanusGraphMigration.groovy /data/scripts/titan.properties
+ *
+ * Note: Please make sure that the above provided property file have the below field present;
+ * graph.allow-upgrade=true
+*/
+
+// Check for open database connections; should be only one
+def Object checkAndCloseMultipleInstances(Object mgmt, Object graph, long sleepTime){
+ if(mgmt.getOpenInstances().size() > 1) {
+ for (String instanceId in mgmt.getOpenInstances())
+ if(!instanceId.contains("current"))
+ mgmt.forceCloseInstance(instanceId);
+ mgmt.commit();
+ sleep(sleepTime);
+ mgmt = graph.openManagement();
+ }
+ return mgmt;
+}
+
+// Update the ID Store
+def updateGraphIDStore(Object mgmt, long sleepTime){
+ mgmt.set('ids.store-name', 'titan_ids');
+ mgmt.commit();
+ sleep(sleepTime);
+}
+
+// Verify the ID Store
+def verifyUpdatedGraphIDStore(String propertyPath){
+ graph = JanusGraphFactory.open(propertyPath);
+ mgmt = graph.openManagement();
+ if(!mgmt.get('ids.store-name').equals("titan_ids"))
+ throw new GroovyRuntimeException("FAILURE -> Error in setting up the ID Store to titan_ids; please contact system administrator... ");
+ else
+ println("SUCCESS -> Titan ID Store has also been set correctly... ");
+}
+
+try {
+ graph = JanusGraphFactory.open(args[0]);
+ mgmt = graph.openManagement();
+
+ // Check if titan graph is upgraded to Janus Graph compatibility
+ if(mgmt.get('graph.titan-version').equals("1.0.0"))
+ throw new GroovyRuntimeException("FAILURE -> Titan graph is not upgraded to Janus. please make sure graph.allow-upgrade property is set to true in properties file and re-run the script.");
+ println("SUCCESS -> Titan Graph data is upgraded to Janus compatible Graph... ");
+
+ // Update the ID Store if required
+ if(mgmt.get('ids.store-name').equals("janusgraph_ids")){
+ mgmt = checkAndCloseMultipleInstances(mgmt, graph,2000l);
+ updateGraphIDStore(mgmt, 2000l);
+ verifyUpdatedGraphIDStore(args[0]);
+ }
+ println("SUCCESS -> Titan to Janus Graph upgrade process is now complete... ");
+
+} catch(Exception ex){
+ println("FAILURE -> Titan to Janus Graph migration process has failed; please check the exception trace for more details.");
+ throw ex;
+}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
index 774af48..9911fb7 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphQuery;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.Utils;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
@@ -38,21 +38,21 @@
private static Logger log = Logger.getLogger(UpdatePropertyOnVertex.class.getName());
- public Integer updatePropertyOnServiceAtLeastCertified(String titanFile, Map<String, Object> keyValueToSet,
+ public Integer updatePropertyOnServiceAtLeastCertified(String janusGraphFile, Map<String, Object> keyValueToSet,
List<Map<String, Object>> orCriteria) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
Integer numberOfUpdatedVertexes = 0;
try {
- graph = openGraph(titanFile);
+ graph = openGraph(janusGraphFile);
if (orCriteria != null && false == orCriteria.isEmpty()) {
for (Map<String, Object> criteria : orCriteria) {
- TitanGraphQuery<? extends TitanGraphQuery> query = graph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = graph.query();
if (criteria != null && !criteria.isEmpty()) {
for (Map.Entry<String, Object> entry : criteria.entrySet()) {
@@ -112,10 +112,10 @@
}
- private Integer updateVertexes(Map<String, Object> keyValueToSet, TitanGraph graph, Map<String, Object> criteria) {
+ private Integer updateVertexes(Map<String, Object> keyValueToSet, JanusGraph graph, Map<String, Object> criteria) {
Integer numberOfUpdatedVertexesPerService = 0;
- TitanGraphQuery<? extends TitanGraphQuery> updateQuery = graph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> updateQuery = graph.query();
if (criteria != null && !criteria.isEmpty()) {
for (Map.Entry<String, Object> entry : criteria.entrySet()) {
@@ -159,9 +159,9 @@
return numberOfUpdatedVertexesPerService;
}
- public TitanGraph openGraph(String titanFileLocation) {
+ public JanusGraph openGraph(String janusGraphFileLocation) {
- TitanGraph graph = TitanFactory.open(titanFileLocation);
+ JanusGraph graph = JanusGraphFactory.open(janusGraphFileLocation);
return graph;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
index 8eec510..1c7afef 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
@@ -6,18 +6,18 @@
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.migration.tasks.handlers.XlsOutputHandler;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
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.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -42,10 +42,10 @@
private XlsOutputHandler outputHandler;
private final String sheetName = this.getClass().getSimpleName() + "Report";
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public VrfObjectFixHandler(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public VrfObjectFixHandler(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
public boolean handle(String mode, String outputPath) {
@@ -65,10 +65,10 @@
try{
Map<GraphVertex,Map<Vertex, List<ComponentInstanceDataDefinition>>> corruptedData = fetchCorruptedData();
corruptedData.forEach(this::fixCorruptedVfrObjectAndRelatedInstances);
- titanDao.commit();
+ janusGraphDao.commit();
writeOutput(corruptedData);
} catch (Exception e){
- titanDao.rollback();
+ janusGraphDao.rollback();
log.debug("#fixCorruptedData - Failed to detect corrupted data. The exception occurred: ", e);
return false;
}
@@ -93,7 +93,7 @@
private void fixCorruptedVfrObject(GraphVertex vfrObjectV) {
vfrObjectV.getMetadataProperties().put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, VALID_TOSCA_NAME);
- titanDao.updateVertex(vfrObjectV).left().on(this::rightOnUpdate);
+ janusGraphDao.updateVertex(vfrObjectV).left().on(this::rightOnUpdate);
}
private Map<GraphVertex,Map<Vertex,List<ComponentInstanceDataDefinition>>> fetchCorruptedData(){
@@ -106,7 +106,7 @@
private List<GraphVertex> getCorruptedVrfObjects() {
Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class);
props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, "org.openecomp.resource.configuration.VRFObject");
- return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, props).left().on(this::rightOnGet);
+ return janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, props).left().on(this::rightOnGet);
}
private void fillCorruptedData(GraphVertex vrfObjectV, Map<GraphVertex, Map<Vertex, List<ComponentInstanceDataDefinition>>> findToUpdate) {
@@ -115,7 +115,8 @@
Iterator<Edge> instanceEdges = vrfObjectV.getVertex().edges(Direction.IN, EdgeLabelEnum.INSTANCE_OF.name());
while(instanceEdges.hasNext()){
Edge edge = instanceEdges.next();
- putCorruptedInstances(corruptedInstances, edge, (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES));
+ putCorruptedInstances(corruptedInstances, edge, (List<String>) janusGraphDao
+ .getProperty(edge, EdgePropertyEnum.INSTANCES));
}
}
@@ -139,7 +140,7 @@
String jsonMetadataStr = JsonParserUtils.toJson(jsonObj);
container.property(GraphPropertyEnum.JSON.getProperty(), jsonMetadataStr);
} catch (IOException e) {
- throw new StorageException("Failed to fix the corrupted instances of the container", e, TitanOperationStatus.GENERAL_ERROR);
+ throw new StorageException("Failed to fix the corrupted instances of the container", e, JanusGraphOperationStatus.GENERAL_ERROR);
}
}
@@ -159,7 +160,7 @@
private Map getJsonMap(Vertex container) {
String json = (String)container.property(GraphPropertyEnum.JSON.getProperty()).value();
- Map<GraphPropertyEnum, Object> properties = titanDao.getVertexProperties(container);
+ Map<GraphPropertyEnum, Object> properties = janusGraphDao.getVertexProperties(container);
VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL)));
return JsonParserUtils.toMap(json, label != null ? label.getClassOfJson() : null);
}
@@ -175,13 +176,13 @@
}
}
- private List<GraphVertex> rightOnGet(TitanOperationStatus status) {
- if(status == TitanOperationStatus.NOT_FOUND){
+ private List<GraphVertex> rightOnGet(JanusGraphOperationStatus status) {
+ if(status == JanusGraphOperationStatus.NOT_FOUND){
return emptyList();
}
throw new StorageException(status);
}
- private GraphVertex rightOnUpdate(TitanOperationStatus status) {
+ private GraphVertex rightOnUpdate(JanusGraphOperationStatus status) {
throw new StorageException(status);
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
index 7007c6d..40680af 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
@@ -42,33 +42,27 @@
import org.openecomp.sdc.asdctool.utils.ConsoleWriter;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.be.tosca.CsarUtils;
-import org.openecomp.sdc.be.tosca.ToscaError;
import org.openecomp.sdc.be.tosca.ToscaExportHandler;
-import org.openecomp.sdc.be.tosca.ToscaRepresentation;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.GeneralUtility;
-import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
-import fj.data.Either;
-
@org.springframework.stereotype.Component("csarGenerator")
public class CsarGenerator extends CommonInternalTool {
public CsarGenerator() {
@@ -76,7 +70,7 @@
}
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private CsarUtils csarUtils;
@Autowired
@@ -90,14 +84,15 @@
private static Logger log = Logger.getLogger(CsarGenerator.class.getName());
public void generateCsar(String uuid, Scanner scanner) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class);
props.put(GraphPropertyEnum.UUID, uuid);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
- List<GraphVertex> byCriterria = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props).either(l -> l, r -> null);
+ List<GraphVertex> byCriterria = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props).either(l -> l, r -> null);
if (byCriterria != null && !byCriterria.isEmpty()) {
if (byCriterria.size() > 1) {
ConsoleWriter.dataLine("Warning ! More that 1 certified service with uuid", uuid);
@@ -116,15 +111,15 @@
} else {
ConsoleWriter.dataLine("No certified service with UUID", uuid);
}
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus handleService(GraphVertex metadataV, String uuid) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ private JanusGraphOperationStatus handleService(GraphVertex metadataV, String uuid) {
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
org.openecomp.sdc.be.model.Component component = toscaOperationFacade.getToscaFullElement(metadataV.getUniqueId()).either(l -> l, r -> null);
if (component != null) {
@@ -134,11 +129,12 @@
supplier = () -> generateCsarPayload(component);
generateArtifact(component, ArtifactTypeEnum.TOSCA_CSAR, supplier);
- GraphVertex toscaArtifactV = titanDao.getChildVertex(metadataV, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson).either(l->l, r->null);
+ GraphVertex toscaArtifactV = janusGraphDao
+ .getChildVertex(metadataV, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson).either(l->l, r->null);
if ( toscaArtifactV != null ){
Map<String, ArtifactDataDefinition> copy = component.getToscaArtifacts().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
toscaArtifactV.setJson(copy);
- titanDao.updateVertex(toscaArtifactV);
+ janusGraphDao.updateVertex(toscaArtifactV);
}
} else {
@@ -147,8 +143,8 @@
return status;
}
- private TitanOperationStatus generateArtifact(Component component, ArtifactTypeEnum artifactType, Supplier<byte[]> supplier){
- TitanOperationStatus status = TitanOperationStatus.GENERAL_ERROR;
+ private JanusGraphOperationStatus generateArtifact(Component component, ArtifactTypeEnum artifactType, Supplier<byte[]> supplier){
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.GENERAL_ERROR;
ArtifactDefinition csarArtifact = null;
Optional<ArtifactDefinition> op = component.getToscaArtifacts().values().stream().filter(p -> p.getArtifactType().equals(artifactType.getType())).findAny();
if (op.isPresent()) {
@@ -166,12 +162,12 @@
return toscaExportHandler.exportComponent(component).either(l -> l.getMainYaml().getBytes(), r -> null);
}
- private TitanOperationStatus savePayload(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact, Supplier<byte[]> supplier) {
+ private JanusGraphOperationStatus savePayload(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact, Supplier<byte[]> supplier) {
byte[] payload = supplier.get();
if ( payload == null ) {
ConsoleWriter.dataLine("create artifact failed ", csarArtifact.getArtifactLabel());
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
ConsoleWriter.dataLine("createartifact success ", csarArtifact.getArtifactLabel());
csarArtifact.setPayload(payload);
@@ -190,7 +186,7 @@
ConsoleWriter.dataLine("Artifact generated and saved into Cassandra ", csarArtifact.getArtifactLabel());
report(component, csarArtifact);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private void report(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
index e7f42c9..76fcec8 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
@@ -29,21 +29,21 @@
*/
package org.openecomp.sdc.asdctool.impl.internal.tool;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.utils.ConsoleWriter;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -56,7 +56,7 @@
@Component("deleteComponentHandler")
public class DeleteComponentHandler extends CommonInternalTool{
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private NodeTypeOperation nodeTypeOperation;
@Autowired
@@ -70,23 +70,23 @@
super("delete");
}
public void deleteComponent(String id, Scanner scanner) {
- TitanOperationStatus status = TitanOperationStatus.OK;
- GraphVertex metadataVertex = titanDao.getVertexById(id).either(l -> l, r -> null);
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
+ GraphVertex metadataVertex = janusGraphDao.getVertexById(id).either(l -> l, r -> null);
if (metadataVertex != null) {
status = handleComponent(scanner, metadataVertex);
} else {
ConsoleWriter.dataLine("No vertex for id", id);
}
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus handleComponent(Scanner scanner, GraphVertex metadataVertex) {
+ private JanusGraphOperationStatus handleComponent(Scanner scanner, GraphVertex metadataVertex) {
Map<GraphPropertyEnum, Object> metadataProperties = metadataVertex.getMetadataProperties();
- TitanOperationStatus status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
printComponentInfo(metadataProperties);
Iterator<Edge> edges = metadataVertex.getVertex().edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
@@ -107,12 +107,12 @@
return status;
}
- private TitanOperationStatus handleComponent(GraphVertex metadataVertex) {
+ private JanusGraphOperationStatus handleComponent(GraphVertex metadataVertex) {
ToscaElementOperation toscaElementOperation = getOperationByLabel(metadataVertex);
Iterator<Edge> edges = metadataVertex.getVertex().edges(Direction.IN, EdgeLabelEnum.VERSION.name());
if (edges != null && edges.hasNext()) {
- TitanOperationStatus status = updatePreviousVersion(metadataVertex, edges);
- if ( status != TitanOperationStatus.OK ){
+ JanusGraphOperationStatus status = updatePreviousVersion(metadataVertex, edges);
+ if ( status != JanusGraphOperationStatus.OK ){
return status;
}
}
@@ -121,28 +121,28 @@
.map(l -> {
ConsoleWriter.dataLine("\nDeleted");
report(metadataVertex);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
})
.right()
.map(r-> {
ConsoleWriter.dataLine("\nFailed to delete. see log file");
return r;
});
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus updatePreviousVersion(GraphVertex metadataVertex, Iterator<Edge> edges) {
+ private JanusGraphOperationStatus updatePreviousVersion(GraphVertex metadataVertex, Iterator<Edge> edges) {
Edge edge = edges.next();
- TitanVertex prevVersionVertex = (TitanVertex) edge.outVertex();
+ JanusGraphVertex prevVersionVertex = (JanusGraphVertex) edge.outVertex();
// check if previous version is deleted
- Boolean isDeleted = (Boolean) titanDao.getProperty(prevVersionVertex, GraphPropertyEnum.IS_DELETED.getProperty());
+ Boolean isDeleted = (Boolean) janusGraphDao.getProperty(prevVersionVertex, GraphPropertyEnum.IS_DELETED.getProperty());
if (isDeleted != null && isDeleted) {
ConsoleWriter.dataLine("\nPrevoius version is marked as deleted. Component cannot be deleted");
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
// update highest property for previous version
- TitanOperationStatus status = updateStateOfPreviuosVersion(prevVersionVertex);
- if ( TitanOperationStatus.OK != status ){
+ JanusGraphOperationStatus status = updateStateOfPreviuosVersion(prevVersionVertex);
+ if ( JanusGraphOperationStatus.OK != status ){
return status;
}
@@ -150,51 +150,54 @@
return connectToCatalogAndArchive(metadataVertex, prevVersionVertex);
}
- private TitanOperationStatus updateStateOfPreviuosVersion(TitanVertex prevVersionVertex) {
- String prevId = (String) titanDao.getProperty(prevVersionVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
- Either<GraphVertex, TitanOperationStatus> prevGraphVertex = titanDao.getVertexById(prevId);
+ private JanusGraphOperationStatus updateStateOfPreviuosVersion(JanusGraphVertex prevVersionVertex) {
+ String prevId = (String) janusGraphDao.getProperty(prevVersionVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ Either<GraphVertex, JanusGraphOperationStatus> prevGraphVertex = janusGraphDao.getVertexById(prevId);
GraphVertex prevVertex = prevGraphVertex.left().value();
prevVertex.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- titanDao.updateVertex(prevVertex);
+ janusGraphDao.updateVertex(prevVertex);
Iterator<Edge> edgesIter = prevVersionVertex.edges(Direction.IN, EdgeLabelEnum.LAST_STATE.name());
if ( edgesIter.hasNext() ) {
Edge lastStateEdge = edgesIter.next();
Vertex lastModifier = lastStateEdge.outVertex();
- TitanOperationStatus replaceRes = titanDao.replaceEdgeLabel(lastModifier, prevVersionVertex, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
- if (replaceRes != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ replaceRes = janusGraphDao
+ .replaceEdgeLabel(lastModifier, prevVersionVertex, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
+ if (replaceRes != JanusGraphOperationStatus.OK) {
log.info("Failed to replace label from {} to {}. status = {}", EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE, replaceRes);
ConsoleWriter.dataLine("\nFailed to replace LAST_STATE edge . Failed to delete");
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus connectToCatalogAndArchive(GraphVertex metadataVertex, TitanVertex prevVersionVertex) {
+ private JanusGraphOperationStatus connectToCatalogAndArchive(GraphVertex metadataVertex, JanusGraphVertex prevVersionVertex) {
- TitanOperationStatus status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.CATALOG_ELEMENT, VertexTypeEnum.CATALOG_ROOT);
- if ( status == TitanOperationStatus.OK ){
+ JanusGraphOperationStatus
+ status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.CATALOG_ELEMENT, VertexTypeEnum.CATALOG_ROOT);
+ if ( status == JanusGraphOperationStatus.OK ){
status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.ARCHIVE_ELEMENT, VertexTypeEnum.ARCHIVE_ROOT);
}
return status;
}
- private TitanOperationStatus connectByLabel(GraphVertex metadataVertex, TitanVertex prevVersionVertex, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexlabel) {
+ private JanusGraphOperationStatus connectByLabel(GraphVertex metadataVertex, JanusGraphVertex prevVersionVertex, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexlabel) {
Iterator<Edge> edgesToCatalog = metadataVertex.getVertex().edges(Direction.IN, edgeLabel.name());
if ( edgesToCatalog != null && edgesToCatalog.hasNext() ){
//exist edge move to prev version
- Either<GraphVertex, TitanOperationStatus> catalog = titanDao.getVertexByLabel(vertexlabel);
+ Either<GraphVertex, JanusGraphOperationStatus> catalog = janusGraphDao.getVertexByLabel(vertexlabel);
if (catalog.isRight()) {
log.debug("Failed to fetch {} vertex, error {}", vertexlabel, catalog.right().value());
return catalog.right().value();
}
GraphVertex catalogV = catalog.left().value();
Edge edge = edgesToCatalog.next();
- return titanDao.createEdge(catalogV.getVertex(), prevVersionVertex, edgeLabel, edge );
+ return janusGraphDao.createEdge(catalogV.getVertex(), prevVersionVertex, edgeLabel, edge );
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private boolean isReferenceExist(GraphVertex metadataVertex) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
index eb25744..02b37b7 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
@@ -8,14 +8,14 @@
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask;
import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraClient;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
-import org.openecomp.sdc.be.model.jsontitan.operations.*;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -81,14 +81,15 @@
return new CassandraClient();
}
- @Bean(name = "dao-titan-strategy")
- public TitanClientStrategy daoStrategy() {
- return new DAOTitanStrategy();
+ @Bean(name = "dao-janusgraph-strategy")
+ public JanusGraphClientStrategy daoStrategy() {
+ return new DAOJanusGraphStrategy();
}
- @Bean(name = "migration-titan-client", initMethod = "createGraph")
- public TitanGraphClient titanMigrationClient(@Qualifier("dao-titan-strategy") TitanClientStrategy titanClientStrategy) {
- return new TitanGraphClient(titanClientStrategy);
+ @Bean(name = "migration-janusgraph-client", initMethod = "createGraph")
+ public JanusGraphClient janusGraphMigrationClient(@Qualifier("dao-janusgraph-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
}
@Bean(name = "tosca-operation-facade")
@@ -116,9 +117,9 @@
return new ByToscaNameDerivedNodeTypeResolver();
}
- @Bean(name = "titan-dao")
- public TitanDao titanDao(@Qualifier("migration-titan-client") TitanGraphClient titanGraphClient) {
- return new TitanDao(titanGraphClient);
+ @Bean(name = "janusgraph-dao")
+ public JanusGraphDao janusGraphDao(@Qualifier("migration-janusgraph-client") JanusGraphClient janusGraphClient) {
+ return new JanusGraphDao(janusGraphClient);
}
@Bean(name = "category-operation")
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
index 34696b3..57053eb 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
@@ -2,15 +2,15 @@
import fj.data.Either;
import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@
public class ArtifactValidatorExecuter{
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -42,7 +42,8 @@
public Map<String, List<Component>> getVerticesToValidate(VertexTypeEnum type, Map<GraphPropertyEnum, Object> hasProps){
Map<String, List<Component>> result = new HashMap<>();
- Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resultsEither = janusGraphDao
+ .getByCriteria(type, hasProps);
if (resultsEither.isRight()) {
log.error("getVerticesToValidate failed "+ resultsEither.right().value());
return result;
@@ -101,7 +102,7 @@
log.error("Failed to fetch vf resources ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
index a10d319..79bf510 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
@@ -5,9 +5,9 @@
import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -24,7 +24,7 @@
private static Logger log = Logger.getLogger(VfValidatorExecuter.class.getName());
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
protected String name;
@@ -43,7 +43,8 @@
props.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF);
}
- Either<List<GraphVertex>, TitanOperationStatus> results = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> results = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
if (results.isRight()) {
log.error("getVerticesToValidate failed "+ results.right().value());
return new ArrayList<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
index faccd64..433ea9e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
@@ -8,9 +8,9 @@
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
index 272b546..dd1f54f 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
@@ -11,9 +11,9 @@
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
index fe117d1..d2d5e77 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
@@ -22,7 +22,7 @@
package org.openecomp.sdc.asdctool.main;
-import org.openecomp.sdc.asdctool.impl.TitanGraphInitializer;
+import org.openecomp.sdc.asdctool.impl.JanusGraphInitializer;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaBuilder;
import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils;
@@ -62,14 +62,14 @@
System.exit(2);
}
break;
- case "create-titan-structures":
- log.debug("Start create titan keyspace");
- String titanCfg = 2 == args.length ? configurationManager.getConfiguration().getTitanCfgFile() : args[2];
- if (TitanGraphInitializer.createGraph(titanCfg)) {
- log.debug("create titan keyspace successfull");
+ case "create-janusgraph-structures":
+ log.debug("Start create janusgraph keyspace");
+ String janusGraphCfg = 2 == args.length ? configurationManager.getConfiguration().getJanusGraphCfgFile() : args[2];
+ if (JanusGraphInitializer.createGraph(janusGraphCfg)) {
+ log.debug("create janusgraph keyspace successfull");
System.exit(0);
} else {
- log.debug("create titan keyspace failed");
+ log.debug("create janusgraph keyspace failed");
System.exit(2);
}
break;
@@ -96,6 +96,6 @@
private static void DataSchemeUsage() {
System.out.println("Usage: create-cassandra-structures <configuration dir> ");
- System.out.println("Usage: create-titan-structures <configuration dir> ");
+ System.out.println("Usage: create-janusgraph-structures <configuration dir> ");
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
index 36d2f66..844ae1e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
@@ -36,7 +36,7 @@
}
private static void importUsage() {
- System.out.println("Usage: import <titan.properties> <graph file location>");
+ System.out.println("Usage: import <janusgraph.properties> <graph file location>");
}
private static void validateJsonUsage() {
@@ -44,7 +44,7 @@
}
private static void exportUsage() {
- System.out.println("Usage: export <titan.properties> <output directory>");
+ System.out.println("Usage: export <janusgraph.properties> <output directory>");
}
private static void dataReportUsage() {
@@ -52,7 +52,7 @@
}
private static void exportUsersUsage() {
- System.out.println("Usage: exportusers <titan.properties> <output directory>");
+ System.out.println("Usage: exportusers <janusgraph.properties> <output directory>");
}
public static void main(String[] args) throws Exception {
@@ -116,7 +116,7 @@
case "validate-json":
String jsonFilePath = validateAndGetJsonFilePath(args);
GraphJsonValidator graphJsonValidator = new GraphJsonValidator();
- if (graphJsonValidator.verifyTitanJson(jsonFilePath)) {
+ if (graphJsonValidator.verifyJanusGraphJson(jsonFilePath)) {
System.exit(2);
}
break;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
index 4bc21b3..236f819 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
@@ -52,7 +52,7 @@
}
private static void removeUsage() {
- System.out.println("Usage: remove-products <titan.properties> <BE host> <BE port> <admin user>");
+ System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
}
private static boolean verifyParamsLength(String[] args, int i) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
index ff548ff..fc65a2d 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
@@ -41,7 +41,7 @@
private static void updateIsVnfTrueUsage() {
System.out.println(
- "Usage: updateIsVnfTrue <titan.properties> <systemServiceName1,systemServiceName2,...,systemServiceNameN>");
+ "Usage: updateIsVnfTrue <janusgraph.properties> <systemServiceName1,systemServiceName2,...,systemServiceNameN>");
}
public static void main(String[] args) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
index bff3068..c4be03d 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
@@ -21,17 +21,17 @@
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.*;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
@@ -74,7 +74,7 @@
private boolean isNodeTypesSupportOnly = true;
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -263,10 +263,10 @@
private void cleanup(MigrationResult.MigrationStatus status) {
if (status == MigrationResult.MigrationStatus.COMPLETED ) {
log.info("Upgrade migration 1710 has been successfully finished. ");
- titanDao.commit();
+ janusGraphDao.commit();
} else {
log.info("Upgrade migration 1710 was failed. ");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
outputHandler.writeOutputAndCloseFile();
if (!isNodeTypesSupportOnly && isLockSucceeded) {
@@ -299,11 +299,11 @@
finally {
if (result) {
log.info("Service upgrade finished successfully: uniqueId {} ", currUid);
- titanDao.commit();
+ janusGraphDao.commit();
}
else {
log.error("Failed to upgrade service with uniqueId {} ", currUid);
- titanDao.rollback();
+ janusGraphDao.rollback();
}
markCheckedOutServiceAsDeletedIfUpgradeFailed(currUid, result);
}
@@ -314,7 +314,7 @@
}
private void upgradeServices() {
- Either<List<String>, TitanOperationStatus> getServicesRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.SERVICE);
+ Either<List<String>, JanusGraphOperationStatus> getServicesRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.SERVICE);
if (getServicesRes.isRight()) {
log.error("Failed to retrieve the latest certified service versions");
return;
@@ -341,7 +341,7 @@
return upgradeService(getServiceRes.left().value());
}
if(!latestGenericTypes.containsKey(derivedFromGenericType)){
- Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
if(getDerivedRes.isRight()){
log.error(FAILED_TO_UPGRADE_COMPONENT, getServiceRes.left().value().getComponentType().getValue(), getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getVersion(), "findDerivedResources", getDerivedRes.right().value());
outputHandler.addRecord( getServiceRes.left().value().getComponentType().name(),getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value());
@@ -531,7 +531,7 @@
Optional<ComponentInstanceProperty> propertyInvariantUuid = instanceProperties.stream().filter(p->p.getName().equals(SERVICE_INVARIANT_UUID_RPOPERTY)).findFirst();
if(propertyUuid.isPresent() && propertyInvariantUuid.isPresent()){
String serviceInvariantUUID = propertyInvariantUuid.get().getValue();
- Either<List<GraphVertex>, TitanOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(serviceInvariantUUID);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(serviceInvariantUUID);
if (getLatestOriginServiceRes.isRight()) {
return instance;
}
@@ -565,9 +565,9 @@
}
private Either<ComponentInstance, ResponseFormat> upgradeServiceProxyInstance(org.openecomp.sdc.be.model.Component component, ComponentInstance instance, ComponentInstance newComponentInstance) {
- Either<List<GraphVertex>, TitanOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(instance.getSourceModelInvariant());
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(instance.getSourceModelInvariant());
if (getLatestOriginServiceRes.isRight()) {
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(getLatestOriginServiceRes.right().value()), instance.getOriginType().getComponentType())));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getLatestOriginServiceRes.right().value()), instance.getOriginType().getComponentType())));
}
ModelConverter.getVertexType(instance.getOriginType().name());
Either<Resource, StorageOperationStatus> getOriginRes = toscaOperationFacade.getLatestByName(instance.getComponentName());
@@ -580,7 +580,7 @@
return changeAssetVersion(component, instance, newComponentInstance);
}
- private Either<List<GraphVertex>, TitanOperationStatus> getLatestCertifiedService(String invariantUUID) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestCertifiedService(String invariantUUID) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
@@ -589,7 +589,8 @@
propertiesToMatch.put(GraphPropertyEnum.INVARIANT_UUID, invariantUUID);
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- return titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
}
private Either<ComponentInstance, ResponseFormat> changeAssetVersion(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance instance, ComponentInstance newComponentInstance) {
@@ -599,7 +600,7 @@
private boolean upgradeNodeTypes() {
log.info("Starting upgrade node types upon upgrade migration 1710 process. ");
if (nodeTypes != null && !nodeTypes.isEmpty()) {
- Either<List<String>, TitanOperationStatus> getRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.NODE_TYPE, ComponentTypeEnum.RESOURCE);
+ Either<List<String>, JanusGraphOperationStatus> getRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.NODE_TYPE, ComponentTypeEnum.RESOURCE);
if (getRes.isRight()) {
return false;
}
@@ -633,7 +634,7 @@
private boolean upgradeVFs() {
log.info("Starting upgrade VFs upon upgrade migration 1710 process. ");
- Either<List<String>, TitanOperationStatus> getVfsRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.RESOURCE);
+ Either<List<String>, JanusGraphOperationStatus> getVfsRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.RESOURCE);
if (getVfsRes.isRight()) {
log.info(UPGRADE_VFS_FAILED);
return false;
@@ -665,11 +666,11 @@
finally {
if (result) {
log.info("Resource upgrade finished successfully: uniqueId {} ", currUid);
- titanDao.commit();
+ janusGraphDao.commit();
}
else {
log.error("Failed to upgrade resource with uniqueId {} ", currUid);
- titanDao.rollback();
+ janusGraphDao.rollback();
}
markCheckedOutResourceAsDeletedIfUpgradeFailed(currUid, result);
}
@@ -804,7 +805,7 @@
if (StringUtils.isNotEmpty(derivedFromGenericType) && !latestGenericTypes.containsKey(derivedFromGenericType)) {
log.info("Starting upgrade vf with name {}, invariantUUID {}, version {}, latest derived from generic type {}, latest derived from generic version {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType, derivedFromGenericVersion);
log.info("Starting to fetch latest generic node type {}. ", derivedFromGenericType);
- Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
if (getDerivedRes.isRight()) {
outputHandler.addRecord(component.getComponentType().name(), component.getName(), component.getInvariantUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value());
log.info("Failed to upgrade component with name {}, invariantUUID {}, version {} and latest generic. Status is {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType);
@@ -835,9 +836,10 @@
StorageOperationStatus result = StorageOperationStatus.OK;
log.info("Starting upgrade node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION));
log.info("Starting to find derived to for node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION));
- Either<List<GraphVertex>, TitanOperationStatus> parentResourceRes = titanDao.getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata);
- if (parentResourceRes.isRight() && parentResourceRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(parentResourceRes.right().value());
+ Either<List<GraphVertex>, JanusGraphOperationStatus> parentResourceRes = janusGraphDao
+ .getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata);
+ if (parentResourceRes.isRight() && parentResourceRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentResourceRes.right().value());
}
List<GraphVertex> derivedResourcesUid = getAllDerivedGraphVertices(allCertifiedUids, parentResourceRes);
@@ -871,13 +873,13 @@
}
if (performFullCertification(checkouRes.left().value()).isLeft()) {
upgradedNodeTypesMap.put(nodeType.getToscaResourceName(), checkouRes.left().value());
- titanDao.commit();
+ janusGraphDao.commit();
return true;
}
return false;
}
- private List<GraphVertex> getAllDerivedGraphVertices(List<String> allCertifiedUids, Either<List<GraphVertex>, TitanOperationStatus> parentResources) {
+ private List<GraphVertex> getAllDerivedGraphVertices(List<String> allCertifiedUids, Either<List<GraphVertex>, JanusGraphOperationStatus> parentResources) {
List<GraphVertex> derivedResourcesUid = new ArrayList<>();
if (parentResources.isLeft()) {
@@ -916,14 +918,15 @@
return changeStateEither;
}
- private Either<List<GraphVertex>, TitanOperationStatus> findDerivedResources(String parentResource) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource);
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
}
private boolean latestVersionExists(GraphVertex latestDerivedFrom, String currentVersion) {
@@ -940,14 +943,14 @@
return Double.parseDouble(latestVersion) > Double.parseDouble(currentVersion);
}
- private Either<List<String>, TitanOperationStatus> getAllLatestCertifiedComponentUids(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
+ private Either<List<String>, JanusGraphOperationStatus> getAllLatestCertifiedComponentUids(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
log.info("Starting to fetch all latest certified not checked out components with type {} upon upgrade migration 1710 process", componentType);
- Either<List<String>, TitanOperationStatus> result = null;
+ Either<List<String>, JanusGraphOperationStatus> result = null;
Map<String, String> latestCertifiedMap = new HashMap<>();
Map<String, String> latestNotCertifiedMap = new HashMap<>();
- Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = getAllLatestComponents(vertexType, componentType);
- if (getComponentsRes.isRight() && getComponentsRes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getComponentsRes = getAllLatestComponents(vertexType, componentType);
+ if (getComponentsRes.isRight() && getComponentsRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.error("Failed to fetch all latest certified not checked out components with type {}. Status is {}. ", componentType, getComponentsRes.right().value());
result = Either.right(getComponentsRes.right().value());
}
@@ -968,7 +971,7 @@
return result;
}
- private Either<List<GraphVertex>, TitanOperationStatus> getAllLatestComponents(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllLatestComponents(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
@@ -979,7 +982,8 @@
if (vertexType == VertexTypeEnum.TOPOLOGY_TEMPLATE && componentType == ComponentTypeEnum.RESOURCE) {
propertiesNotToMatch.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name());
}
- return titanDao.getByCriteria(vertexType, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(vertexType, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
}
private Either<List<GraphVertex>, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName) {
@@ -990,11 +994,12 @@
propertiesToMatch.put(property, nodeName);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> highestResources = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
if (highestResources.isRight()) {
- TitanOperationStatus status = highestResources.right().value();
+ JanusGraphOperationStatus status = highestResources.right().value();
log.debug("Failed to fetch resource with name {}. Status is {} ", nodeName, status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
List<GraphVertex> resources = highestResources.left().value();
List<GraphVertex> result = new ArrayList<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
index d520eee..a47c63d 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
@@ -6,17 +6,17 @@
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
@@ -32,11 +32,11 @@
private static final List<ResourceTypeEnum> EXCLUDE_TYPES = Arrays.asList(ResourceTypeEnum.VFCMT, ResourceTypeEnum.Configuration);
private ToscaElementOperation toscaElementOperation;
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public SdcCatalogMigration(TopologyTemplateOperation toscaElementOperation, TitanDao titanDao) {
+ public SdcCatalogMigration(TopologyTemplateOperation toscaElementOperation, JanusGraphDao janusGraphDao) {
this.toscaElementOperation = toscaElementOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
}
@Override
@@ -51,45 +51,46 @@
@Override
public MigrationResult migrate() {
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
try {
status = getOrCreateCatalogRoot()
.either(this::associateCatalogRootToCatalogElements,
err -> {LOGGER.error("failed to create catalog root. err: {}", err); return err;});
- return status == TitanOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create and associate catalog root. error: " + status);
+ return status == JanusGraphOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create and associate catalog root. error: " + status);
} finally {
commitOrRollBack(status);
}
}
- private void commitOrRollBack(TitanOperationStatus status) {
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ private void commitOrRollBack(JanusGraphOperationStatus status) {
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private Either<GraphVertex, TitanOperationStatus> getOrCreateCatalogRoot() {
+ private Either<GraphVertex, JanusGraphOperationStatus> getOrCreateCatalogRoot() {
LOGGER.info("creating or getting catalog root vertex");
- return titanDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT)
+ return janusGraphDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT)
.right()
.bind(this::createRootCatalogVertexOrError);
}
- private Either<GraphVertex, TitanOperationStatus> createRootCatalogVertexOrError(TitanOperationStatus titanOperationStatus) {
- return titanOperationStatus == TitanOperationStatus.NOT_FOUND ? createRootCatalogVertex() : Either.right(titanOperationStatus);
+ private Either<GraphVertex, JanusGraphOperationStatus> createRootCatalogVertexOrError(JanusGraphOperationStatus janusGraphOperationStatus) {
+ return janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND ? createRootCatalogVertex() : Either.right(
+ janusGraphOperationStatus);
}
- private Either<GraphVertex, TitanOperationStatus> createRootCatalogVertex() {
+ private Either<GraphVertex, JanusGraphOperationStatus> createRootCatalogVertex() {
LOGGER.info("Creating root catalog vertex");
GraphVertex catalogRootVertex = new GraphVertex(VertexTypeEnum.CATALOG_ROOT);
catalogRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(catalogRootVertex);
+ return janusGraphDao.createVertex(catalogRootVertex);
}
- private Either<List<GraphVertex>, TitanOperationStatus> getAllCatalogVertices() {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllCatalogVertices() {
LOGGER.info("fetching all catalog resources");
return toscaElementOperation.getListOfHighestComponents(ComponentTypeEnum.RESOURCE, EXCLUDE_TYPES, JsonParseFlagEnum.ParseMetadata)
.right()
@@ -98,12 +99,12 @@
.bind(this::getAllCatalogVertices);
}
- private Either<List<GraphVertex>, TitanOperationStatus> errOrEmptyListIfNotFound(TitanOperationStatus err) {
- return TitanOperationStatus.NOT_FOUND.equals(err) ? Either.left(new ArrayList<>()) : Either.right(err);
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> errOrEmptyListIfNotFound(JanusGraphOperationStatus err) {
+ return JanusGraphOperationStatus.NOT_FOUND.equals(err) ? Either.left(new ArrayList<>()) : Either.right(err);
}
@SuppressWarnings("unchecked")
- private Either<List<GraphVertex>, TitanOperationStatus> getAllCatalogVertices(List<GraphVertex> allResourceCatalogVertices) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllCatalogVertices(List<GraphVertex> allResourceCatalogVertices) {
LOGGER.info("number of resources: {}", allResourceCatalogVertices.size());
LOGGER.info("fetching all catalog services");
return toscaElementOperation.getListOfHighestComponents(ComponentTypeEnum.SERVICE, EXCLUDE_TYPES, JsonParseFlagEnum.ParseMetadata)
@@ -113,20 +114,22 @@
.map(allServiceVertices -> ListUtils.union(allServiceVertices, allResourceCatalogVertices));
}
- private TitanOperationStatus associateCatalogRootToCatalogElements(GraphVertex root) {
+ private JanusGraphOperationStatus associateCatalogRootToCatalogElements(GraphVertex root) {
return getAllCatalogVertices()
.either(catalogVertices -> associateCatalogRootToCatalogElements(root, catalogVertices),
err -> err);
}
- private TitanOperationStatus associateCatalogRootToCatalogElements(GraphVertex root, List<GraphVertex> catalogElements) {
+ private JanusGraphOperationStatus associateCatalogRootToCatalogElements(GraphVertex root, List<GraphVertex> catalogElements) {
LOGGER.info("number of catalog elements: {}", catalogElements.size());
LOGGER.info("connect all catalog elements to root edge");
List<GraphVertex> nonConnectedElements = catalogElements.stream().filter(this::edgeNotAlreadyExists).collect(Collectors.toList());
int numOfCreatedEdges = 0;
for (GraphVertex catalogElement : nonConnectedElements) {
- TitanOperationStatus edgeCreationStatus = titanDao.createEdge(root, catalogElement, EdgeLabelEnum.CATALOG_ELEMENT, null);
- if (edgeCreationStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ edgeCreationStatus = janusGraphDao
+ .createEdge(root, catalogElement, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ if (edgeCreationStatus != JanusGraphOperationStatus.OK) {
LOGGER.error("failed to create edge from catalog element to vertex {}", catalogElement.getUniqueId());
return edgeCreationStatus;
}
@@ -134,7 +137,7 @@
numOfCreatedEdges++;
}
LOGGER.info("number edges created: {}", numOfCreatedEdges);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private boolean edgeNotAlreadyExists(GraphVertex catalogElement) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
index 9634025..812c07e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
@@ -17,7 +17,7 @@
package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
import com.google.common.collect.ImmutableSet;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.math.BigInteger;
import java.util.ArrayList;
@@ -38,22 +38,20 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@@ -61,14 +59,14 @@
@org.springframework.stereotype.Component
public class ForwardPathMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private UserAdminOperation userAdminOperation;
private ToscaOperationFacade toscaOperationFacade;
private User user = null;
- public ForwardPathMigration(TitanDao titanDao,
+ public ForwardPathMigration(JanusGraphDao janusGraphDao,
UserAdminOperation userAdminOperation, ToscaOperationFacade toscaOperationFacade) {
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
this.userAdminOperation = userAdminOperation;
this.toscaOperationFacade = toscaOperationFacade;
}
@@ -110,7 +108,7 @@
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>();
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- status = titanDao
+ status = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::cleanServices, this::handleError);
return status;
@@ -138,10 +136,11 @@
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- titanDao.rollback();
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ janusGraphDao.rollback();
return DaoStatusConverter
- .convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ .convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus fixDataOnGraph(Component component) {
@@ -149,10 +148,10 @@
return StorageOperationStatus.OK;
}
Service service = (Service) component;
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(service.getUniqueId(),
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao.getVertexById(service.getUniqueId(),
JsonParseFlagEnum.NoParse);
if (getResponse.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value());
}
Set<String> ciNames = new HashSet<>();
@@ -163,13 +162,13 @@
GraphVertex componentVertex = getResponse.left().value();
GraphVertex toscaDataVertex;
- Either<GraphVertex, TitanOperationStatus> groupVertexEither = titanDao.getChildVertex(componentVertex,
+ Either<GraphVertex, JanusGraphOperationStatus> groupVertexEither = janusGraphDao.getChildVertex(componentVertex,
EdgeLabelEnum.FORWARDING_PATH, JsonParseFlagEnum.ParseJson);
- if (groupVertexEither.isRight() && groupVertexEither.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (groupVertexEither.isRight() && groupVertexEither.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
return StorageOperationStatus.OK;
}
if (groupVertexEither.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(groupVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(groupVertexEither.right().value());
}
toscaDataVertex = groupVertexEither.left().value();
Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>(
@@ -186,42 +185,44 @@
}
}
if (toBeDeletedFP.isEmpty()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return StorageOperationStatus.OK;
}
toBeDeletedFP.stream().forEach(fpKey -> forwardingPaths.remove(fpKey));
toscaDataVertex.setJson(forwardingPaths);
- Either<GraphVertex, TitanOperationStatus> updatevertexEither = updateOrCopyOnUpdate(
+ Either<GraphVertex, JanusGraphOperationStatus> updatevertexEither = updateOrCopyOnUpdate(
toscaDataVertex, componentVertex);
if (updatevertexEither.isRight()) {
- titanDao.rollback();
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updatevertexEither.right().value());
+ janusGraphDao.rollback();
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updatevertexEither.right().value());
}
- titanDao.commit();
+ janusGraphDao.commit();
return StorageOperationStatus.OK;
}
- private Either<GraphVertex, TitanOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, Edge edgeToRemove) {
+ private Either<GraphVertex, JanusGraphOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, Edge edgeToRemove) {
EdgeLabelEnum label = EdgeLabelEnum.FORWARDING_PATH;
GraphVertex newDataVertex = new GraphVertex(dataVertex.getLabel());
String id = IdBuilderUtils.generateChildId(toscaElementVertex.getUniqueId(), dataVertex.getLabel());
newDataVertex.cloneData(dataVertex);
newDataVertex.setUniqueId(id);
- Either<GraphVertex, TitanOperationStatus> createVertex = titanDao.createVertex(newDataVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(newDataVertex);
if (createVertex.isRight()) {
return createVertex;
}
newDataVertex = createVertex.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(toscaElementVertex, newDataVertex, label, titanDao.getEdgeProperties(edgeToRemove));
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(toscaElementVertex, newDataVertex, label, janusGraphDao.getEdgeProperties(edgeToRemove));
+ if (createEdge != JanusGraphOperationStatus.OK) {
return Either.right(createEdge);
}
edgeToRemove.remove();
return Either.left(newDataVertex);
}
- private Either<GraphVertex, TitanOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex ) {
+ private Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex ) {
EdgeLabelEnum label = EdgeLabelEnum.FORWARDING_PATH;
Iterator<Edge> edges = dataVertex.getVertex().edges(Direction.IN, label.name());
int edgeCount = 0;
@@ -230,21 +231,22 @@
Edge edge = edges.next();
++edgeCount;
Vertex outVertex = edge.outVertex();
- String outId = (String) titanDao.getProperty((TitanVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String outId = (String) janusGraphDao
+ .getProperty((JanusGraphVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
if (toscaElementVertex.getUniqueId().equals(outId)) {
edgeToRemove = edge;
}
}
if (edgeToRemove == null) {
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
switch (edgeCount) {
case 0:
// error
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
case 1:
// update
- return titanDao.updateVertex(dataVertex);
+ return janusGraphDao.updateVertex(dataVertex);
default:
// copy on update
return cloneDataVertex(dataVertex, toscaElementVertex, edgeToRemove);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
index 7d74162..02b45dc 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
@@ -8,11 +8,11 @@
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
@@ -33,7 +33,7 @@
@Component
public class ResourceLifecycleMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private LifecycleBusinessLogic lifecycleBusinessLogic;
private UserAdminOperation userAdminOperation;
@@ -41,8 +41,8 @@
private static final Logger log = Logger.getLogger(ResourceLifecycleMigration.class);
- public ResourceLifecycleMigration(TitanDao titanDao, LifecycleBusinessLogic lifecycleBusinessLogic, UserAdminOperation userAdminOperation) {
- this.titanDao = titanDao;
+ public ResourceLifecycleMigration(JanusGraphDao janusGraphDao, LifecycleBusinessLogic lifecycleBusinessLogic, UserAdminOperation userAdminOperation) {
+ this.janusGraphDao = janusGraphDao;
this.lifecycleBusinessLogic = lifecycleBusinessLogic;
this.userAdminOperation = userAdminOperation;
}
@@ -82,7 +82,7 @@
if (StorageOperationStatus.OK == status) {
status = findResourcesAndChangeStatus(VertexTypeEnum.TOPOLOGY_TEMPLATE);
}
- titanDao.commit();
+ janusGraphDao.commit();
return status;
}
@@ -97,12 +97,12 @@
hasNot.put(GraphPropertyEnum.IS_DELETED, true);
log.info("findResourcesAndChangeStatus for type {} and state {}", type ,LifecycleStateEnum.READY_FOR_CERTIFICATION);
- status = titanDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
+ status = janusGraphDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
log.info("status {} for type {} and state {}", status, type ,LifecycleStateEnum.READY_FOR_CERTIFICATION);
log.info("findResourcesAndChangeStatus for type {} and state {}", type ,LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- status = titanDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
+ status = janusGraphDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
log.info("status {} for type {} and state {}", status, type ,LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
@@ -130,9 +130,10 @@
return changeComponentState.isLeft() ? StorageOperationStatus.OK : StorageOperationStatus.GENERAL_ERROR;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- log.debug("receive titan error {}", err);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ log.debug("receive janusgraph error {}", err);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
index 4786839..f85b6ad 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
@@ -4,12 +4,12 @@
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
@@ -17,8 +17,8 @@
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -31,7 +31,7 @@
@Component
public class SDCInstancesMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private NodeTemplateOperation nodeTemplateOperation;
private static final Logger log = Logger.getLogger(SDCInstancesMigration.class);
@@ -41,8 +41,8 @@
private static final List<String> UUID_PROPS_NAMES = Arrays.asList("providing_service_uuid", "providing_service_uuid");
- public SDCInstancesMigration(TitanDao titanDao, NodeTemplateOperation nodeTemplateOperation) {
- this.titanDao = titanDao;
+ public SDCInstancesMigration(JanusGraphDao janusGraphDao, NodeTemplateOperation nodeTemplateOperation) {
+ this.janusGraphDao = janusGraphDao;
this.nodeTemplateOperation = nodeTemplateOperation;
}
@@ -69,13 +69,15 @@
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC);
- status = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
+ status = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::connectAll, this::handleError);
return status;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus connectAll(List<GraphVertex> containersV) {
@@ -96,7 +98,8 @@
ComponentTypeEnum componentType = containerV.getType();
Map<String, MapPropertiesDataDefinition> instanceProperties = null;
if (componentType == ComponentTypeEnum.RESOURCE) {
- Either<GraphVertex, TitanOperationStatus> subcategoryV = titanDao.getChildVertex(containerV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> subcategoryV = janusGraphDao
+ .getChildVertex(containerV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (subcategoryV.isRight()) {
log.debug("Failed to fetch category vertex for resource {} error {} ", containerV.getUniqueId(), subcategoryV.right().value());
return StorageOperationStatus.GENERAL_ERROR;
@@ -122,9 +125,9 @@
} finally {
if (status == StorageOperationStatus.OK) {
- titanDao.commit();
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
}
@@ -133,10 +136,11 @@
private Either<Map<String, MapPropertiesDataDefinition>, StorageOperationStatus> getInstProperties(GraphVertex containerV) {
Map<String, MapPropertiesDataDefinition> instanceProperties;
- Either<GraphVertex, TitanOperationStatus> instProps = titanDao.getChildVertex(containerV, EdgeLabelEnum.INST_PROPERTIES, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> instProps = janusGraphDao
+ .getChildVertex(containerV, EdgeLabelEnum.INST_PROPERTIES, JsonParseFlagEnum.ParseAll);
if (instProps.isRight()) {
- if (instProps.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (instProps.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
instanceProperties = new HashMap<>();
} else {
log.debug("Failed to fetch instance properties vertex for resource {} error {} ", containerV.getUniqueId(), instProps.right().value());
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
index bdab2ce..e897722 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
@@ -4,11 +4,11 @@
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
@@ -19,10 +19,10 @@
public class SdcArchiveMigration implements Migration {
private static final Logger logger = Logger.getLogger(SdcArchiveMigration.class);
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public SdcArchiveMigration(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public SdcArchiveMigration(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
@Override
@@ -37,30 +37,30 @@
@Override
public MigrationResult migrate() {
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
try {
status = getOrCreateArchiveRoot();
- return status == TitanOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create archive root node. error: " + status);
+ return status == JanusGraphOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create archive root node. error: " + status);
} finally {
commitOrRollBack(status);
}
}
- private void commitOrRollBack(TitanOperationStatus status) {
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ private void commitOrRollBack(JanusGraphOperationStatus status) {
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus getOrCreateArchiveRoot() {
+ private JanusGraphOperationStatus getOrCreateArchiveRoot() {
logger.info("creating or getting catalog archive vertex");
- return titanDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT)
- .either(v -> TitanOperationStatus.OK, s -> this.createRootArchiveVertex());
+ return janusGraphDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT)
+ .either(v -> JanusGraphOperationStatus.OK, s -> this.createRootArchiveVertex());
}
- private TitanOperationStatus createRootArchiveVertex() {
+ private JanusGraphOperationStatus createRootArchiveVertex() {
GraphVertex archiveRootVertex = new GraphVertex(VertexTypeEnum.ARCHIVE_ROOT);
archiveRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
archiveRootVertex.addMetadataProperty(GraphPropertyEnum.LABEL, VertexTypeEnum.ARCHIVE_ROOT);
@@ -68,9 +68,9 @@
logger.info("Creating root archive vertex {}", archiveRootVertex.getUniqueId());
- final Either<GraphVertex, TitanOperationStatus> vertexE = titanDao.createVertex(archiveRootVertex);
+ final Either<GraphVertex, JanusGraphOperationStatus> vertexE = janusGraphDao.createVertex(archiveRootVertex);
- return vertexE.isLeft() ? TitanOperationStatus.OK : vertexE.right().value();
+ return vertexE.isLeft() ? JanusGraphOperationStatus.OK : vertexE.right().value();
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
index afbd3b4..35e7950 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
@@ -28,17 +28,17 @@
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@@ -51,7 +51,7 @@
private static final Logger LOGGER = Logger.getLogger(InterfaceOperationMigration.class);
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private UserAdminOperation userAdminOperation;
@Autowired
@@ -86,7 +86,8 @@
private StorageOperationStatus getAndUpdateAllComponents(){
Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class);
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- return titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::updateComponentVertices, this::handleError);
}
@@ -101,16 +102,17 @@
return status;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- titanDao.rollback();
- return DaoStatusConverter.convertTitanStatusToStorageStatus(
- TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ janusGraphDao.rollback();
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus updateDataOnGraph(GraphVertex componentVertex) {
try {
- Either<GraphVertex, TitanOperationStatus> interfaceVertexEither =
- titanDao.getChildVertex(componentVertex, EdgeLabelEnum.INTERFACE, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> interfaceVertexEither =
+ janusGraphDao
+ .getChildVertex(componentVertex, EdgeLabelEnum.INTERFACE, JsonParseFlagEnum.ParseJson);
if (interfaceVertexEither.isLeft()) {
GraphVertex interfaceVertex = interfaceVertexEither.left().value();
Map<String, InterfaceDataDefinition> interfaceDefinitions = (Map<String, InterfaceDataDefinition>) interfaceVertex.getJson();
@@ -121,9 +123,10 @@
}
}
interfaceVertex.setJson(interfaceDefinitions);
- Either<GraphVertex, TitanOperationStatus> updateInterfaceVertexEither = titanDao.updateVertex(interfaceVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateInterfaceVertexEither = janusGraphDao
+ .updateVertex(interfaceVertex);
if(updateInterfaceVertexEither.isRight()){
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateInterfaceVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateInterfaceVertexEither.right().value());
}
}
@@ -134,8 +137,8 @@
}
}
- Either<GraphVertex, TitanOperationStatus> instInterfaceVertexEither =
- titanDao.getChildVertex(componentVertex, EdgeLabelEnum.INST_INTERFACES, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> instInterfaceVertexEither =
+ janusGraphDao.getChildVertex(componentVertex, EdgeLabelEnum.INST_INTERFACES, JsonParseFlagEnum.ParseJson);
if (instInterfaceVertexEither.isLeft()) {
GraphVertex instInterfaceVertex = instInterfaceVertexEither.left().value();
Map<String, MapInterfaceDataDefinition> instInterfaceDefinitions = (Map<String, MapInterfaceDataDefinition>) instInterfaceVertex.getJson();
@@ -148,17 +151,18 @@
}
}
instInterfaceVertex.setJson(instInterfaceDefinitions);
- Either<GraphVertex, TitanOperationStatus> updateInstInterfaceVertexEither = titanDao.updateVertex(instInterfaceVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateInstInterfaceVertexEither = janusGraphDao
+ .updateVertex(instInterfaceVertex);
if(updateInstInterfaceVertexEither.isRight()){
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateInstInterfaceVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateInstInterfaceVertexEither.right().value());
}
}
}
- titanDao.commit();
+ janusGraphDao.commit();
} catch (Exception e) {
LOGGER.debug("Interface operation migration failed with error : ", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return StorageOperationStatus.GENERAL_ERROR;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java
similarity index 77%
rename from asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java
rename to asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java
index 31b1b1f..e7d39ff 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.asdctool.servlets;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
@@ -39,30 +39,30 @@
import java.util.Properties;
//import com.tinkerpop.blueprints.util.io.graphml.GraphMLWriter;
-@Path("/titan")
-public class ExportImportTitanServlet {
+@Path("/janusgraph")
+public class ExportImportJanusGraphServlet {
- private static Logger log = Logger.getLogger(ExportImportTitanServlet.class.getName());
+ private static Logger log = Logger.getLogger(ExportImportJanusGraphServlet.class.getName());
@GET
@Path("export")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
- public Response export(@FormDataParam("titanProperties") File titanPropertiesFile,
+ public Response export(@FormDataParam("janusGraphProperties") File janusGraphPropertiesFile,
@FormDataParam("metadata") String exportGraphMetadata) {
- printTitanConfigFile(titanPropertiesFile);
+ printJanusGraphConfigFile(janusGraphPropertiesFile);
printMetadata(exportGraphMetadata);
- Properties titanProperties = convertFileToProperties(titanPropertiesFile);
+ Properties janusGraphProperties = convertFileToProperties(janusGraphPropertiesFile);
- if (titanProperties == null) {
- Response response = Utils.buildOkResponse(400, "cannot parse titan properties file", null);
+ if (janusGraphProperties == null) {
+ Response response = Utils.buildOkResponse(400, "cannot parse janusgraph properties file", null);
return response;
}
Configuration conf = new BaseConfiguration();
- for (Entry<Object, Object> entry : titanProperties.entrySet()) {
+ for (Entry<Object, Object> entry : janusGraphProperties.entrySet()) {
String key = entry.getKey().toString();
Object value = entry.getValue();
conf.setProperty(key, value);
@@ -70,14 +70,14 @@
conf.setProperty("storage.machine-id-appendix", System.currentTimeMillis() % 1000);
- try(TitanGraph openGraph = Utils.openGraph(conf)){
+ try(JanusGraph openGraph = Utils.openGraph(conf)){
if (openGraph == null) {
Response buildErrorResponse = Utils.buildOkResponse(500, "failed to open graph", null);
return buildErrorResponse;
}
- // Open Titan Graph
+ // Open JanusGraph Graph
Response buildOkResponse = Utils.buildOkResponse(200, "ok man", null);
@@ -85,11 +85,11 @@
}
}
- private Properties convertFileToProperties(File titanPropertiesFile) {
+ private Properties convertFileToProperties(File janusGraphPropertiesFile) {
Properties properties = new Properties();
- try (FileReader fileReader = new FileReader(titanPropertiesFile)){
+ try (FileReader fileReader = new FileReader(janusGraphPropertiesFile)){
properties.load(fileReader);
} catch (Exception e) {
log.error("Failed to convert file to properties", e);
@@ -99,11 +99,11 @@
return properties;
}
- private void printTitanConfigFile(File titanPropertiesFile) {
+ private void printJanusGraphConfigFile(File janusGraphPropertiesFile) {
if (log.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
- try (BufferedReader br = new BufferedReader(new FileReader(titanPropertiesFile))) {
+ try (BufferedReader br = new BufferedReader(new FileReader(janusGraphPropertiesFile))) {
String line;
while ((line = br.readLine()) != null) {
builder.append(line + Utils.NEW_LINE);
@@ -112,7 +112,7 @@
log.debug(builder.toString());
} catch (IOException e) {
- log.error("Cannot print titan properties file", e);
+ log.error("Cannot print janusgraph properties file", e);
}
}
}
@@ -123,7 +123,7 @@
}
- public String exportGraph(TitanGraph graph, String outputDirectory) {
+ public String exportGraph(JanusGraph graph, String outputDirectory) {
String result = null;
diff --git a/asdctool/src/main/resources/config/configuration.yaml b/asdctool/src/main/resources/config/configuration.yaml
index bdc6a43..b1b51fd 100644
--- a/asdctool/src/main/resources/config/configuration.yaml
+++ b/asdctool/src/main/resources/config/configuration.yaml
@@ -42,16 +42,16 @@
deleteLockTimeoutInSeconds: 60
maxDeleteComponents: 10
-titanCfgFile: src\main\resources\config\titan.properties
-titanMigrationKeySpaceCfgFile: src\main\resources\config\titan-migration.properties
-titanInMemoryGraph: false
-titanLockTimeout: 1800
+janusGraphCfgFile: src\main\resources\config\janusgraph.properties
+janusGraphMigrationKeySpaceCfgFile: src\main\resources\config\janusgraph-migration.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
diff --git a/asdctool/src/main/resources/config/titan-migration.properties b/asdctool/src/main/resources/config/janusgraph-migration.properties
similarity index 100%
rename from asdctool/src/main/resources/config/titan-migration.properties
rename to asdctool/src/main/resources/config/janusgraph-migration.properties
diff --git a/asdctool/src/main/resources/config/titan.properties b/asdctool/src/main/resources/config/janusgraph.properties
similarity index 100%
rename from asdctool/src/main/resources/config/titan.properties
rename to asdctool/src/main/resources/config/janusgraph.properties
diff --git a/asdctool/src/main/resources/scripts/deleteAllProducts.sh b/asdctool/src/main/resources/scripts/deleteAllProducts.sh
index 38e468d..474b6c8 100644
--- a/asdctool/src/main/resources/scripts/deleteAllProducts.sh
+++ b/asdctool/src/main/resources/scripts/deleteAllProducts.sh
@@ -1,8 +1,8 @@
#!/bin/bash
-##############################
-# delete all products from titan
-##############################
+#####################################
+# delete all products from JanusGraph
+#####################################
CURRENT_DIR=`pwd`
BASEDIR=$(dirname $0)
diff --git a/asdctool/src/main/resources/scripts/exportUsers.sh b/asdctool/src/main/resources/scripts/exportUsers.sh
index d701c57..fec7d5a 100644
--- a/asdctool/src/main/resources/scripts/exportUsers.sh
+++ b/asdctool/src/main/resources/scripts/exportUsers.sh
@@ -1,8 +1,8 @@
#!/bin/bash
-##############################
-# export all users from titan
-##############################
+##################################
+# export all users from JanusGraph
+##################################
CURRENT_DIR=`pwd`
BASEDIR=$(dirname $0)
diff --git a/asdctool/src/main/resources/scripts/titanSchemaCreation.sh b/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh
similarity index 82%
rename from asdctool/src/main/resources/scripts/titanSchemaCreation.sh
rename to asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh
index 8a2488b..d4b7871 100644
--- a/asdctool/src/main/resources/scripts/titanSchemaCreation.sh
+++ b/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh
@@ -1,7 +1,7 @@
#!/bin/bash
##############################
-# Titan Schema Creation
+# JanusGraph Schema Creation
##############################
CURRENT_DIR=`pwd`
@@ -18,7 +18,7 @@
mainClass="org.openecomp.sdc.asdctool.main.DataSchemaMenu"
-command="java $JVM_LOG_FILE -cp $JARS $mainClass create-titan-structures $@"
+command="java $JVM_LOG_FILE -cp $JARS $mainClass create-janusgraph-structures $@"
echo $command
$command
diff --git a/asdctool/src/main/resources/scripts/updateIsVnf.sh b/asdctool/src/main/resources/scripts/updateIsVnf.sh
index 62bfb9c..bf45fa8 100644
--- a/asdctool/src/main/resources/scripts/updateIsVnf.sh
+++ b/asdctool/src/main/resources/scripts/updateIsVnf.sh
@@ -3,7 +3,7 @@
########################################################################
#
# Example:
-# ./updateIsVnf.sh ../config/titan.properties Bservice,Myservice
+# ./updateIsVnf.sh ../config/janusgraph.properties Bservice,Myservice
#
########################################################################
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
index 8a9b135..cefda71 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.asdctool;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.junit.Assert;
@@ -34,7 +34,7 @@
@Test
public void testOpenGraph() throws Exception {
Configuration conf = null;
- TitanGraph result;
+ JanusGraph result;
// default test with null
result = Utils.openGraph(conf);
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java
index 5495d11..7c661ae 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java
@@ -1,7 +1,7 @@
package org.openecomp.sdc.asdctool.configuration;
import org.junit.Test;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation;
public class GetConsumersConfigurationTest {
@@ -13,11 +13,11 @@
@Test
public void testConsumerOperation() throws Exception {
GetConsumersConfiguration testSubject;
- TitanGenericDao titanGenericDao = null;
+ JanusGraphGenericDao janusGraphGenericDao = null;
ConsumerOperation result;
// default test
testSubject = createTestSubject();
- result = testSubject.consumerOperation(titanGenericDao);
+ result = testSubject.consumerOperation(janusGraphGenericDao);
}
}
\ No newline at end of file
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java
index 891946d..8585382 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java
@@ -1,8 +1,7 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
@@ -12,14 +11,14 @@
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openecomp.sdc.common.api.Constants;
@@ -40,10 +39,10 @@
private ArtifactUuidFix test;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
- private TitanVertex vertex;
+ private JanusGraphVertex vertex;
@Mock
ToscaOperationFacade toscaOperationFacade;
@@ -70,25 +69,26 @@
graphVertex.setUniqueId(uniqueId);
graphVertex.setMetadataProperties(hasProps1);
list.add(graphVertex);
- when(titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, hasProps1)).thenReturn(Either.left(list));
+ when(janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, hasProps1)).thenReturn(Either.left(list));
Map<GraphPropertyEnum, Object> hasProps2 = new HashMap<>();
hasProps2.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
hasProps2.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF);
hasProps2.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps2)).thenReturn(Either.left(list));
+ when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps2)).thenReturn(Either.left(list));
Map<GraphPropertyEnum, Object> hasProps3 = new HashMap<>();
hasProps3.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
hasProps3.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps3)).thenReturn(Either.left(list));
+ when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps3)).thenReturn(Either.left(list));
Map<GraphPropertyEnum, Object> hasProps = new HashMap<>();
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF.name());
Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>();
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
+ when(janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
Resource resource = new Resource();
resource.setName(uniqueId);
Map<String, ArtifactDefinition> deployArtifact = new HashMap<>();
@@ -155,7 +155,8 @@
componentInstances.add(componentInstance);
service.setComponentInstances(componentInstances);
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
+ when(janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
when(toscaOperationFacade.getToscaElement(ArgumentMatchers.eq(graphVertex.getUniqueId()),any(ComponentParametersView.class)))
.thenReturn(Either.left(service));
byte[] payload = "value".getBytes();
@@ -188,7 +189,8 @@
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>();
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
+ when(janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
result = test.doFix(fixComponent, runMode);
assertEquals(false,result);
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
index 06beb8d..87d95ed 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
@@ -14,33 +14,33 @@
}
@Test
- public void testVerifyTitanJson() throws Exception {
+ public void testVerifyJanusGraphJson() throws Exception {
GraphJsonValidator testSubject;
boolean result;
// default test
testSubject = createTestSubject();
- result = testSubject.verifyTitanJson("src/test/resources/graph.json");
+ result = testSubject.verifyJanusGraphJson("src/test/resources/graph.json");
assertTrue(result);
}
@Test
- public void testVerifyTitanJsonErrorFile() throws Exception {
+ public void testVerifyJanusGraphJsonErrorFile() throws Exception {
GraphJsonValidator testSubject;
boolean result;
// default test
testSubject = createTestSubject();
- result = testSubject.verifyTitanJson("src/test/resources/graphError.json");
+ result = testSubject.verifyJanusGraphJson("src/test/resources/graphError.json");
assertFalse(result);
}
@Test(expected=NoSuchFileException.class)
- public void testVerifyTitanJsonNoFile() throws Exception {
+ public void testVerifyJanusGraphJsonNoFile() throws Exception {
GraphJsonValidator testSubject;
// default test
testSubject = createTestSubject();
- testSubject.verifyTitanJson("stam");
+ testSubject.verifyJanusGraphJson("stam");
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java
index 5ade4fa..111f66d 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.junit.Test;
@@ -61,18 +61,18 @@
@Test(expected=IllegalArgumentException.class)
public void testOpenGraph() throws Exception {
GraphMLConverter testSubject;
- String titanFileLocation = "";
- TitanGraph result;
+ String janusGraphFileLocation = "";
+ JanusGraph result;
// default test
testSubject = createTestSubject();
- result = testSubject.openGraph("src/main/resources/config/titan.properties");
+ result = testSubject.openGraph("src/main/resources/config/janusgraph.properties");
}
@Test(expected=NullPointerException.class)
public void testExportJsonGraph() throws Exception {
GraphMLConverter testSubject;
- TitanGraph graph = null;
+ JanusGraph graph = null;
String outputDirectory = "";
String result;
@@ -84,7 +84,7 @@
@Test(expected=NullPointerException.class)
public void testExportGraphMl_1() throws Exception {
GraphMLConverter testSubject;
- TitanGraph graph = null;
+ JanusGraph graph = null;
String outputDirectory = "";
String result;
@@ -96,7 +96,7 @@
@Test
public void testImportJsonGraph() throws Exception {
GraphMLConverter testSubject;
- TitanGraph graph = null;
+ JanusGraph graph = null;
String graphJsonFile = "";
List<ImmutablePair<String, String>> propertiesCriteriaToDelete = null;
boolean result;
@@ -109,7 +109,7 @@
@Test(expected=NullPointerException.class)
public void testFindErrorInJsonGraph_1() throws Exception {
GraphMLConverter testSubject;
- TitanGraph graph = null;
+ JanusGraph graph = null;
String outputDirectory = "";
String result;
@@ -122,7 +122,7 @@
@Test(expected=NullPointerException.class)
public void testExportUsers() throws Exception {
GraphMLConverter testSubject;
- TitanGraph graph = null;
+ JanusGraph graph = null;
String outputDirectory = "";
String result;
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
index c6905a9..c2605a6 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
@@ -11,7 +11,7 @@
@Test
public void testAnalyzeGraphMLData() throws Exception {
GraphMLDataAnalyzer testSubject;
- String[] args = new String[] { "export", "src/main/resources/config/titan.properties", "./" };
+ String[] args = new String[] { "export", "src/main/resources/config/janusgraph.properties", "./" };
String result;
// default test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java
similarity index 63%
rename from asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java
rename to asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java
index 431c59f..5be99c3 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java
@@ -2,15 +2,15 @@
import org.junit.Test;
-public class TitanGraphInitializerTest {
+public class JanusGraphInitializerTest {
@Test(expected=IllegalArgumentException.class)
public void testCreateGraph() throws Exception {
- String titanCfgFile = "";
+ String janusGraphCfgFile = "";
boolean result;
// default test
- result = TitanGraphInitializer.createGraph("");
+ result = JanusGraphInitializer.createGraph("");
}
}
\ No newline at end of file
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
index 982c85b..09c8b08 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java
@@ -12,7 +12,7 @@
@Test
public void testDeleteAllProducts() throws Exception {
ProductLogic testSubject;
- String titanFile = "";
+ String janusGraphFile = "";
String beHost = "";
String bePort = "";
String adminUser = "";
@@ -20,7 +20,7 @@
// default test
testSubject = createTestSubject();
- result = testSubject.deleteAllProducts(titanFile, beHost, bePort, adminUser);
+ result = testSubject.deleteAllProducts(janusGraphFile, beHost, bePort, adminUser);
assertFalse(result);
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java
index 4db5c06..4e52ad5 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.junit.Test;
import java.util.List;
@@ -15,8 +15,8 @@
@Test(expected=IllegalArgumentException.class)
public void testOpenGraph() throws Exception {
UpdatePropertyOnVertex testSubject;
- String titanFileLocation = "";
- TitanGraph result;
+ String janusGraphFileLocation = "";
+ JanusGraph result;
// default test
testSubject = createTestSubject();
@@ -26,13 +26,13 @@
@Test(expected=NullPointerException.class)
public void testUpdatePropertyOnServiceAtLeastCertified() throws Exception {
UpdatePropertyOnVertex testSubject;
- String titanFile = "";
+ String janusGraphFile = "";
Map<String, Object> keyValueToSet = null;
List<Map<String, Object>> orCriteria = null;
Integer result;
// default test
testSubject = createTestSubject();
- result = testSubject.updatePropertyOnServiceAtLeastCertified(titanFile, keyValueToSet, orCriteria);
+ result = testSubject.updatePropertyOnServiceAtLeastCertified(janusGraphFile, keyValueToSet, orCriteria);
}
}
\ No newline at end of file
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java
index c0ae55a..b6ab4f5 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java
@@ -6,9 +6,9 @@
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyMap;
@@ -18,14 +18,14 @@
@RunWith(MockitoJUnitRunner.class)
public class VrfObjectFixHandlerTest {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private VrfObjectFixHandler vrfObjectFixHandler;
@Before
public void init(){
- titanDao = Mockito.mock(TitanDao.class);
- vrfObjectFixHandler = new VrfObjectFixHandler(titanDao);
+ janusGraphDao = Mockito.mock(JanusGraphDao.class);
+ vrfObjectFixHandler = new VrfObjectFixHandler(janusGraphDao);
}
@Test
@@ -35,25 +35,29 @@
@Test
public void handleDetectNotFoundTest(){
- when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
assertThat(vrfObjectFixHandler.handle("detect", null)).isTrue();
}
@Test
- public void handleDetectTitanNotConnectedTest(){
- when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_CONNECTED));
+ public void handleDetectJanusGraphNotConnectedTest(){
+ when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_CONNECTED));
assertThat(vrfObjectFixHandler.handle("detect", null)).isFalse();
}
@Test
public void handleFixNotFoundTest(){
- when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
assertThat(vrfObjectFixHandler.handle("fix", null)).isTrue();
}
@Test
public void handleFixNotCreatedTest(){
- when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_CREATED));
+ when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_CREATED));
assertThat(vrfObjectFixHandler.handle("fix", null)).isFalse();
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java
index 4e80f8e..109aa9d 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java
@@ -37,7 +37,7 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
@@ -45,7 +45,7 @@
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.*;
@@ -58,7 +58,7 @@
private CsarGenerator test;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private Component component;
@@ -83,9 +83,10 @@
props.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
graphVertex.setMetadataProperties(props);
- when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props)).thenReturn(Either.left(list));
+ when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props)).thenReturn(Either.left(list));
when(toscaOperationFacade.getToscaFullElement(any(String.class))).thenReturn(Either.left(component));
- when(titanDao.getChildVertex(graphVertex, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDao
+ .getChildVertex(graphVertex, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson)).thenReturn(Either.left(graphVertex));
test.generateCsar(uuid,scanner);
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java
index 315f615..b7e8eae 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java
@@ -29,7 +29,7 @@
*/
package org.openecomp.sdc.asdctool.impl.internal.tool;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -39,11 +39,11 @@
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.HashMap;
@@ -58,7 +58,7 @@
private DeleteComponentHandler test;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private TopologyTemplateOperation topologyTemplateOperation;
@@ -74,7 +74,7 @@
Scanner scanner = new Scanner(in);
String id = "start";
GraphVertex loc = new GraphVertex();
- TitanVertex vertex = Mockito.mock(TitanVertex.class);
+ JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
loc.setVertex(vertex);
Map<GraphPropertyEnum, Object> metadataProperties = new HashMap<>();
@@ -83,7 +83,7 @@
metadataProperties.put(GraphPropertyEnum.NAME, "user1");
loc.setMetadataProperties(metadataProperties);
- when(titanDao.getVertexById(id)).thenReturn(Either.left(loc));
+ when(janusGraphDao.getVertexById(id)).thenReturn(Either.left(loc));
when(topologyTemplateOperation.deleteToscaElement(ArgumentMatchers.any(GraphVertex.class))).thenReturn(Either.left(toscaElement));
test.deleteComponent(id,scanner);
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
index 0d91f1a..cf064ee 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
@@ -8,13 +8,13 @@
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraClient;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
-import org.openecomp.sdc.be.model.jsontitan.operations.*;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*;
public class ValidationToolConfigurationTest {
@@ -125,7 +125,7 @@
@Test
public void testDaoStrategy() {
ValidationToolConfiguration testSubject;
- TitanClientStrategy result;
+ JanusGraphClientStrategy result;
// default test
testSubject = createTestSubject();
@@ -174,14 +174,14 @@
}
@Test
- public void testTitanDao() {
+ public void testJanusGraphDao() {
ValidationToolConfiguration testSubject;
- TitanGraphClient titanGraphClient = null;
- TitanDao result;
+ JanusGraphClient janusGraphClient = null;
+ JanusGraphDao result;
// default test
testSubject = createTestSubject();
- result = testSubject.titanDao(titanGraphClient);
+ result = testSubject.janusGraphDao(janusGraphClient);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java
index 5799b6d..e4fb979 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java
@@ -15,8 +15,8 @@
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import java.util.HashMap;
import java.util.Map;
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java
index 8d46e61..64e06ac 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java
@@ -41,18 +41,18 @@
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
@@ -95,7 +95,7 @@
@Mock
private LifecycleBusinessLogic lifecycleBusinessLogic;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private ComponentsUtils componentUtils;
@Mock
@@ -179,8 +179,8 @@
public void nodeTypesUpgradeFailed() {
migration.setNodeTypesSupportOnly(true);
resolveUserAndDefineUpgradeLevel();
- when(titanDao.getByCriteria(any(), any(), any(), any()))
- .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getByCriteria(any(), any(), any(), any()))
+ .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus());
}
@@ -189,8 +189,8 @@
configurationManager.getConfiguration().setEnableAutoHealing(false);
migration.init();
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(0)).commit();
- verify(titanDao, times(0)).rollback();
+ verify(janusGraphDao, times(0)).commit();
+ verify(janusGraphDao, times(0)).rollback();
}
@Test
@@ -213,8 +213,8 @@
migration.setNodeTypesSupportOnly(true);
upgradeAllScenario(false);
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(2)).commit();
- verify(titanDao, times(0)).rollback();
+ verify(janusGraphDao, times(2)).commit();
+ verify(janusGraphDao, times(0)).rollback();
}
@Test
@@ -230,8 +230,8 @@
resolveUserAndDefineUpgradeLevel();
upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeVFC, isFailed);
assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(1)).commit();
- verify(titanDao, times(2)).rollback();
+ verify(janusGraphDao, times(1)).commit();
+ verify(janusGraphDao, times(2)).rollback();
}
@@ -247,8 +247,8 @@
upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeVFC, isFailed);
migration.init();
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(2)).commit();
- verify(titanDao, times(0)).rollback();
+ verify(janusGraphDao, times(2)).commit();
+ verify(janusGraphDao, times(0)).rollback();
}
@Test
@@ -262,8 +262,8 @@
resolveUserAndDefineUpgradeLevel();
upgradeRules(failOnVfUpgrade, exceptionOnFvUpgrade, upgradeServices, upgradeVFC, isFailed);
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(3)).commit();
- verify(titanDao, times(1)).rollback();
+ verify(janusGraphDao, times(3)).commit();
+ verify(janusGraphDao, times(1)).rollback();
}
@@ -271,8 +271,8 @@
public void upgradeAll() {
upgradeAllScenario(true);
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(4)).commit();
- verify(titanDao, times(0)).rollback();
+ verify(janusGraphDao, times(4)).commit();
+ verify(janusGraphDao, times(0)).rollback();
}
@Test
@@ -282,8 +282,8 @@
.thenReturn(StorageOperationStatus.OK);
upgradeAllScenario(true);
assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus());
- verify(titanDao, times(4)).commit();
- verify(titanDao, times(0)).rollback();
+ verify(janusGraphDao, times(4)).commit();
+ verify(janusGraphDao, times(0)).rollback();
}
@Test
@@ -302,7 +302,7 @@
@Test
public void migrationFailedWhenUserNotResolved() {
when(userAdminOperation.getUserData(anyString(), eq(false))).thenReturn(Either.right(ActionStatus.MISSING_INFORMATION));
- when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus());
}
@@ -523,13 +523,13 @@
List<GraphVertex> components = Lists.newArrayList();
components.add(component);
- when(titanDao.getByCriteria(any(), any(), any(), any()))
+ when(janusGraphDao.getByCriteria(any(), any(), any(), any()))
.thenReturn(Either.left(components));
- when(titanDao.getParentVertecies(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class)))
+ when(janusGraphDao.getParentVertecies(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class)))
//1th node to upgrade
.thenReturn(Either.left(components))
//parent of the 1th node - stop recursion
- .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
}
private GraphVertex createComponent() {
@@ -601,7 +601,7 @@
components.add(component);
when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(Either.left(resource));
- when(titanDao.getByCriteria(any(), any(), any(), any()))
+ when(janusGraphDao.getByCriteria(any(), any(), any(), any()))
.thenReturn(Either.left(components));
when(csarOperation.getCsarLatestVersion(anyString(), any()))
.thenReturn(Either.left("2.0"));
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java
index 00b6d57..47481f8 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java
@@ -3,14 +3,14 @@
import org.junit.Test;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
public class SdcCatalogMigrationTest {
private SdcCatalogMigration createTestSubject() {
- return new SdcCatalogMigration(new TopologyTemplateOperation(), new TitanDao(new TitanGraphClient()));
+ return new SdcCatalogMigration(new TopologyTemplateOperation(), new JanusGraphDao(new JanusGraphClient()));
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java
index c10291b..581ae09 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java
@@ -8,8 +8,8 @@
import org.junit.Test;
import org.mockito.Mock;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
public class ForwardPathMigrationTest {
@@ -17,7 +17,7 @@
ForwardPathMigration forwardPathMigration = null;
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@Mock
UserAdminOperation userAdminOperation;
@@ -27,7 +27,7 @@
@Before
public void setUp() throws Exception {
- forwardPathMigration = new ForwardPathMigration(titanDao, userAdminOperation, toscaOperationFacade);
+ forwardPathMigration = new ForwardPathMigration(janusGraphDao, userAdminOperation, toscaOperationFacade);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java
index b7f0140..c3266f9 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java
@@ -11,14 +11,14 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@RunWith(MockitoJUnitRunner.class)
public class ResourceLifecycleMigrationTest {
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private LifecycleBusinessLogic lifecycleBusinessLogic;
@Mock
@@ -29,7 +29,7 @@
@Before
public void setUp() throws Exception {
resourceLifecycleMigration =
- new ResourceLifecycleMigration(titanDao, lifecycleBusinessLogic, userAdminOperation);
+ new ResourceLifecycleMigration(janusGraphDao, lifecycleBusinessLogic, userAdminOperation);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java
index d040d66..2a55aaf 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java
@@ -7,14 +7,14 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.ArrayList;
@@ -29,15 +29,16 @@
@RunWith(MockitoJUnitRunner.class)
public class SDCInstancesMigrationTest{
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private NodeTemplateOperation nodeTemplateOperation;
@Test
public void testFailedMigration(){
- SDCInstancesMigration instancesMigration = new SDCInstancesMigration(titanDao, nodeTemplateOperation);
- when(titanDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR));
+ SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation);
+ when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR));
MigrationResult migrate = instancesMigration.migrate();
MigrationStatus migrationStatus = migrate.getMigrationStatus();
@@ -45,7 +46,7 @@
}
@Test
public void testSuccessMigration(){
- SDCInstancesMigration instancesMigration = new SDCInstancesMigration(titanDao, nodeTemplateOperation);
+ SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation);
List<GraphVertex> list = new ArrayList<>();
GraphVertex vertexOrig = new GraphVertex();
Map<String, CompositionDataDefinition> jsonComposition = new HashMap<>();
@@ -59,7 +60,7 @@
vertexOrig.setType(ComponentTypeEnum.SERVICE);
list.add(vertexOrig);
- when(titanDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.left(list));
+ when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.left(list));
when(nodeTemplateOperation.createInstanceEdge(vertexOrig, instance)).thenReturn(StorageOperationStatus.OK);
MigrationResult migrate = instancesMigration.migrate();
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java
index 0ea3b91..1d3e761 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java
@@ -10,18 +10,18 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
@RunWith(MockitoJUnitRunner.class)
public class SdcArchiveMigrationTest {
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
SdcArchiveMigration sdcArchiveMigration = null;
@Before
public void setUp() throws Exception {
- sdcArchiveMigration = new SdcArchiveMigration(titanDao);
+ sdcArchiveMigration = new SdcArchiveMigration(janusGraphDao);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java
new file mode 100644
index 0000000..93606e2
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java
@@ -0,0 +1,38 @@
+package org.openecomp.sdc.asdctool.servlets;
+
+import org.janusgraph.core.JanusGraph;
+import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+import java.io.File;
+
+public class ExportImportJanusGraphServletTest {
+
+ private ExportImportJanusGraphServlet createTestSubject() {
+ return new ExportImportJanusGraphServlet();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testExport() throws Exception {
+ ExportImportJanusGraphServlet testSubject;
+ File janusGraphPropertiesFile = null;
+ String exportGraphMetadata = "";
+ Response result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.export(janusGraphPropertiesFile, exportGraphMetadata);
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testExportGraph() throws Exception {
+ ExportImportJanusGraphServlet testSubject;
+ JanusGraph graph = null;
+ String outputDirectory = "";
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.exportGraph(graph, outputDirectory);
+ }
+}
\ No newline at end of file
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java
deleted file mode 100644
index 9f10463..0000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.openecomp.sdc.asdctool.servlets;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import org.junit.Test;
-
-import javax.ws.rs.core.Response;
-import java.io.File;
-
-public class ExportImportTitanServletTest {
-
- private ExportImportTitanServlet createTestSubject() {
- return new ExportImportTitanServlet();
- }
-
- @Test(expected=NullPointerException.class)
- public void testExport() throws Exception {
- ExportImportTitanServlet testSubject;
- File titanPropertiesFile = null;
- String exportGraphMetadata = "";
- Response result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.export(titanPropertiesFile, exportGraphMetadata);
- }
-
- @Test(expected=NullPointerException.class)
- public void testExportGraph() throws Exception {
- ExportImportTitanServlet testSubject;
- TitanGraph graph = null;
- String outputDirectory = "";
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.exportGraph(graph, outputDirectory);
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index d15a3ca..4dcc3d2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -292,7 +292,7 @@
}
def newEcoSystem(){
- //cleanTitan()
+ //cleanJanusGraph()
backupDB() //and clean all
//restoreDB() //restore latest
createSchema()
@@ -322,11 +322,11 @@
def createSchema(){
createSchemaPreStep()
//todo- create schema
- //todo- create titan
+ //todo- create JanusGraph
createSchemaPostStep()
}
-def cleanTitan(){
+def cleanJanusGraph(){
execSafe{
ssh.settings {
knownHosts = allowAnyHosts
@@ -339,9 +339,9 @@
}
}
}
-task cleanTitan {
+task cleanJanusGraph {
doLast{
- cleanTitan()
+ cleanJanusGraph()
}
}
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml
index dcd4c58..dfa6eaa 100644
--- a/catalog-be/pom.xml
+++ b/catalog-be/pom.xml
@@ -301,11 +301,10 @@
<scope>compile</scope>
</dependency>
- <!-- TITAN -->
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-core</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -324,9 +323,9 @@
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-cassandra</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -346,7 +345,6 @@
<version>${lang3.version}</version>
<scope>compile</scope>
</dependency>
- <!-- TITAN END -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
@@ -407,25 +405,6 @@
<version>20131018</version>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>tinkergraph-gremlin</artifactId>
- <version>3.0.1-incubating</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-groovy</artifactId>
- <version>3.0.1-incubating</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>groovy</artifactId>
- <groupId>org.codehaus.groovy</groupId>
- </exclusion>
- </exclusions>
- </dependency>
<!-- CASSANDRA -->
<dependency>
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
index 09c5cb3..763db8f 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
@@ -20,7 +20,7 @@
default['cassandra']['cluster_name'] = "SDC-CS-"
default['cassandra']['socket_read_timeout'] = 20000
default['cassandra']['socket_connect_timeout'] = 20000
-default['cassandra']['titan_connection_timeout'] = 10000
+default['cassandra']['janusgraph_connection_timeout'] = 10000
#Elasticsearch
default['elasticsearch']['cluster_name'] = "SDC-ES-"
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
index 5d83cdb..20c144c 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
@@ -2,18 +2,18 @@
replication_factor=node['cassandra']['replication_factor']
if node['Pair_EnvName'] == ""
- titan_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s
+ janusgraph_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s
conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s
else
- titan_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s + "," + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "," + replication_factor.to_s
+ janusgraph_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s + "," + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "," + replication_factor.to_s
conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s + "','" + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "','" + replication_factor.to_s
end
-template "titan.properties" do
- path "#{ENV['JETTY_BASE']}/config/catalog-be/titan.properties"
- source "BE-titan.properties.erb"
+template "janusgraph.properties" do
+ path "#{ENV['JETTY_BASE']}/config/catalog-be/janusgraph.properties"
+ source "BE-janusgraph.properties.erb"
owner "jetty"
group "jetty"
mode "0755"
@@ -23,8 +23,8 @@
:cassandra_usr => node['cassandra'][:cassandra_user],
:rep_factor => replication_factor,
:DC_NAME => node['cassandra']['datacenter_name'],
- :DC_NAME_WITH_REP => titan_dcname_with_rep,
- :titan_connection_timeout => node['cassandra']['titan_connection_timeout'],
+ :DC_NAME_WITH_REP => janusgraph_dcname_with_rep,
+ :janusgraph_connection_timeout => node['cassandra']['janusgraph_connection_timeout'],
:cassandra_truststore_password => node['cassandra'][:truststore_password],
:cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}"
})
@@ -46,7 +46,7 @@
:rep_factor => replication_factor,
:DC_NAME => node['cassandra']['datacenter_name'],
:REP_STRING => conf_dcname_with_rep,
- :titan_Path => "/var/lib/jetty/config/catalog-be/",
+ :janusgraph_Path => "/var/lib/jetty/config/catalog-be/",
:socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
:socket_read_timeout => node['cassandra']['socket_read_timeout'],
:cassandra_pwd => node['cassandra'][:cassandra_password],
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
index 0ad9997..6a49b19 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
@@ -28,14 +28,14 @@
toscaConformanceLevel: 9.0
minToscaConformanceLevel: 3.0
-titanCfgFile: /var/lib/jetty/config/catalog-be/titan.properties
-titanInMemoryGraph: false
-titanLockTimeout: 1800
-# The interval to try and reconnect to titan DB when it is down during ASDC startup:
-titanReconnectIntervalInSeconds: 3
+janusGraphCfgFile: /var/lib/jetty/config/catalog-be/janusgraph.properties
+janusGraphInMemoryGraph: false
+janusGraphLockTimeout: 1800
+# 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:
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-janusgraph.properties.erb
similarity index 93%
rename from catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb
rename to catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-janusgraph.properties.erb
index 1a259a1..e091052 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-janusgraph.properties.erb
@@ -3,7 +3,7 @@
storage.port=9160
storage.username=<%= @cassandra_usr %>
storage.password=<%= @cassandra_pwd %>
-storage.connection-timeout=<%= @titan_connection_timeout %>
+storage.connection-timeout=<%= @janusgraph_connection_timeout %>
storage.cassandra.keyspace=sdctitan
storage.cassandra.ssl.enabled=<%= @cassandra_ssl_enabled %>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
index 04df614..7b3d4fa 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
@@ -35,7 +35,7 @@
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -67,13 +67,13 @@
private Gson gson = new Gson();
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private GroupTypeBusinessLogic groupTypeBusinessLogic;
private AnnotationBusinessLogic annotationBusinessLogic;
- public YamlTemplateParsingHandler(TitanDao titanDao,
+ public YamlTemplateParsingHandler(JanusGraphDao janusGraphDao,
GroupTypeBusinessLogic groupTypeBusinessLogic, AnnotationBusinessLogic annotationBusinessLogic) {
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
this.groupTypeBusinessLogic = groupTypeBusinessLogic;
this.annotationBusinessLogic = annotationBusinessLogic;
}
@@ -865,17 +865,17 @@
}
private Map<String, Object> failIfNoNodeTemplates(String fileName) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName);
}
private Object failIfNotTopologyTemplate(String fileName) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName);
}
private void rollbackWithException(ActionStatus actionStatus, String... params) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(actionStatus, params);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java
index 0303b3f..04c4d11 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java
@@ -27,7 +27,7 @@
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IArtifactOperation;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
index c0a89d6..00efd80 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
@@ -31,7 +31,7 @@
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.impl.EsHealthCheckDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector;
import org.openecomp.sdc.common.api.HealthCheckInfo;
import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus;
@@ -78,7 +78,7 @@
private final ScheduledExecutorService healthCheckScheduler = newSingleThreadScheduledExecutor((Runnable r) -> new Thread(r, "BE-Health-Check-Task"));
private HealthCheckScheduledTask healthCheckScheduledTask = null;
@Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Resource
private EsHealthCheckDao esHealthCheckDao;
@Resource
@@ -130,8 +130,8 @@
// BE
getBeHealthCheck(healthCheckInfos);
- // Titan
- getTitanHealthCheck(healthCheckInfos);
+ // JanusGraph
+ getJanusGraphHealthCheck(healthCheckInfos);
// ES
getEsHealthCheck(healthCheckInfos);
@@ -195,25 +195,25 @@
}
- public List<HealthCheckInfo> getTitanHealthCheck(List<HealthCheckInfo> healthCheckInfos) {
- // Titan health check and version
+ public List<HealthCheckInfo> getJanusGraphHealthCheck(List<HealthCheckInfo> healthCheckInfos) {
+ // JanusGraph health check and version
String description;
- boolean isTitanUp;
+ boolean isJanusGraphUp;
try {
- isTitanUp = titanGenericDao.isGraphOpen();
+ isJanusGraphUp = janusGraphGenericDao.isGraphOpen();
} catch (Exception e) {
- description = "Titan error: ";
- healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description));
+ description = "JanusGraph error: ";
+ healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description));
log.error(description, e);
return healthCheckInfos;
}
- if (isTitanUp) {
+ if (isJanusGraphUp) {
description = "OK";
- healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, UP, null, description));
+ healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, UP, null, description));
} else {
- description = "Titan graph is down";
- healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description));
+ description = "JanusGraph graph is down";
+ healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description));
}
return healthCheckInfos;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java
index 7f6565c..19e696c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
@@ -471,9 +471,9 @@
try {
- Either<AdditionalInformationDefinition, TitanOperationStatus> findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false);
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false);
if (findIdRes.isRight()) {
- StorageOperationStatus status = DaoStatusConverter.convertTitanStatusToStorageStatus(findIdRes.right().value());
+ StorageOperationStatus status = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findIdRes.right().value());
ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForAdditionalInformation(status);
result = Either.right(componentsUtils.getResponseFormatAdditionalProperty(actionStatus));
} else {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java
index 3cf520d..c836e91 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java
@@ -26,7 +26,7 @@
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.validation.AccessValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -34,8 +34,8 @@
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
@@ -49,14 +49,14 @@
private static final Logger log = Logger.getLogger(ArchiveBusinessLogic.class.getName());
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
private final AccessValidations accessValidations;
private final ArchiveOperation archiveOperation;
private final ToscaOperationFacade toscaOperationFacade;
private final ComponentsUtils componentUtils;
- public ArchiveBusinessLogic(TitanDao titanDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) {
- this.titanDao = titanDao;
+ public ArchiveBusinessLogic(JanusGraphDao janusGraphDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) {
+ this.janusGraphDao = janusGraphDao;
this.accessValidations = accessValidations;
this.archiveOperation = archiveOperation;
this.toscaOperationFacade = tof;
@@ -143,7 +143,7 @@
throw e;
}
finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
index f23057c..dcc6eee 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
@@ -73,7 +73,7 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.heat.HeatParameterType;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation;
import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation;
@@ -652,13 +652,13 @@
if (resultOp == null || resultOp.isRight()) {
log.debug(ROLLBACK);
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
else {
log.debug(COMMIT);
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
if (shouldLock) {
@@ -804,11 +804,11 @@
// unlock resource
if (resultOp == null || resultOp.isRight()) {
log.debug(ROLLBACK);
- titanDao.rollback();
+ janusGraphDao.rollback();
}
else {
log.debug(COMMIT);
- titanDao.commit();
+ janusGraphDao.commit();
}
componentType = component.getComponentType();
@@ -4072,7 +4072,7 @@
if (saveArtifactStatus.equals(CassandraOperationStatus.OK)) {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
log.debug("Artifact Saved In ES {}", artifactData.getId());
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK);
@@ -4083,7 +4083,7 @@
}
else {
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
log.info("Failed to save artifact {}.", artifactData.getId());
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
@@ -4228,13 +4228,13 @@
if (resultOp == null || resultOp.isRight()) {
log.debug(ROLLBACK);
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
else {
log.debug(COMMIT);
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
if (shouldLock) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
index c77223b..8a4b761 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
@@ -38,9 +38,9 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
@@ -59,9 +59,9 @@
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations;
-import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
@@ -108,10 +108,10 @@
protected IGraphLockOperation graphLockOperation;
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Autowired
- protected TitanGenericDao titanGenericDao;
+ protected JanusGraphGenericDao janusGraphGenericDao;
@Autowired
protected IElementOperation elementDao;
@@ -283,9 +283,9 @@
NodeTypeEnum nodeType = componentType.getNodeType();
if (!inTransaction) {
if (either == null || either.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
// unlock resource
@@ -339,11 +339,11 @@
}
<T extends PropertyDataDefinition> Either<String, ResponseFormat> updateInputPropertyObjectValue(T property) {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll();
if (allDataTypesEither.isRight()) {
- TitanOperationStatus status = allDataTypesEither.right().value();
+ JanusGraphOperationStatus status = allDataTypesEither.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
Map<String, DataTypeDefinition> allDataTypes = allDataTypesEither.left().value();
String propertyType = property.getType();
@@ -356,7 +356,8 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (Boolean.FALSE.equals(res)) {
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT))));
}
} else {
Object object = isValid.left().value();
@@ -429,15 +430,15 @@
}
// For UT
- public void setTitanGenericDao(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public void setJanusGraphGenericDao(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
protected Either<Map<String, DataTypeDefinition>, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus operationStatus = allDataTypes.right().value();
- if (operationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus operationStatus = allDataTypes.right().value();
+ if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", ErrorSeverity.ERROR);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY));
} else {
@@ -536,10 +537,10 @@
void commitOrRollback(Either<?, ResponseFormat> result) {
if (result == null || result.isRight()) {
log.warn("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -587,7 +588,8 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (Boolean.FALSE.equals(res)) {
- throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT));
+ throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT));
}
} else {
Object object = isValid.left().value();
@@ -599,7 +601,8 @@
log.trace("After validateAndUpdateRules. pair = {}", pair);
if (Boolean.FALSE.equals(pair.getRight())) {
BeEcompErrorManager.getInstance().logBeInvalidValueError(ADD_PROPERTY_VALUE, pair.getLeft(), property.getName(), propertyType);
- throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT));
+ throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT));
}
return newValue;
}
@@ -625,7 +628,7 @@
private void failOnIllegalArgument() {
throw new ByActionStatusComponentException(
componentsUtils.convertFromStorageResponse(
- DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT)));
}
public Either<Object, Boolean> validateAndUpdatePropertyValue(String propertyType, String value, boolean isValidate, String innerType, Map<String, DataTypeDefinition> dataTypes) {
@@ -712,7 +715,7 @@
}
protected void rollbackWithException(ActionStatus actionStatus, String... params) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(actionStatus, params);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
index f2fd377..425458f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
@@ -23,7 +23,7 @@
import org.openecomp.sdc.be.components.validation.CapabilitiesValidation;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -33,8 +33,8 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.CapabilitiesOperation;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -94,7 +94,7 @@
try {
return createCapability(componentId, capabilityDefinitions, storedComponent);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -151,7 +151,7 @@
result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn);
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result
.right().value(), storedComponent.getComponentType()), ""));
}
@@ -161,11 +161,11 @@
StorageOperationStatus storageOperationStatus = capabilitiesOperation
.createOrUpdateCapabilityProperties(componentId, propertiesMap);
if (storageOperationStatus != StorageOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(storageOperationStatus));
}
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(capabilitiesToReturn);
}
@@ -242,7 +242,7 @@
result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn);
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result
.right().value(), storedComponent.getComponentType()), ""));
}
@@ -252,14 +252,14 @@
StorageOperationStatus storageOperationStatus = capabilitiesOperation
.createOrUpdateCapabilityProperties(componentId, propertiesMap);
if (storageOperationStatus != StorageOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(storageOperationStatus));
}
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(capabilitiesToReturn);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -292,13 +292,13 @@
Either<List<CapabilityDefinition>, StorageOperationStatus> deleteCapabilityEither
= deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete);
if (deleteCapabilityEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value()));
}
StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation
.deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete));
if (deleteStorageOperationStatus != StorageOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus));
}
capabilitiesToReturn.add(initiateNewCapability(storedComponent, capabilityDefinitionToUpdate));
@@ -334,13 +334,13 @@
Either<List<CapabilityDefinition>, StorageOperationStatus> deleteCapabilityEither
= deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete);
if (deleteCapabilityEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value()));
}
StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation
.deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete));
if (deleteStorageOperationStatus != StorageOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus));
}
}
@@ -416,7 +416,7 @@
return deleteCapability(capabilityIdToDelete, storedComponent);
} catch (Exception e) {
LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "delete", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.CAPABILITY_NOT_FOUND));
} finally {
if (lockResult.isLeft() && lockResult.left().value()) {
@@ -441,14 +441,14 @@
Either<List<CapabilityDefinition>, StorageOperationStatus> result = deleteCapability(storedComponent,
storedComponentCapabilities, capabilityDefinitionToDeleteEither.left().value());
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error("Failed to delete capability from component {}. Response is {}", storedComponent.getName(),
result.right().value());
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(),
storedComponent.getComponentType())));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(capabilityDefinitionToDeleteEither.left().value());
}
@@ -528,7 +528,7 @@
if (lockResult.isRight()) {
LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(),
lockResult.right().value().getFormattedMessage());
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(lockResult.right().value());
}
}
@@ -584,7 +584,7 @@
StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation
.deleteCapabilityProperties(component, buildCapPropKey(storedCapability));
if (deleteStorageOperationStatus != StorageOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
@@ -605,11 +605,11 @@
}
public Either<Map<String, CapabilityTypeDefinition>, ResponseFormat> getAllCapabilityTypes() {
- Either<Map<String, CapabilityTypeDefinition>, TitanOperationStatus> capabilityTypeCacheAll =
+ Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> capabilityTypeCacheAll =
capabilityTypeOperation.getAllCapabilityTypes();
if (capabilityTypeCacheAll.isRight()) {
- TitanOperationStatus operationStatus = capabilityTypeCacheAll.right().value();
- if (TitanOperationStatus.NOT_FOUND == operationStatus) {
+ JanusGraphOperationStatus operationStatus = capabilityTypeCacheAll.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) {
BeEcompErrorManager.getInstance().logInternalDataError("FetchCapabilityTypes",
"Capability types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY));
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
index bc5f77b..c77877f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
@@ -68,20 +68,21 @@
sdcKeyspaces.add(table.getTableDescription().getKeyspace());
}
- String titanCfgFile = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile();
+ String janusGraphCfgFile = ConfigurationManager.getConfigurationManager()
+ .getConfiguration().getJanusGraphCfgFile();
Properties prop = new Properties();
- InputStream titanProp = null;
+ InputStream janusGraphProp = null;
try {
//load a properties file
- titanProp = new FileInputStream(titanCfgFile);
- prop.load(titanProp);
- //Add titan keyspace
- String titanKeyspace = prop.getProperty("storage.cassandra.keyspace");
- if (!GeneralUtility.isEmptyString(titanKeyspace)) {
- sdcKeyspaces.add(titanKeyspace);
+ janusGraphProp = new FileInputStream(janusGraphCfgFile);
+ prop.load(janusGraphProp);
+ //Add janusgraph keyspace
+ String janusGraphKeyspace = prop.getProperty("storage.cassandra.keyspace");
+ if (!GeneralUtility.isEmptyString(janusGraphKeyspace)) {
+ sdcKeyspaces.add(janusGraphKeyspace);
}
} catch (Exception e) {
- log.error("Failed to open titen.properties file , url is : {}", titanCfgFile, e);
+ log.error("Failed to open titen.properties file , url is : {}", janusGraphCfgFile, e);
}
log.info("All sdc keyspaces are : {}", sdcKeyspaces);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
index d2f845c..1de92e2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
@@ -237,17 +237,17 @@
typeOperations.addType(newTypeDefinition);
} else {
if (typeOperations.isSameType(newTypeDefinition, existingDefinition)) {
- propertyOperation.getTitanGenericDao().rollback();
+ propertyOperation.getJanusGraphGenericDao().rollback();
createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, null));
continue;
} else {
typeOperations.updateType(existingDefinition, newTypeDefinition);
}
}
- propertyOperation.getTitanGenericDao().commit();
+ propertyOperation.getJanusGraphGenericDao().commit();
createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, true));
} catch (Exception e) {
- propertyOperation.getTitanGenericDao().rollback();
+ propertyOperation.getJanusGraphGenericDao().rollback();
createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, false));
}
@@ -287,10 +287,10 @@
}
finally {
if (eitherResult.isLeft()) {
- propertyOperation.getTitanGenericDao().commit();
+ propertyOperation.getJanusGraphGenericDao().commit();
}
else {
- propertyOperation.getTitanGenericDao().rollback();
+ propertyOperation.getJanusGraphGenericDao().rollback();
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
index dcd0c7b..18d8688 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
@@ -561,7 +561,7 @@
return Either.left(result);
}
finally{
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -596,7 +596,7 @@
}
responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(nonCheckoutCompResponse.right().value()));
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return Either.right(responseFormat);
}
@@ -771,12 +771,12 @@
if ( deleteMarkedElements.isRight()){
- titanDao.rollback();
+ janusGraphDao.rollback();
ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(deleteMarkedElements.right().value(), componentType));
return Either.right(responseFormat);
}
log.trace("end deleteMarkedComponents");
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(deleteMarkedElements.left().value());
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index 71b1257..eebbb0a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -37,7 +37,7 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
@@ -76,10 +76,10 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -1042,13 +1042,13 @@
if (deleteServiceFilterEither.isRight()) {
ActionStatus status = componentsUtils.convertFromStorageResponse(deleteServiceFilterEither.right().value(),
containerComponentType);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(status, componentInstanceId));
}
resultOp = deleteServiceFiltersRelatedTobeDeletedComponentInstance((Service) containerComponent,
componentInstance, ComponentTypeEnum.SERVICE, userId);
if (resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return resultOp;
}
}
@@ -1672,9 +1672,9 @@
finally {
if (result == null || result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType());
@@ -1800,9 +1800,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType());
@@ -1926,11 +1926,11 @@
}
private <T extends PropertyDefinition> Either<String,ResponseFormat> updatePropertyObjectValue(T property, boolean isInput) {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll();
if (allDataTypesEither.isRight()) {
- TitanOperationStatus status = allDataTypesEither.right().value();
+ JanusGraphOperationStatus status = allDataTypesEither.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
Map<String, DataTypeDefinition> allDataTypes = allDataTypesEither.left().value();
String innerType = null;
@@ -1957,7 +1957,7 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (!res) {
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT))));
}
} else {
Object object = isValid.left().value();
@@ -1969,7 +1969,7 @@
ImmutablePair<String, Boolean> pair = propertyOperation.validateAndUpdateRules(propertyType, ((ComponentInstanceProperty) property).getRules(), innerType, allDataTypes, true);
if (pair.getRight() != null && pair.getRight() == false) {
BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), property.getName(), propertyType);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT))));
}
}
return Either.left(newValue);
@@ -2052,9 +2052,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType());
@@ -2147,9 +2147,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType());
@@ -2236,9 +2236,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType());
@@ -2292,9 +2292,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(serviceId, componentTypeEnum.getNodeType());
@@ -2894,11 +2894,11 @@
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(lockStatus)));
}
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
try {
@@ -2920,9 +2920,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType());
@@ -2982,9 +2982,9 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
// unlock resource
graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType());
@@ -3028,7 +3028,7 @@
// on failure of the create instance unlock the resource and rollback the transaction.
if (null == actionResponse || actionResponse.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
unlockComponent(actionResponse, origComponent);
}
@@ -3053,10 +3053,10 @@
} finally {
if (resultOp == null || resultOp.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
log.debug("Success trasaction commit");
}
// unlock resource
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java
index 3ddfe4b..a1a6555 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java
@@ -3,7 +3,7 @@
import fj.data.Either;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
@@ -22,10 +22,10 @@
}
public Either<Map<String, DataTypeDefinition>, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus operationStatus = allDataTypes.right().value();
- if (operationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus operationStatus = allDataTypes.right().value();
+ if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY));
} else {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
index 746f4e9..91d7fa6 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
@@ -32,10 +32,10 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum;
import org.openecomp.sdc.be.datamodel.utils.NodeTypeConvertUtils;
import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
@@ -250,7 +250,7 @@
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resources.right().value())));
}
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -999,7 +999,7 @@
.bimap(this::groupByComponentType,
err -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(err)));
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -1229,10 +1229,11 @@
}
CategoryData categoryData = categoryResult.left().value();
- Either<List<ImmutablePair<SubCategoryData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(),
+ Either<List<ImmutablePair<SubCategoryData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(),
GraphEdgeLabels.SUB_CATEGORY, NodeTypeEnum.ResourceSubcategory, SubCategoryData.class);
if (childrenNodes.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenNodes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenNodes.right().value()));
}
return Either.left(childrenNodes.left().value());
}
@@ -1248,7 +1249,7 @@
return collectComponents(neededType, categoryUid, categoryType, clazz, resourceType);
} finally {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
@@ -1260,7 +1261,8 @@
Class categoryClazz = categoryType == NodeTypeEnum.ServiceNewCategory ? CategoryData.class : SubCategoryData.class;
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
- Either<List<GraphNode>, TitanOperationStatus> getCategory = titanGenericDao.getByCriteria(categoryType, props, categoryClazz);
+ Either<List<GraphNode>, JanusGraphOperationStatus> getCategory = janusGraphGenericDao
+ .getByCriteria(categoryType, props, categoryClazz);
if (getCategory.isRight()) {
return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND);
}
@@ -1275,7 +1277,7 @@
return Either.left(components);
} finally {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
@@ -1283,7 +1285,8 @@
private <T, S extends ComponentMetadataData> Either<List<T>, StorageOperationStatus> collectComponents(NodeTypeEnum neededType, String categoryUid, NodeTypeEnum categoryType, Class<S> clazz, ResourceTypeEnum resourceType) {
List<T> components = new ArrayList<>();
- Either<List<ImmutablePair<S, GraphEdge>>, TitanOperationStatus> parentNodes = titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz);
+ Either<List<ImmutablePair<S, GraphEdge>>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz);
if (parentNodes.isLeft()) {
for (ImmutablePair<S, GraphEdge> component : parentNodes.left().value()) {
ComponentMetadataDataDefinition componentData = component.getLeft().getMetadataDataDefinition();
@@ -1359,7 +1362,7 @@
return result;
} finally {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java
index 0b53da0..d3037a9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java
@@ -8,8 +8,8 @@
import org.openecomp.sdc.be.dto.ExternalRefDTO;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
index 9bab155..7c5a596 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
@@ -41,7 +41,7 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
@@ -54,8 +54,8 @@
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.PropertyDefinition.GroupInstancePropertyValueUpdateBehavior;
import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -71,8 +71,8 @@
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
-import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilitiesFromGroups;
-import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilityPropertiesFromGroups;
+import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilitiesFromGroups;
+import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilityPropertiesFromGroups;
@org.springframework.stereotype.Component("groupBusinessLogic")
public class GroupBusinessLogic extends BaseBusinessLogic {
@@ -247,9 +247,9 @@
} finally {
if (result != null && result.isLeft()) {
- titanDao.commit();
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
if (shouldLock) {
graphLockOperation.unlockComponent(componentId, componentType.getNodeType());
@@ -488,10 +488,10 @@
if (result == null || result.isRight()) {
log.debug("Going to execute rollback on create group.");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("Going to execute commit on create group.");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -718,10 +718,10 @@
if (result == null || result.isRight()) {
log.debug("Going to execute rollback on create group.");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("Going to execute commit on create group.");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -1109,12 +1109,12 @@
}
private List<GroupDefinition> onFailedGroupDBOperation(ResponseFormat responseFormat) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByResponseFormatComponentException(responseFormat);
}
private GroupDefinition onFailedUpdateGroupDBOperation(ResponseFormat responseFormat) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByResponseFormatComponentException(responseFormat);
}
@@ -1132,7 +1132,7 @@
log.debug("#updatePolicyTargetReferencingDeletedGroup - removing all component {} policy targets referencing group {}", component.getUniqueId(), groupId);
ActionStatus actionStatus = policyTargetsUpdateHandler.removePoliciesTargets(component, groupId, PolicyTargetType.GROUPS);
if (ActionStatus.OK != actionStatus) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(actionStatus, groupId);
}
}
@@ -1143,11 +1143,11 @@
Map<String, GroupDataDefinition> groups = new HashMap<>();
Either<List<GroupDefinition>, ResponseFormat> result = null;
Either<List<GroupDefinition>, StorageOperationStatus> createGroupsResult = null;
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
@@ -1213,11 +1213,11 @@
Either<List<GroupDefinition>, StorageOperationStatus> createGroupsResult = null;
List<GroupDataDefinition> groups = new ArrayList<>();
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
@@ -1331,18 +1331,18 @@
if (CollectionUtils.isNotEmpty(properties)) {
if (CollectionUtils.isEmpty(groupTypeProperties)) {
BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "group type does not have properties", ErrorSeverity.INFO);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.MATCH_NOT_FOUND))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.MATCH_NOT_FOUND))));
}
Map<String, PropertyDefinition> groupTypePropertiesMap = groupTypeProperties.stream().collect(Collectors.toMap(PropertyDefinition::getName, p -> p));
- Either<GroupProperty, TitanOperationStatus> addPropertyResult;
+ Either<GroupProperty, JanusGraphOperationStatus> addPropertyResult;
int i = 1;
for (GroupProperty prop : properties) {
addPropertyResult = handleProperty(prop, groupTypePropertiesMap.get(prop.getName()), i, allDAtaTypes, groupType);
if (addPropertyResult.isRight()) {
BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "failed to validate property", ErrorSeverity.INFO);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyResult.right().value()))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertyResult.right().value()))));
}
updatedGroupTypeProperties.add(addPropertyResult.left().value());
@@ -1372,18 +1372,18 @@
return found;
}
- private Either<GroupProperty, TitanOperationStatus> handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map<String, DataTypeDefinition> allDataTypes, String groupType) {
+ private Either<GroupProperty, JanusGraphOperationStatus> handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map<String, DataTypeDefinition> allDataTypes, String groupType) {
if (prop == null) {
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
String propertyType = prop.getType();
String value = groupProperty.getValue();
- Either<String, TitanOperationStatus> checkInnerType = propertyOperation.checkInnerType(prop);
+ Either<String, JanusGraphOperationStatus> checkInnerType = propertyOperation.checkInnerType(prop);
if (checkInnerType.isRight()) {
- TitanOperationStatus status = checkInnerType.right().value();
+ JanusGraphOperationStatus status = checkInnerType.right().value();
return Either.right(status);
}
@@ -1397,7 +1397,7 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (!res) {
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
} else {
Object object = isValid.left().value();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java
index b234bb6..5a5e941 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java
@@ -34,7 +34,7 @@
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GroupOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java
index 5bc0e5e..80d6d65 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java
@@ -26,7 +26,7 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.GroupTypeDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -43,13 +43,13 @@
public class GroupTypeBusinessLogic {
private final GroupTypeOperation groupTypeOperation;
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
private final UserValidations userValidations;
private final ComponentsUtils componentsUtils;
- public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, TitanDao titanDao, UserValidations userValidations, ComponentsUtils componentsUtils) {
+ public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations, ComponentsUtils componentsUtils) {
this.groupTypeOperation = groupTypeOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
this.userValidations = userValidations;
this.componentsUtils = componentsUtils;
}
@@ -61,7 +61,7 @@
Set<String> excludeGroupTypes = getExcludedGroupTypes(internalComponentType);
return groupTypeOperation.getAllGroupTypes(excludeGroupTypes);
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
@@ -81,7 +81,7 @@
}
private GroupTypeDefinition failOnGetGroupType(StorageOperationStatus status, String groupType) {
- titanDao.rollback();
+ janusGraphDao.rollback();
if (status == StorageOperationStatus.NOT_FOUND) {
throw new ByActionStatusComponentException(ActionStatus.GROUP_TYPE_IS_INVALID, groupType);
} else {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
index 4a7b080..0be6ed9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
@@ -31,7 +31,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation;
import org.openecomp.sdc.be.model.utils.TypeCompareUtils;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java
index 0936472..8aec0cd 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java
@@ -43,7 +43,7 @@
import org.openecomp.sdc.be.components.property.PropertyDeclarationOrchestrator;
import org.openecomp.sdc.be.components.validation.ComponentValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -241,7 +241,8 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (Boolean.FALSE.equals(res)) {
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT))));
}
} else {
Object object = isValid.left().value();
@@ -342,10 +343,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP);
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP);
- titanDao.commit();
+ janusGraphDao.commit();
}
}
// unlock resource
@@ -442,10 +443,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP);
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP);
- titanDao.commit();
+ janusGraphDao.commit();
}
}
// unlock resource
@@ -529,10 +530,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP);
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP);
- titanDao.commit();
+ janusGraphDao.commit();
}
}
// unlock resource
@@ -771,10 +772,10 @@
} finally {
if (deleteEither == null || deleteEither.isRight()) {
log.debug("Component id: {} delete input id: {} failed", componentId, inputId);
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("Component id: {} delete input id: {} success", componentId, inputId);
- titanDao.commit();
+ janusGraphDao.commit();
}
unlockComponent(deleteEither, component);
}
@@ -882,10 +883,10 @@
if (result == null || result.isRight()) {
log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP);
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP);
- titanDao.commit();
+ janusGraphDao.commit();
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
index 5cdaa6a..7815b81 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
@@ -139,7 +139,7 @@
NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()),
true);
if(removeArifactFromComponent.isRight()){
- titanDao.rollback();
+ janusGraphDao.rollback();
ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId(
componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()),
storedOperation.getImplementation().getArtifactDisplayName());
@@ -148,7 +148,7 @@
CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId);
if (cassandraStatus != CassandraOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId(
componentsUtils.convertFromStorageResponse(
componentsUtils.convertToStorageOperationStatus(cassandraStatus)),
@@ -166,7 +166,7 @@
interfaceOperation.updateInterfaces(storedComponent.getUniqueId(),
Collections.singletonList(interfaceDefinition));
if (deleteOperationEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(
deleteOperationEither.right().value(), storedComponent.getComponentType())));
}
@@ -175,19 +175,19 @@
Either<String, StorageOperationStatus> deleteInterfaceEither = interfaceOperation.deleteInterface(
storedComponent.getUniqueId(), interfaceDefinition.getUniqueId());
if (deleteInterfaceEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(
deleteInterfaceEither.right().value(), storedComponent.getComponentType())));
}
}
- titanDao.commit();
+ janusGraphDao.commit();
interfaceDefinition.getOperations().putAll(operationsCollection);
interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToDelete.contains(key)));
return Either.left(Collections.singletonList(interfaceDefinition));
} catch (Exception e) {
LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "delete", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_DELETED));
} finally {
if (lockResult.isLeft() && lockResult.left().value()) {
@@ -212,7 +212,7 @@
if (lock) {
Either<Boolean, ResponseFormat> lockResult = lockComponent(component.getUniqueId(), component, action);
if (lockResult.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(lockResult.right().value());
}
}
@@ -253,12 +253,12 @@
}
}
- titanDao.commit();
+ janusGraphDao.commit();
interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToGet.contains(key)));
return Either.left(Collections.singletonList(interfaceDefinition));
} catch (Exception e) {
LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(
componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, componentId));
} finally {
@@ -335,7 +335,7 @@
getOperationFromInterfaceDefinition(interfaceDef,
operation.getUniqueId());
if (!optionalOperation.isPresent()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils
.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND,
storedComponent.getUniqueId()));
@@ -354,7 +354,7 @@
NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()),
true);
if(removeArifactFromComponent.isRight()){
- titanDao.rollback();
+ janusGraphDao.rollback();
ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId(
componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()),
storedOperation.getImplementation().getArtifactDisplayName());
@@ -363,7 +363,7 @@
CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId);
if (cassandraStatus != CassandraOperationStatus.OK) {
- titanDao.rollback();
+ janusGraphDao.rollback();
ResponseFormat responseFormatByArtifactId =
componentsUtils.getResponseFormatByArtifactId(
componentsUtils.convertFromStorageResponse(
@@ -383,18 +383,18 @@
Either<List<InterfaceDefinition>, StorageOperationStatus> addCreateOperationEither =
interfaceOperation.updateInterfaces(storedComponent.getUniqueId(), interfacesCollection);
if (addCreateOperationEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(
addCreateOperationEither.right().value(), storedComponent.getComponentType())));
}
- titanDao.commit();
+ janusGraphDao.commit();
interfacesCollection.forEach(interfaceDefinition -> interfaceDefinition.getOperations().entrySet().removeIf(
entry -> !operationsCollection.values().stream().map(OperationDataDefinition::getName)
.collect(Collectors.toList()).contains(entry.getValue().getName())));
return Either.left(interfacesCollection);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "addOrUpdate", e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -431,7 +431,7 @@
interfaceOperation.addInterfaces(component.getUniqueId(),
Collections.singletonList(interfaceDefinition));
if (interfaceCreateEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(
interfaceCreateEither.right().value(), component.getComponentType())));
}
@@ -580,7 +580,7 @@
}
catch (Exception e) {
LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND));
}
finally {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java
index 752ec40..54b7d2e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java
@@ -398,7 +398,7 @@
.left()
.bind(cmpt -> getPolicyById(cmpt, policyId)).left().map(PolicyDataDefinition::getProperties);
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java
index cb4b6ff..a59156c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java
@@ -4,7 +4,7 @@
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.PolicyTypeDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -25,13 +25,13 @@
private static final Logger log = Logger.getLogger(PolicyTypeBusinessLogic.class);
private PolicyTypeOperation policyTypeOperation;
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private ComponentsUtils componentsUtils;
private UserValidations userValidations;
- public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, TitanDao titanDao, ComponentsUtils componentsUtils, UserValidations userValidations) {
+ public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, JanusGraphDao janusGraphDao, ComponentsUtils componentsUtils, UserValidations userValidations) {
this.policyTypeOperation = policyTypeOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
this.componentsUtils = componentsUtils;
this.userValidations = userValidations;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
index edd3b93..d0dc9fe 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
@@ -29,7 +29,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.GroupTypeDefinition;
import org.openecomp.sdc.be.model.PolicyTypeDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGroupOperation;
import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation;
import org.openecomp.sdc.be.model.operations.api.IPolicyTypeOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java
index 30a9f79..ff532b2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java
@@ -232,7 +232,7 @@
validateUserExists(userId, "validate Product Name Exists", false);
Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(productName, null, ComponentTypeEnum.PRODUCT);
// DE242223
- titanDao.commit();
+ janusGraphDao.commit();
if (dataModelResponse.isLeft()) {
Map<String, Boolean> result = new HashMap<>();
@@ -378,7 +378,7 @@
for (Map.Entry<String, Map<String, Set<String>>> entry : nonDuplicatedCategories.entrySet()) {
catExist = false;
CategoryDefinition categoryDefinition = null;
- // over all categories from Titan
+ // over all categories from JanusGraph
List<CategoryDefinition> categoriesList = allProductCategories.left().value();
if (categoriesList != null) {
for (CategoryDefinition catInDb : categoriesList) {
@@ -415,7 +415,7 @@
}
if (!groupExist) {
// error grouping isn't defined
- // in Titan
+ // in JanusGraph
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.GROUPING.getValue(), group);
componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT);
return Either.right(responseFormat);
@@ -426,7 +426,7 @@
}
}
if (!subcatExist) {
- // error sub category isn't defined in Titan
+ // error sub category isn't defined in JanusGraph
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.SUBCATEGORY.getValue(), subcat.getKey());
componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT);
return Either.right(responseFormat);
@@ -437,7 +437,7 @@
}
}
if (!catExist) {
- // error category isn't defined in Titan
+ // error category isn't defined in JanusGraph
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.CATEGORY.getValue(), entry.getKey());
componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT);
return Either.right(responseFormat);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java
index 275d172..f3a40ad 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java
@@ -34,7 +34,7 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
@@ -489,7 +489,7 @@
}
String innerType;
- Either<String, TitanOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
+ Either<String, JanusGraphOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
if (checkInnerType.isRight()) {
return StorageOperationStatus.INVALID_TYPE;
}
@@ -551,19 +551,19 @@
return jsonElement.toString();
}
- private Either<String, TitanOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) {
+ private Either<String, JanusGraphOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) {
String innerType = null;
if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) {
SchemaDefinition def = schemeGen.get();
if (def == null) {
log.debug("Schema doesn't exists for property of type {}", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
PropertyDataDefinition propDef = def.getProperty();
if (propDef == null) {
log.debug("Property in Schema Definition inside property of type {} doesn't exist", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
innerType = propDef.getType();
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java
index 4a90978..695d82f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java
@@ -21,7 +21,7 @@
import fj.data.Either;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.RelationshipTypeDefinition;
import org.openecomp.sdc.be.model.operations.impl.RelationshipTypeOperation;
@@ -39,11 +39,11 @@
protected ComponentsUtils componentsUtils;
public Either<Map<String, RelationshipTypeDefinition>, ResponseFormat> getAllRelationshipTypes() {
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> allRelationshipTypes =
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> allRelationshipTypes =
relationshipTypeOperation.getAllRelationshipTypes();
if (allRelationshipTypes.isRight()) {
- TitanOperationStatus operationStatus = allRelationshipTypes.right().value();
- if (TitanOperationStatus.NOT_FOUND == operationStatus) {
+ JanusGraphOperationStatus operationStatus = allRelationshipTypes.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) {
BeEcompErrorManager.getInstance().logInternalDataError("FetchRelationshipTypes", "Relationship types "
+ "are "
+ "not loaded",
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
index 18671f8..19dd0f4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
@@ -68,7 +68,7 @@
return commonImportManager.createElementTypesByDao(relationshipTypesToCreate, this::validateRelationshipType,
relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, relationshipType.getType()),
relationshipTypeName -> relationshipTypeOperation.getRelationshipTypeByName(relationshipTypeName)
- .right().map(DaoStatusConverter::convertTitanStatusToStorageStatus),
+ .right().map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus),
relationshipType -> relationshipTypeOperation.addRelationshipType(relationshipType, inTransaction),
(newRelationshipType, oldRelationshipType) -> relationshipTypeOperation
.updateRelationshipType(newRelationshipType, oldRelationshipType, inTransaction));
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java
index c07a9fc..c2d9c95 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.RequirementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
import org.slf4j.Logger;
@@ -120,15 +120,15 @@
result = requirementOperation.addRequirement(componentId, requirementsToReturn);
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(),
storedComponent.getComponentType()), ""));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(requirementsToReturn);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -222,15 +222,15 @@
result = requirementOperation.addRequirement(componentId, requirementsToReturn);
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(),
storedComponent.getComponentType()), ""));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(requirementsToReturn);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -263,7 +263,7 @@
Either<List<RequirementDefinition>, StorageOperationStatus> deleteRequirementEither
= deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete);
if (deleteRequirementEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value()));
}
requirementsToReturn.add(initiateNewRequirement(storedComponent, requirementDefinitionToUpdate));
@@ -300,7 +300,7 @@
Either<List<RequirementDefinition>, StorageOperationStatus> deleteRequirementEither
= deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete);
if (deleteRequirementEither.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value()));
}
}
@@ -392,17 +392,17 @@
Either<List<RequirementDefinition>, StorageOperationStatus> result
= deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete);
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error("Failed to delete requirement from component {}. Response is {}",
storedComponent.getName(), result.right().value());
return Either.right(componentsUtils.getResponseFormat(componentsUtils
.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType())));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(requirementDefinitionToDelete);
} catch (Exception e) {
LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "delete", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.REQUIREMENT_NOT_FOUND));
} finally {
if (lockResult.isLeft() && lockResult.left().value()) {
@@ -462,7 +462,7 @@
if (lockResult.isRight()) {
LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(),
lockResult.right().value().getFormattedMessage());
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(lockResult.right().value());
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 0968e15..1fa9051 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -75,7 +75,7 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum;
import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils;
import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter;
@@ -127,7 +127,7 @@
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
@@ -321,7 +321,7 @@
Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade
.validateComponentNameUniqueness(resourceName, resourceTypeEnum, ComponentTypeEnum.RESOURCE);
// DE242223
- titanDao.commit();
+ janusGraphDao.commit();
if (dataModelResponse.isLeft()) {
Map<String, Boolean> result = new HashMap<>();
@@ -487,7 +487,7 @@
throw e;
}
finally {
- titanDao.commit();
+ janusGraphDao.commit();
log.debug("unlock resource {}", lockedResourceId);
graphLockOperation.unlockComponent(lockedResourceId, NodeTypeEnum.Resource);
}
@@ -1420,7 +1420,7 @@
throw e;
} finally {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
if (shouldLock) {
graphLockOperation.unlockComponentByName(resource.getSystemName(), resource.getUniqueId(),
@@ -1431,7 +1431,7 @@
private void rollback(boolean inTransaction, Resource resource, List<ArtifactDefinition> createdArtifacts, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts) {
if(!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
if (isNotEmpty(createdArtifacts) && isNotEmpty(nodeTypesNewCreatedArtifacts)) {
createdArtifacts.addAll(nodeTypesNewCreatedArtifacts);
@@ -2181,13 +2181,13 @@
Map<String, List<ComponentInstanceInput>> instInputs = new HashMap<>();
log.debug("#createResourceInstancesRelations - Before get all datatypes. ");
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance",
"Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(
- DaoStatusConverter.convertTitanStatusToStorageStatus(status)), yamlName));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)), yamlName));
}
Resource finalResource = resource;
@@ -2369,7 +2369,7 @@
}
}
- private void processComponentInstance(String yamlName, Resource resource, List<ComponentInstance> componentInstancesList, Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes, Map<String, List<ComponentInstanceProperty>> instProperties, Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instRequirements, Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, Map<String, Map<String, ArtifactDefinition>> instArtifacts, Map<String, List<PropertyDefinition>> instAttributes, Map<String, Resource> originCompMap, Map<String, List<ComponentInstanceInput>> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) {
+ private void processComponentInstance(String yamlName, Resource resource, List<ComponentInstance> componentInstancesList, Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes, Map<String, List<ComponentInstanceProperty>> instProperties, Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instRequirements, Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, Map<String, Map<String, ArtifactDefinition>> instArtifacts, Map<String, List<PropertyDefinition>> instAttributes, Map<String, Resource> originCompMap, Map<String, List<ComponentInstanceInput>> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) {
Optional<ComponentInstance> currentCompInstanceOpt = componentInstancesList.stream()
.filter(i->i.getName().equals(uploadComponentInstanceInfo.getName()))
.findFirst();
@@ -2435,7 +2435,7 @@
return originResource;
}
- private void processComponentInstanceCapabilities(Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes, Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) {
+ private void processComponentInstanceCapabilities(Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes, Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) {
Map<String, List<CapabilityDefinition>> originCapabilities;
if (isNotEmpty(uploadComponentInstanceInfo.getCapabilities())) {
originCapabilities = new HashMap<>();
@@ -2449,7 +2449,7 @@
instCapabilties.put(currentCompInstance, originCapabilities);
}
- private void updateCapabilityPropertiesValues(Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes, Map<String, List<CapabilityDefinition>> originCapabilities, Map<String, Map<String, UploadPropInfo>> newPropertiesMap) {
+ private void updateCapabilityPropertiesValues(Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes, Map<String, List<CapabilityDefinition>> originCapabilities, Map<String, Map<String, UploadPropInfo>> newPropertiesMap) {
originCapabilities.values().stream()
.flatMap(Collection::stream)
.filter(c -> newPropertiesMap.containsKey(c.getName()))
@@ -3240,10 +3240,10 @@
if (result == null || result.isRight()) {
BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify");
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
@@ -3429,9 +3429,9 @@
} finally {
if (resourcePair == null) {
BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
if (needLock) {
log.debug("unlock resource {}", lockedResourceId);
@@ -3919,9 +3919,9 @@
} finally {
if (result == null || !result.equals(StorageOperationStatus.OK)) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
graphLockOperation.unlockComponent(resourceId, NodeTypeEnum.Resource);
}
@@ -3947,11 +3947,11 @@
} finally {
if (result == null || !result.equals(StorageOperationStatus.OK)) {
- titanDao.rollback();
+ janusGraphDao.rollback();
ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(result);
responseFormat = componentsUtils.getResponseFormatByResource(actionStatus, resourceName);
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
if (resource != null) {
@@ -3971,9 +3971,9 @@
} finally {
if (result == null || !result.equals(StorageOperationStatus.OK)) {
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
graphLockOperation.unlockComponent(resource.getUniqueId(), NodeTypeEnum.Resource);
}
@@ -4097,7 +4097,7 @@
}
finally {
if (!inTransaction) {
- titanDao.commit();
+ janusGraphDao.commit();
}
if (needToUnlock) {
graphLockOperation.unlockComponent(resourceIdToUpdate, NodeTypeEnum.Resource);
@@ -4643,7 +4643,7 @@
Either<List<CategoryDefinition>, ActionStatus> categories = elementDao
.getAllCategories(NodeTypeEnum.ResourceNewCategory, inTransaction);
if (categories.isRight()) {
- log.debug("failed to retrieve resource categories from Titan");
+ log.debug("failed to retrieve resource categories from JanusGraph");
responseFormat = componentsUtils.getResponseFormat(categories.right().value());
componentsUtils.auditResource(responseFormat, user, resource, actionEnum);
throw new ByActionStatusComponentException(categories.right().value());
@@ -4830,7 +4830,7 @@
if (deleteArtifactByInterface.isRight()) {
log.debug("Couldn't remove artifact definition with id {}", uniqueId);
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
return Either.right(deleteArtifactByInterface.right().value());
}
@@ -4852,7 +4852,7 @@
&& !findPropertiesOfNode.right().value().equals(StorageOperationStatus.OK)) {
log.debug("Failed to remove all properties of resource");
if (!inTransaction) {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(findPropertiesOfNode.right().value())));
@@ -4865,7 +4865,7 @@
if (inTransaction) {
return Either.left(true);
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(true);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
index cd9be0f..dbb421b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
@@ -46,7 +46,7 @@
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
index 6c41985..2c0af5f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
@@ -117,9 +117,9 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -236,14 +236,14 @@
}
Either<Service, StorageOperationStatus> result = toscaOperationFacade.updateDistributionStatus(service, user, newState);
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
BeEcompErrorManager.getInstance().logBeSystemError("ChangeServiceDistributionState");
log.debug("service {} is change destribuation status failed", service.getUniqueId());
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR, service.getVersion(), service.getName());
createAudit(user, auditAction, comment, service, responseFormat);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
}
- titanDao.commit();
+ janusGraphDao.commit();
Service updatedService = result.left().value();
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK);
log.debug(AUDIT_BEFORE_SENDING_RESPONSE);
@@ -322,10 +322,10 @@
operationList.add(operationEither.left().value());
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(operationList);
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
@@ -1013,7 +1013,7 @@
Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(serviceName, null, ComponentTypeEnum.SERVICE);
// DE242223
- titanDao.commit();
+ janusGraphDao.commit();
if (dataModelResponse.isLeft()) {
Map<String, Boolean> result = new HashMap<>();
@@ -1073,12 +1073,12 @@
try {
Either<Service, StorageOperationStatus> updateResponse = toscaOperationFacade.updateToscaElement(serviceToUpdate);
if (updateResponse.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
BeEcompErrorManager.getInstance().logBeSystemError("Update Service Metadata");
log.debug("failed to update sevice {}", serviceToUpdate.getUniqueId());
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(updateResponse.left().value());
} finally {
graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service);
@@ -1099,7 +1099,7 @@
if (lock) {
Either<Boolean, ResponseFormat> lockResult = lockComponent(service.getUniqueId(), service, "Delete Forwarding Path on Service");
if (lockResult.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils
.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
}
@@ -1108,15 +1108,15 @@
result = forwardingPathOperation.deleteForwardingPath(service ,pathIdsToDelete);
if (result.isRight()) {
log.debug(FAILED_TO_LOCK_SERVICE_RESPONSE_IS, service.getName(), result.right().value());
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE)));
}
- titanDao.commit();
+ janusGraphDao.commit();
log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, service.getSystemName());
} catch (Exception e){
log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
@@ -1214,7 +1214,7 @@
result = forwardingPathOperation.addForwardingPath(serviceId, forwardingPathDataDefinition);
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE),
""));
@@ -1225,12 +1225,12 @@
}
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
log.error("Exception occurred during add or update forwarding path property values: {}", e.getMessage(),
e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
}
- titanDao.commit();
+ janusGraphDao.commit();
} finally {
if (lockResult != null && lockResult.isLeft() && lockResult.left().value()) {
graphLockOperation.unlockComponent(storedService.getUniqueId(), NodeTypeEnum.Service);
@@ -1608,7 +1608,7 @@
log.debug("validating service category {} against valid categories list", list);
Either<List<CategoryDefinition>, ActionStatus> categorys = elementDao.getAllServiceCategories();
if (categorys.isRight()) {
- log.debug("failed to retrieve service categories from Titan");
+ log.debug("failed to retrieve service categories from JanusGraph");
ResponseFormat responseFormat = componentsUtils.getResponseFormat(categorys.right().value());
return Either.right(responseFormat);
}
@@ -1666,10 +1666,10 @@
if (result == null || !result.equals(StorageOperationStatus.OK)) {
log.warn("operation failed. do rollback");
BeEcompErrorManager.getInstance().logBeSystemError("Delete Service");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service);
}
@@ -1708,10 +1708,10 @@
if (result == null || !result.equals(StorageOperationStatus.OK)) {
log.warn("operation failed. do rollback");
BeEcompErrorManager.getInstance().logBeSystemError("Delete Service");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
}
@@ -2006,12 +2006,12 @@
try {
Either<Service, StorageOperationStatus> result = toscaOperationFacade.updateDistributionStatus(service, user, state);
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
BeEcompErrorManager.getInstance().logBeSystemError("updateDistributionStatusForActivation");
log.debug("service {} change distribution status failed", serviceId);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(result.left().value());
} finally {
graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service);
@@ -2688,7 +2688,7 @@
if (lock) {
Either<Boolean, ResponseFormat> lockResult = lockComponent(service.getUniqueId(), service, "Delete Service Filter from service");
if (lockResult.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils
.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
}
@@ -2697,15 +2697,15 @@
result = serviceFilterOperation.deleteNodeFilter(service , resourceId);
if (result.isRight()) {
log.debug("Failed to delete node filter in service {}. Response is {}. ", service.getName(), result.right().value());
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE)));
}
- titanDao.commit();
+ janusGraphDao.commit();
log.debug("Node filter successfully changed in service {} . ", service.getSystemName());
} catch (Exception e){
log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
} finally {
graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
@@ -2760,17 +2760,17 @@
try {
result = serviceFilterOperation.createNodeFilter(serviceId, componentInstanceId);
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE),
""));
} else {
serviceFilterResult = result.left().value();
}
- titanDao.commit();
+ janusGraphDao.commit();
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(),
e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
@@ -2832,17 +2832,17 @@
Either<CINodeFilterDataDefinition, StorageOperationStatus> result = serviceFilterOperation.updateProperties(serviceId, componentInstanceId, serviceFilter ,properties);
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE),
""));
} else {
serviceFilterResult = result.left().value();
}
- titanDao.commit();
+ janusGraphDao.commit();
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(),
e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
@@ -2926,17 +2926,17 @@
}
if (result.isRight()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return Either.right(componentsUtils.getResponseFormat(
componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE),
""));
} else {
serviceFilterResult = result.left().value();
}
- titanDao.commit();
+ janusGraphDao.commit();
} catch (Exception e) {
- titanDao.rollback();
+ janusGraphDao.rollback();
log.error("Exception occurred during add or update node filter property values: {}", e.getMessage(),
e);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
index 93d79a3..9346c41 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
@@ -10,7 +10,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java
index cc6e9e9..a85a9c7 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java
@@ -6,7 +6,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java
index 10a35d0..cb2fc5b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java
@@ -5,7 +5,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.PolicyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java
index 2d6f354..e51caab 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java
@@ -24,8 +24,8 @@
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -34,29 +34,29 @@
@Component
public class ExceptionUtils {
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
- public ExceptionUtils(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public ExceptionUtils(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
public <T> T rollBackAndThrow(ActionStatus actionStatus, String ... params) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByActionStatusComponentException(actionStatus, params);
}
public <T> T rollBackAndThrow(ResponseFormat responseFormat) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new ByResponseFormatComponentException(responseFormat);
}
public <T> T rollBackAndThrow(StorageOperationStatus status, String ... params) {
- titanDao.rollback();
+ janusGraphDao.rollback();
throw new StorageException(status, params);
}
- public <T> T rollBackAndThrow(TitanOperationStatus status, String ... params) {
- titanDao.rollback();
+ public <T> T rollBackAndThrow(JanusGraphOperationStatus status, String ... params) {
+ janusGraphDao.rollback();
throw new StorageException(status, params);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java
index e9289de..5826ef1 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java
@@ -25,16 +25,16 @@
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.tosca.ToscaUtils;
@@ -62,8 +62,8 @@
private ArtifactsBusinessLogic artifactsManager;
private NodeTemplateOperation nodeTemplateOperation;
- public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
this.name = name;
@@ -202,12 +202,12 @@
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState");
if ( !inTransaction ) {
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else {
if ( !inTransaction ) {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java
index 7456a58..a0e9bc8 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java
@@ -25,17 +25,17 @@
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -52,8 +52,8 @@
private ServiceBusinessLogic serviceBusinessLogic;
public CertificationRequestTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ServiceBusinessLogic serviceBusinessLogic,
- ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
// authorized roles
Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER };
@@ -193,12 +193,12 @@
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState");
if (!inTransaction) {
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else {
if (!inTransaction) {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java
index 89ed22f..f6cc7dc 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java
@@ -24,7 +24,7 @@
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -32,11 +32,11 @@
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -49,8 +49,8 @@
private static final Logger log = Logger.getLogger(CheckinTransition.class);
- public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
// authorized roles
Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER };
@@ -100,12 +100,12 @@
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState");
if (!inTransaction) {
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else {
if (!inTransaction) {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java
index 33b6250..d97c171 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java
@@ -24,18 +24,18 @@
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.tosca.ToscaUtils;
@@ -50,8 +50,8 @@
private static final Logger log = Logger.getLogger(CheckoutTransition.class);
- CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
// authorized roles
Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER };
@@ -131,12 +131,12 @@
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState");
if (!inTransaction) {
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else {
if (!inTransaction) {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java
index 0057f61..180b7f0 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -34,8 +34,8 @@
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -52,7 +52,7 @@
@Autowired
protected ToscaElementLifecycleOperation lifeCycleOperation;
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
protected ComponentsUtils componentUtils;
protected Map<ComponentTypeEnum, List<Role>> authorizedRoles;
@@ -60,7 +60,7 @@
ToscaOperationFacade toscaOperationFacade;
- protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
+ protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
this.configurationManager = ConfigurationManager.getConfigurationManager();
this.lifeCycleOperation = lifecycleOperation2;
@@ -68,7 +68,7 @@
this.authorizedRoles = new HashMap<>();
this.resourceAuthorizedRoles = new HashMap<>();
this.toscaOperationFacade = toscaOperationFacade;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
}
public abstract LifeCycleTransitionEnum getName();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
index 981f0bd..befca24 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
@@ -29,18 +29,18 @@
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -71,7 +71,7 @@
private ArtifactsBusinessLogic artifactsBusinessLogic;
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private CapabilityOperation capabilityOperation;
@@ -129,30 +129,37 @@
private void initStateOperations() {
stateTransitions = new HashMap<>();
- LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
stateTransitions.put(checkoutOp.getName().name(), checkoutOp);
- UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
undoCheckoutOp.setArtifactsBusinessLogic(artifactsBusinessLogic);
stateTransitions.put(undoCheckoutOp.getName().name(), undoCheckoutOp);
- LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
stateTransitions.put(checkinOp.getName().name(), checkinOp);
LifeCycleTransition certificationRequest = new CertificationRequestTransition(componentUtils, lifecycleOperation, serviceBusinessLogic, toscaOperationFacade,
- titanDao);
+ janusGraphDao);
stateTransitions.put(certificationRequest.getName().name(), certificationRequest);
- LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
stateTransitions.put(startCertification.getName().name(), startCertification);
- LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
stateTransitions.put(failCertification.getName().name(), failCertification);
- LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
stateTransitions.put(cancelCertification.getName().name(), cancelCertification);
- CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
successCertification.setArtifactsManager(artifactsBusinessLogic);
successCertification.setNodeTemplateOperation(nodeTemplateOperation);
stateTransitions.put(successCertification.getName().name(), successCertification);
@@ -534,9 +541,9 @@
log.info("unlock component {}", resource.getUniqueId());
if (!inTransaction) {
if (result.isLeft()) {
- titanDao.commit();
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
if (needLock) {
NodeTypeEnum nodeType = resource.getComponentType().getNodeType();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java
index fd3e24f..582b3fd 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java
@@ -24,17 +24,17 @@
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -47,8 +47,8 @@
private static final Logger log = Logger.getLogger(StartCertificationTransition.class);
- public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
// authorized roles
Role[] rsrcServiceStartCertificationRoles = { Role.ADMIN, Role.TESTER };
@@ -97,12 +97,12 @@
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState");
if (!inTransaction) {
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
} else {
if (!inTransaction) {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java
index c6429c7..ff4746d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java
@@ -25,17 +25,17 @@
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -48,8 +48,8 @@
private static final Logger log = Logger.getLogger(CheckoutTransition.class);
private ArtifactsBusinessLogic artifactsManager;
- public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) {
- super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao);
+ public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) {
+ super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao);
// authorized roles
Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER };
@@ -126,10 +126,10 @@
if (result == null || result.isRight()) {
BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState - Undo Checkout failed on graph");
log.debug("operation failed. do rollback");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
log.debug("operation success. do commit");
- titanDao.commit();
+ janusGraphDao.commit();
}
}
return result;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java
index 00e49dc..9e01fb9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java
@@ -7,7 +7,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java
index 1220ec4..eddff12 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java
index 1638aea..90b0ed4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java
@@ -7,7 +7,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.core.annotation.Order;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java
index a84360b..68ee15e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.springframework.core.annotation.Order;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java
index 802dc22..fd45f9c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java
@@ -6,7 +6,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.springframework.core.annotation.Order;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java
index 66e8dc4..84cb111 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.springframework.core.annotation.Order;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java
index 3cf4c0d..8580844 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java
@@ -5,7 +5,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.log.wrappers.Logger;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java
index 7863243..28a6623 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java
@@ -12,7 +12,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.core.annotation.Order;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java
index f6de767..6ed252d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java
@@ -3,7 +3,7 @@
import fj.data.Either;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java
index 13e8508..5e7d362 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.ForwardingPathUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java
index 037ab86..b04ee22 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.core.annotation.Order;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java
index c09fb91..4feef4b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.utils.ComponentUtilities;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
index 60e60b0..bc82888 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
@@ -12,7 +12,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInterface;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java
index 31b3207..e626028 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java
index 04c43b4..7eb5518 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.core.annotation.Order;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java
index dc037ab..0bcbaf0 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java
@@ -4,7 +4,7 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java
index 995eae7..de71798 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java
@@ -11,7 +11,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java
index 68a8333..bc6e030 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java
@@ -27,7 +27,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.List;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java
index e57317f..2f5698a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.core.annotation.Order;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
index df7b877..82bc0f4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
@@ -7,7 +7,7 @@
import java.util.Optional;
import java.util.stream.Collectors;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.DataTypeDefinition;
@@ -44,7 +44,7 @@
* @param newProp the new property to merge value into
*/
public void mergePropertyValue(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, List<String> getInputNamesToMerge) {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
LOGGER.debug("failed to fetch data types, skip merging of previous property values. status: {}", dataTypesEither.right().value());
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java
index 55cf75b..2dde63f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java
@@ -8,8 +8,8 @@
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java
index a099aad..8378729 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java
@@ -7,7 +7,7 @@
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
index d7b366e..fdcfd35 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
@@ -20,7 +20,7 @@
import org.openecomp.sdc.be.model.ComponentInstancePropInput;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
index 14ea930..2026e11 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
@@ -16,7 +16,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
index ae76dad..b1910ad 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
@@ -30,7 +30,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
index bdb79c7..9f43284 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
@@ -21,7 +21,7 @@
import org.apache.commons.lang.StringUtils;
import org.json.simple.JSONObject;
import org.openecomp.sdc.be.components.utils.PropertiesUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GetPolicyValueDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
@@ -466,10 +466,12 @@
Either<InputDefinition, ResponseFormat> prepareValueBeforeDelete(InputDefinition inputForDelete, PropertyDataDefinition inputValue, List<String> pathOfComponentInstances) {
Either<InputDefinition, ResponseFormat> deleteEither = prepareValueBeforeDelete(inputForDelete, inputValue);
- Either<String, TitanOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(),
+ Either<String, JanusGraphOperationStatus> findDefaultValue = propertyOperation
+ .findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(),
(String) inputValue.getDefaultValue());
if (findDefaultValue.isRight()) {
- deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value()))));
+ deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils
+ .convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findDefaultValue.right().value()))));
return deleteEither;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
index 1705910..9cf6ff9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
@@ -35,7 +35,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
index 2726f67..0c6f8a2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
@@ -15,7 +15,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
index 6bd09c1..362f80f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
@@ -13,7 +13,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java
index ef3ffb8..ffb4805 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java
@@ -6,13 +6,13 @@
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.Role;
@@ -31,7 +31,7 @@
private final ToscaOperationFacade toscaOperationFacade;
private final ComponentsUtils componentsUtils;
private final UpgradeOperation upgradeOperation;
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
private LifecycleChangeInfoWithAction changeInfo = new LifecycleChangeInfoWithAction("automated upgrade");
private static final List<String> UUID_PROPS_NAMES = Arrays.asList("depending_service_uuid", "providing_service_uuid");
@@ -41,14 +41,14 @@
private static final Logger LOGGER = Logger.getLogger(UpgradeBusinessLogic.class);
public UpgradeBusinessLogic(LifecycleBusinessLogic lifecycleBusinessLogic, ComponentInstanceBusinessLogic componentInstanceBusinessLogic, UserValidations userValidations, ToscaOperationFacade toscaOperationFacade, ComponentsUtils componentsUtils,
- UpgradeOperation upgradeOperation, TitanDao titanDao) {
+ UpgradeOperation upgradeOperation, JanusGraphDao janusGraphDao) {
this.lifecycleBusinessLogic = lifecycleBusinessLogic;
this.componentInstanceBusinessLogic = componentInstanceBusinessLogic;
this.userValidations = userValidations;
this.toscaOperationFacade = toscaOperationFacade;
this.componentsUtils = componentsUtils;
this.upgradeOperation = upgradeOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
}
@@ -113,7 +113,7 @@
.map(rf -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(rf)));
} finally {
// all operation were read only. no commit needed
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java
index 9dbf012..bdd7f65 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java
@@ -32,7 +32,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.GroupDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
index 8d28088..c16927f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
@@ -20,7 +20,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.be.ui.model.UIConstraint;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java
index 9475159..b42aa4c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java
@@ -6,7 +6,7 @@
import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -92,11 +92,11 @@
break;
}
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to validate property. Status is " + status, BeEcompErrorManager.ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status))));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status))));
}
type = property.getType();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java
index fa35b64..8611321 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java
@@ -12,7 +12,7 @@
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java
index 78bb5e6..c71c796 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java
@@ -30,7 +30,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java
index 3a823de..c943010 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.common.api.Constants;
@@ -118,7 +118,7 @@
audit.startLog(requestContext);
}
- writeToTitan(responseContext);
+ writeToJanusGraph(responseContext);
//write to Audit log in case it's valuable action
// (e.g. ignoring healthCheck and any other unlogged urls as in yaml
@@ -144,18 +144,18 @@
}
}
- private void writeToTitan(ContainerResponseContext responseContext) {
+ private void writeToJanusGraph(ContainerResponseContext responseContext) {
log.debug("Close transaction from filter");
- HealingTitanDao titanDao = getTitanDao();
- if (titanDao != null) {
+ HealingJanusGraphDao janusGraphDao = getJanusGraphDao();
+ if (janusGraphDao != null) {
int status = responseContext.getStatus();
if (status == Response.Status.OK.getStatusCode() ||
status == Response.Status.CREATED.getStatusCode() ||
status == Response.Status.NO_CONTENT.getStatusCode()) {
- titanDao.commit();
+ janusGraphDao.commit();
log.debug("Doing commit from filter");
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
log.debug("Doing rollback from filter");
}
}
@@ -202,12 +202,12 @@
return webApplicationContext.getBean(ComponentsUtils.class);
}
- private HealingTitanDao getTitanDao() {
+ private HealingJanusGraphDao getJanusGraphDao() {
ServletContext context = this.sr.getSession().getServletContext();
WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR);
WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context);
- return webApplicationContext.getBean(HealingTitanDao.class);
+ return webApplicationContext.getBean(HealingJanusGraphDao.class);
}
// Extracted for purpose of clear method name, for logback %M parameter
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java
index 31ba527..158cc2d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java
@@ -92,7 +92,7 @@
List<HealthCheckInfo> healthCheckInfos = new ArrayList<>();
HealthCheckBusinessLogic healthCheckBusinessLogic = getHealthCheckBL(servletContext);
- healthCheckBusinessLogic.getTitanHealthCheck(healthCheckInfos); // Titan
+ healthCheckBusinessLogic.getJanusGraphHealthCheck(healthCheckInfos); // JanusGraph
return healthCheckInfos;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
index 245eb59..8e06c02 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
@@ -31,8 +31,8 @@
import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.utils.ComponentUtilities;
import org.openecomp.sdc.be.tosca.ToscaUtils.SubstitutionEntry;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
index 7b40781..2f1357e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
@@ -40,8 +40,8 @@
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java
index d7adb54..ff69eaa 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java
@@ -3,7 +3,7 @@
import fj.data.Either;
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
@@ -44,7 +44,7 @@
}
private Map<String, DataTypeDefinition> getDataTypes() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.error("Failed to retrieve all data types {}", dataTypesEither.right().value());
throw new SdcResourceNotFoundException();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java
index 0ebdf0e..84b4193 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java
@@ -3,7 +3,7 @@
import fj.data.Either;
import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.*;
@@ -43,7 +43,7 @@
}
private Map<String, DataTypeDefinition> getDataTypes() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.error("Failed to retrieve all data types {}", dataTypesEither.right().value());
throw new SdcResourceNotFoundException();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
index e6e69bf..603da09 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
@@ -32,7 +32,7 @@
import org.onap.sdc.tosca.services.YamlUtil;
import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -41,8 +41,8 @@
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
import org.openecomp.sdc.be.model.tosca.converters.ToscaValueBaseConverter;
@@ -249,7 +249,7 @@
toscaNode.setInterface_types(proxyInterfaceTypes);
}
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value());
return Either.right(ToscaError.GENERAL_ERROR);
@@ -548,7 +548,7 @@
.collect(Collectors.toList());
toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes));
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to fetch all data types :", dataTypesEither.right().value());
return Either.right(ToscaError.GENERAL_ERROR);
@@ -1028,7 +1028,7 @@
String derivedFrom = ((Resource) origComponent).getToscaResourceName();
toscaNodeType.setDerived_from(derivedFrom);
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value());
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java
index 59dd8d0..32cb604 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java
@@ -20,13 +20,10 @@
package org.openecomp.sdc.be.tosca;
-import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
import java.lang.reflect.Field;
import java.util.*;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
index a332e64..62a5e8c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
@@ -8,7 +8,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter;
import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
index b7e4c53..a56607d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
@@ -57,7 +57,7 @@
@Resource
private ComponentsUtils componentsUtils;
@Autowired
- private TitanGenericDao titanDao;
+ private JanusGraphGenericDao janusGraphDao;
@Override
public Either<User, ActionStatus> getUser(String userId, boolean inTransaction) {
@@ -603,9 +603,9 @@
// commit will be perform outside!!!
if (result == null || result.isRight()) {
log.debug("getUserPendingTasksList failed to perform fetching");
- titanDao.rollback();
+ janusGraphDao.rollback();
} else {
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java
index ea04135..b964321 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java
@@ -34,6 +34,6 @@
<T> Either<T, TransactionCodeEnum> invokeGeneralDBAction(boolean isLastAction, DBTypeEnum dbType, IDBAction dbAction, IDBAction dbRollbackAction);
- <T> Either<T, TransactionCodeEnum> invokeTitanAction(boolean isLastAction, IDBAction dbAction);
+ <T> Either<T, TransactionCodeEnum> invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java
index fc7c905..60f89ce 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java
@@ -30,7 +30,7 @@
}
public enum DBTypeEnum {
- ELASTIC_SEARCH, TITAN, MYSTERY, SWIFT
+ ELASTIC_SEARCH, JANUSGRAPH, MYSTERY, SWIFT
}
public enum TransactionCodeEnum {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java
similarity index 72%
rename from catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java
rename to catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java
index c86241e..dad79b5 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java
@@ -20,25 +20,25 @@
package org.openecomp.sdc.common.transaction.impl;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.common.transaction.api.ICommitHandler;
import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum;
import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum;
-public class TitanCommitHandler implements ICommitHandler {
+public class JanusGraphCommitHandler implements ICommitHandler {
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public TitanCommitHandler(TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public JanusGraphCommitHandler(JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@Override
public DBActionCodeEnum doCommit() {
DBActionCodeEnum result = DBActionCodeEnum.SUCCESS;
- TitanOperationStatus titanStatus = titanGenericDao.commit();
- if (titanStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.commit();
+ if (janusGraphStatus != JanusGraphOperationStatus.OK) {
result = DBActionCodeEnum.FAIL_GENERAL;
}
return result;
@@ -46,7 +46,7 @@
@Override
public DBTypeEnum getDBType() {
- return DBTypeEnum.TITAN;
+ return DBTypeEnum.JANUSGRAPH;
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java
similarity index 72%
rename from catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java
rename to catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java
index 89d2b9d..ed2633f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java
@@ -20,23 +20,23 @@
package org.openecomp.sdc.common.transaction.impl;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.common.transaction.api.RollbackHandler;
import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum;
import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum;
-public class TitanRollbackHandler extends RollbackHandler {
+public class JanusGraphRollbackHandler extends RollbackHandler {
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public TitanRollbackHandler(Integer transactionId, String userId, String actionType, TitanGenericDao titanGenericDao) {
+ public JanusGraphRollbackHandler(Integer transactionId, String userId, String actionType, JanusGraphGenericDao janusGraphGenericDao) {
super(transactionId, userId, actionType);
- this.titanGenericDao = titanGenericDao;
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
public DBTypeEnum getDBType() {
- return DBTypeEnum.TITAN;
+ return DBTypeEnum.JANUSGRAPH;
}
protected boolean isRollbackForPersistenceData() {
@@ -45,8 +45,8 @@
public DBActionCodeEnum doNonPersistenceDataRollback() {
DBActionCodeEnum result = DBActionCodeEnum.SUCCESS;
- TitanOperationStatus titanStatus = titanGenericDao.rollback();
- if (titanStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.rollback();
+ if (janusGraphStatus != JanusGraphOperationStatus.OK) {
result = DBActionCodeEnum.FAIL_GENERAL;
}
return result;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java
index 9d95c26..7826448 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java
@@ -23,7 +23,7 @@
import com.google.common.collect.EvictingQueue;
import com.google.common.collect.Queues;
import org.openecomp.sdc.be.dao.impl.ESCatalogDAO;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.transaction.api.ITransactionSdnc;
import org.openecomp.sdc.common.transaction.api.TransactionUtils;
@@ -45,7 +45,7 @@
@Resource
private ESCatalogDAO esCatalogDao;
@Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
/**
* userId and actionType parameters are used only for logging purposes.
@@ -55,7 +55,8 @@
init();
}
log.debug("TransactionManager creating new SdncTransaction");
- ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao, titanGenericDao);
+ ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao,
+ janusGraphGenericDao);
transactions.add(tx);
return tx;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java
index 1c07e50..93a2c9d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java
@@ -23,15 +23,15 @@
import fj.data.Either;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.impl.ESCatalogDAO;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.transaction.api.*;
import org.openecomp.sdc.common.transaction.api.TransactionUtils.*;
import org.openecomp.sdc.common.transaction.impl.ESAction;
import org.openecomp.sdc.common.transaction.impl.ESRollbackHandler;
-import org.openecomp.sdc.common.transaction.impl.TitanCommitHandler;
-import org.openecomp.sdc.common.transaction.impl.TitanRollbackHandler;
+import org.openecomp.sdc.common.transaction.impl.JanusGraphCommitHandler;
+import org.openecomp.sdc.common.transaction.impl.JanusGraphRollbackHandler;
import org.openecomp.sdc.common.util.MethodActivationStatusEnum;
import java.util.ArrayList;
@@ -45,14 +45,14 @@
private RollbackManager rollbackManager;
private CommitManager commitManager;
private ESCatalogDAO esCatalogDao;
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
private Integer transactionId;
private TransactionStatusEnum status;
private String userId, actionType;
- TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, TitanGenericDao titanGenericDao) {
+ TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, JanusGraphGenericDao janusGraphGenericDao) {
this.esCatalogDao = esCatalogDao;
- this.titanGenericDao = titanGenericDao;
+ this.janusGraphGenericDao = janusGraphGenericDao;
this.transactionId = transactionId;
this.userId = userId;
actionType = actionTypeEnum.name();
@@ -64,13 +64,14 @@
private List<ICommitHandler> initCommitHandlers() {
List<ICommitHandler> commitHandlers = new ArrayList<>();
- commitHandlers.add(new TitanCommitHandler(titanGenericDao));
+ commitHandlers.add(new JanusGraphCommitHandler(janusGraphGenericDao));
return commitHandlers;
}
private List<RollbackHandler> initRollbackHandlers() {
List<RollbackHandler> rolebackHandlers = new ArrayList<>();
- rolebackHandlers.add(new TitanRollbackHandler(transactionId, userId, actionType, titanGenericDao));
+ rolebackHandlers.add(new JanusGraphRollbackHandler(transactionId, userId, actionType,
+ janusGraphGenericDao));
rolebackHandlers.add(new ESRollbackHandler(transactionId, userId, actionType));
return rolebackHandlers;
}
@@ -115,10 +116,10 @@
return result;
}
- public <T> Either<T, TransactionCodeEnum> invokeTitanAction(boolean isLastAction, IDBAction dbAction) {
+ public <T> Either<T, TransactionCodeEnum> invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction) {
Either<T, TransactionCodeEnum> result;
if (status == TransactionStatusEnum.OPEN) {
- result = invokeAction(isLastAction, dbAction, DBTypeEnum.TITAN);
+ result = invokeAction(isLastAction, dbAction, DBTypeEnum.JANUSGRAPH);
} else {
result = handleActionOnClosedTransaction();
}
diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml
index d23f87e..0e6e248 100644
--- a/catalog-be/src/main/resources/config/configuration.yaml
+++ b/catalog-be/src/main/resources/config/configuration.yaml
@@ -42,15 +42,15 @@
deleteLockTimeoutInSeconds: 60
maxDeleteComponents: 10
-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 Janus Graph 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
diff --git a/catalog-be/src/main/resources/config/titan.properties b/catalog-be/src/main/resources/config/janusgraph.properties
similarity index 100%
rename from catalog-be/src/main/resources/config/titan.properties
rename to catalog-be/src/main/resources/config/janusgraph.properties
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java b/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java
index ea66ec7..84d25a2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java
@@ -2,7 +2,7 @@
import org.openecomp.sdc.be.auditing.impl.AuditingManager;
import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import static org.mockito.Mockito.mock;
@@ -14,6 +14,6 @@
}
public static ExceptionUtils mockExceptionUtils() {
- return new ExceptionUtils(mock(TitanDao.class));
+ return new ExceptionUtils(mock(JanusGraphDao.class));
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
index 20f7f18..4ee63f7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
@@ -9,12 +9,11 @@
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResponseFormatManager;
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
-import org.openecomp.sdc.be.components.impl.ServiceBusinessLogicTest;
import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -23,8 +22,8 @@
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CacheMangerOperation;
@@ -62,7 +61,7 @@
AuditCassandraDao auditingDao = Mockito.mock(AuditCassandraDao.class);
ArtifactsBusinessLogic artifactBl = Mockito.mock(ArtifactsBusinessLogic.class);
GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class);
- TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class);
GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class);
@@ -138,7 +137,7 @@
bl.setUserAdmin(mockUserAdmin);
bl.setArtifactBl(artifactBl);
bl.setGraphLockOperation(graphLockOperation);
- bl.setTitanGenericDao(mockTitanDao);
+ bl.setJanusGraphGenericDao(mockJanusGraphDao);
bl.setToscaOperationFacade(toscaOperationFacade);
bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic);
bl.setComponentsUtils(componentsUtils);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java
index 822e764..000de2c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java
@@ -47,29 +47,29 @@
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertFalse("check false", statusChanged);
- HealthCheckInfo checkInfoTitanUp = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.UP, null, null);
- HealthCheckInfo checkInfoTitanDown = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.DOWN, null, null);
+ HealthCheckInfo checkInfoJanusGraphUp = new HealthCheckInfo(Constants.HC_COMPONENT_JANUSGRAPH, HealthCheckStatus.UP, null, null);
+ HealthCheckInfo checkInfoJanusGraphDown = new HealthCheckInfo(Constants.HC_COMPONENT_JANUSGRAPH, HealthCheckStatus.DOWN, null, null);
- checkInfosLeft.add(checkInfoTitanUp);
+ checkInfosLeft.add(checkInfoJanusGraphUp);
- checkInfosRight.add(checkInfoTitanUp);
+ checkInfosRight.add(checkInfoJanusGraphUp);
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertFalse("check false", statusChanged);
- checkInfosRight.remove(checkInfoTitanUp);
+ checkInfosRight.remove(checkInfoJanusGraphUp);
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertTrue("check true", statusChanged);
- checkInfosRight.add(checkInfoTitanDown);
+ checkInfosRight.add(checkInfoJanusGraphDown);
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertTrue("check true", statusChanged);
- checkInfosRight.remove(checkInfoTitanDown);
+ checkInfosRight.remove(checkInfoJanusGraphDown);
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertTrue("check true", statusChanged);
- checkInfosRight.add(checkInfoTitanUp);
+ checkInfosRight.add(checkInfoJanusGraphUp);
statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight);
assertFalse("check false", statusChanged);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
index 4f2bb78..971f7b8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
@@ -31,11 +31,11 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.IPropertyOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -81,7 +81,7 @@
@Mock
IGraphLockOperation graphLockOperation;
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@InjectMocks
private PropertyBusinessLogic bl = new PropertyBusinessLogic();
@@ -291,16 +291,16 @@
resource.setUniqueId(resourceId);
Field baseBusinessLogic3;
- baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao");
+ baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao");
baseBusinessLogic3.setAccessible(true);
- baseBusinessLogic3.set(bl, titanDao);
+ baseBusinessLogic3.set(bl, janusGraphDao);
Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
StorageOperationStatus lockResult = StorageOperationStatus.OK;
when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult);
- //doNothing().when(titanDao).commit();
+ //doNothing().when(janusGraphDao).commit();
Either<PropertyDefinition, ResponseFormat> result;
@@ -327,16 +327,16 @@
resource.setUniqueId(resourceId);
Field baseBusinessLogic3;
- baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao");
+ baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao");
baseBusinessLogic3.setAccessible(true);
- baseBusinessLogic3.set(bl, titanDao);
+ baseBusinessLogic3.set(bl, janusGraphDao);
Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
StorageOperationStatus lockResult = StorageOperationStatus.OK;
when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult);
- //doNothing().when(titanDao).commit();
+ //doNothing().when(janusGraphDao).commit();
Either<PropertyDefinition, ResponseFormat> result;
@@ -363,16 +363,16 @@
resource.setUniqueId(resourceId);
Field baseBusinessLogic3;
- baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao");
+ baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao");
baseBusinessLogic3.setAccessible(true);
- baseBusinessLogic3.set(bl, titanDao);
+ baseBusinessLogic3.set(bl, janusGraphDao);
Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
StorageOperationStatus lockResult = StorageOperationStatus.OK;
when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult);
- //doNothing().when(titanDao).commit();
+ //doNothing().when(janusGraphDao).commit();
Either<PropertyDefinition, ResponseFormat> result;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
index 2e91126..00e3f03 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
@@ -35,7 +35,7 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.tosca.constraints.GreaterOrEqualConstraint;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.user.UserBusinessLogic;
@@ -81,7 +81,7 @@
configurationManager = new ConfigurationManager(configurationSource);
Configuration configuration = new Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setJanusGraphInMemoryGraph(true);
configurationManager.setConfiguration(configuration);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
index 9dab8f4..28f97ad 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
@@ -23,7 +23,7 @@
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
index fdaedbb..c4b76a2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
@@ -59,7 +59,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
index 63018ee..7484ff0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
@@ -15,7 +15,7 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
index 83966be..5fa0747 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
@@ -104,14 +104,14 @@
}
@Test
- public void testGetTitanHealthCheck() throws Exception {
+ public void testGetJanusGraphHealthCheck() throws Exception {
HealthCheckBusinessLogic testSubject;
List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
List<HealthCheckInfo> result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanHealthCheck(healthCheckInfos);
+ result = testSubject.getJanusGraphHealthCheck(healthCheckInfos);
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
index a2f8b09..1cdd089 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
@@ -40,7 +40,7 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -48,7 +48,7 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IAdditionalInformationOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -77,7 +77,7 @@
@Mock
private ComponentsUtils componentsUtils;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private IAdditionalInformationOperation additionalInformationOperation;
@Mock
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java
index 8029e78..c4a3e59 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java
@@ -13,8 +13,8 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
index 0668134..6571863 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
@@ -41,16 +41,16 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.model.operations.api.*;
import org.openecomp.sdc.be.model.operations.impl.ArtifactOperation;
@@ -115,7 +115,7 @@
@Mock
private IGraphLockOperation graphLockOperation;
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@Mock
private IInterfaceLifecycleOperation interfaceLifecycleOperation;
@Mock
@@ -560,7 +560,7 @@
when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat());
artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME,
USER, INSTANCE_ID, true, false);
- verify(titanDao, times(1)).commit();
+ verify(janusGraphDao, times(1)).commit();
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
index 9b4482c..27e9f3f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
@@ -50,9 +50,9 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
@@ -78,10 +78,10 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations;
-import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation;
@@ -154,9 +154,9 @@
public ComponentsUtils componentsUtils;
@Mock
public ToscaOperationFacade toscaOperationFacade;
- TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@Mock
private UserBusinessLogic userBusinessLogic;
@Mock
@@ -238,7 +238,7 @@
when(toscaOperationFacade.validateCsarUuidUniqueness(Mockito.anyString())).thenReturn(StorageOperationStatus.OK);
Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<>();
when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
- when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
Either<Component, StorageOperationStatus> resourceStorageOperationStatusEither = Either
.right(StorageOperationStatus.BAD_REQUEST);
@@ -511,7 +511,7 @@
when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat());
artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD),
ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME, USER, INSTANCE_ID, true, false);
- verify(titanDao, times(1)).commit();
+ verify(janusGraphDao, times(1)).commit();
}
private ArtifactDefinition buildArtifactPayload() {
@@ -530,7 +530,7 @@
when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat());
artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD),
ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME, USER, INSTANCE_ID, true, false);
- verify(titanDao, times(1)).commit();
+ verify(janusGraphDao, times(1)).commit();
return artifactDefinition;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
index 88918de..55f4367 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
@@ -11,22 +11,19 @@
import org.junit.Test;
import org.mockito.Mockito;
import org.openecomp.sdc.be.components.validation.UserValidations;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
-import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.exception.ResponseFormat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyObject;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import fj.data.Either;
@@ -40,7 +37,7 @@
UserValidations userValidations = Mockito.mock(UserValidations.class);
ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class);
- TitanDao titanDao = Mockito.mock(TitanDao.class);
+ JanusGraphDao janusGraphDao = Mockito.mock(JanusGraphDao.class);
ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
PropertyOperation propertyOperation = Mockito.mock(PropertyOperation.class);
@@ -67,9 +64,9 @@
baseBusinessLogic2.setAccessible(true);
baseBusinessLogic2.set(attributeBusinessLogic, componentsUtils);
- baseBusinessLogic3 = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("titanDao");
+ baseBusinessLogic3 = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("janusGraphDao");
baseBusinessLogic3.setAccessible(true);
- baseBusinessLogic3.set(attributeBusinessLogic, titanDao);
+ baseBusinessLogic3.set(attributeBusinessLogic, janusGraphDao);
baseBusinessLogic = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("toscaOperationFacade");
baseBusinessLogic.setAccessible(true);
@@ -185,7 +182,7 @@
Map<String,DataTypeDefinition> data=new HashMap<>();
data.put("ONE",new DataTypeDefinition());
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = Either.left(data);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = Either.left(data);
when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
when(propertyOperation.isPropertyDefaultValueValid(anyObject(),anyObject())).thenReturn(true);
@@ -301,7 +298,7 @@
Map<String,DataTypeDefinition> data=new HashMap<>();
data.put("ONE",new DataTypeDefinition());
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = Either.left(data);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = Either.left(data);
when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
when(propertyOperation.isPropertyDefaultValueValid(anyObject(),anyObject())).thenReturn(true);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
index 55b87f4..b75d52c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
@@ -28,8 +28,8 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -45,8 +45,8 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.CapabilitiesOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.user.Role;
@@ -76,7 +76,7 @@
private final String componentId = "resourceId1";
private final String capabilityId = "uniqueId1";
- private final TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ private final JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
private final UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class);
private final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
private final UserValidations userValidations = Mockito.mock(UserValidations.class);
@@ -127,13 +127,13 @@
"0", "10"))));
when(capabilitiesOperation.deleteCapabilities( anyObject(), anyString()))
.thenReturn(StorageOperationStatus.OK);
- when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
capabilitiesBusinessLogicMock = new CapabilitiesBusinessLogic();
capabilitiesBusinessLogicMock.setComponentsUtils(componentsUtils);
capabilitiesBusinessLogicMock.setUserAdmin(mockUserAdmin);
capabilitiesBusinessLogicMock.setGraphLockOperation(graphLockOperation);
- capabilitiesBusinessLogicMock.setTitanGenericDao(mockTitanDao);
+ capabilitiesBusinessLogicMock.setJanusGraphGenericDao(mockJanusGraphDao);
capabilitiesBusinessLogicMock.setToscaOperationFacade(toscaOperationFacade);
capabilitiesBusinessLogicMock.setUserValidations(userValidations);
capabilitiesBusinessLogicMock.setCapabilitiesOperation(capabilitiesOperation);
@@ -178,7 +178,7 @@
}
@Test
- public void shouldFailCreateCapabilitiesWhenOperationFailedInTitan(){
+ public void shouldFailCreateCapabilitiesWhenOperationFailedInJanusGraph(){
List<CapabilityDefinition> capabilityDefinitions = createMockCapabilityListToReturn(
createCapability("capName2", "capDesc", "capType", "source1",
"0", "10"));
@@ -274,7 +274,7 @@
}
@Test
- public void shouldFailUpdateCapabilitiesWhenOperationFailedInTitan(){
+ public void shouldFailUpdateCapabilitiesWhenOperationFailedInJanusGraph(){
List<CapabilityDefinition> capabilityDefinitions = createMockCapabilityListToReturn(
createCapability("capName2", "capDesc", "capType", "source1",
"0", "10"));
@@ -312,7 +312,7 @@
}
@Test
- public void shouldFailDeleteCapabilitiesWhenOperationFailedInTitan(){
+ public void shouldFailDeleteCapabilitiesWhenOperationFailedInJanusGraph(){
Resource resource = createComponent(true);
resource.setComponentType(ComponentTypeEnum.RESOURCE);
validateUserRoles(Role.ADMIN, Role.DESIGNER);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
index 00c172e..66d7225 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
@@ -30,7 +30,7 @@
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -54,7 +54,7 @@
public class CapabilityTypeImportManagerTest {
private static final CapabilityTypeOperation capabilityTypeOperation = mock(CapabilityTypeOperation.class);
private static final ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
- private static final TitanGenericDao titanGenericDao = mock(TitanGenericDao.class);
+ private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class);
private static final PropertyOperation propertyOperation = mock(PropertyOperation.class);
private CommonImportManager commonImportManager = new CommonImportManager(componentsUtils, propertyOperation);
private CapabilityTypeImportManager manager = new CapabilityTypeImportManager(capabilityTypeOperation, commonImportManager);
@@ -69,7 +69,7 @@
});
- when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao);
+ when(propertyOperation.getJanusGraphGenericDao()).thenReturn(JANUS_GRAPH_GENERIC_DAO);
when(capabilityTypeOperation.getCapabilityType(Mockito.anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
index 15eeb31..3402a5b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
@@ -10,7 +10,7 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -34,7 +34,7 @@
@Mock
PropertyOperation propertyOperation;
@Mock
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Mock
private Function<Object, Either<ActionStatus, ResponseFormat>> validator;
@@ -51,7 +51,7 @@
public void startUp() {
commonImportManager = new CommonImportManager(componentsUtils, propertyOperation);
- when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao);
+ when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao);
}
@Test
@@ -71,7 +71,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
- verify(titanGenericDao).rollback();
+ verify(janusGraphGenericDao).rollback();
}
@Test
@@ -91,7 +91,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
- verify(titanGenericDao).rollback();
+ verify(janusGraphGenericDao).rollback();
}
@Test
@@ -114,7 +114,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
- verify(titanGenericDao).rollback();
+ verify(janusGraphGenericDao).rollback();
}
@Test
@@ -139,7 +139,7 @@
verify(elementAdder).apply(type1);
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
- verify(titanGenericDao).rollback();
+ verify(janusGraphGenericDao).rollback();
}
@@ -160,7 +160,7 @@
verify(elementAdder).apply(type1);
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
- verify(titanGenericDao).commit();
+ verify(janusGraphGenericDao).commit();
assertEquals(type1, result.left().value().get(0).getLeft());
assertEquals(true, result.left().value().get(0).getRight());
@@ -189,7 +189,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader).apply(type1_1, type1);
- verify(titanGenericDao).rollback();
+ verify(janusGraphGenericDao).rollback();
}
@Test
@@ -209,7 +209,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader).apply(type1_1, type1);
- verify(titanGenericDao).commit();
+ verify(janusGraphGenericDao).commit();
assertEquals(type1_1, result.left().value().get(0).getLeft());
assertEquals(true, result.left().value().get(0).getRight());
@@ -232,7 +232,7 @@
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader).apply(type1_1, type1);
- verify(titanGenericDao).commit();
+ verify(janusGraphGenericDao).commit();
assertEquals(type1_1, result.left().value().get(0).getLeft());
assertEquals(false, result.left().value().get(0).getRight());
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index 50bb276..ad5ddaf 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -46,9 +46,9 @@
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -74,16 +74,14 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.util.function.BiPredicate;
-
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
@@ -94,7 +92,6 @@
import static org.mockito.Mockito.when;
import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.when;
/**
* The test suite designed for test functionality of ComponentInstanceBusinessLogic class
@@ -143,7 +140,7 @@
@Mock
private UserValidations userValidations;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private ArtifactsBusinessLogic artifactBusinessLogic;
@Mock
@@ -716,8 +713,8 @@
// default test
testSubject = createTestSubject();
- TitanDao mock = Mockito.mock(TitanDao.class);
- testSubject.setTitanGenericDao(mock);
+ JanusGraphDao mock = Mockito.mock(JanusGraphDao.class);
+ testSubject.setJanusGraphGenericDao(mock);
result = testSubject.deleteComponentInstance(containerComponentParam, containerComponentId, componentInstanceId,
userId);
}
@@ -1203,7 +1200,7 @@
when(toscaOperationFacade.getToscaElement(containerComponentId)).thenReturn(leftServiceOp);
when(toscaOperationFacade.getToscaElement(eq(containerComponentId), any(ComponentParametersView.class)))
.thenReturn(leftServiceOp);
- when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
when(graphLockOperation.unlockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service)))
.thenReturn(StorageOperationStatus.OK);
when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service)))
@@ -1231,7 +1228,7 @@
when(toscaOperationFacade.getToscaElement(containerComponentId)).thenReturn(leftServiceOp);
when(toscaOperationFacade.getToscaElement(eq(containerComponentId), any(ComponentParametersView.class)))
.thenReturn(leftServiceOp);
- when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
when(graphLockOperation.unlockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service)))
.thenReturn(StorageOperationStatus.OK);
when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service)))
@@ -1460,7 +1457,7 @@
.thenReturn(result2);
when(toscaOperationFacade.getToscaElement(eq(service.getUniqueId()), any(ComponentParametersView.class)))
.thenReturn(cont);
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
result = componentInstanceBusinessLogic
.batchDeleteComponentInstance(containerComponentParam, containerComponentId,
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java
index 9219de1..d6b5920 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java
@@ -46,7 +46,7 @@
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.be.user.IUserBusinessLogic;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
index 5cf3ef3..f53d2f9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
@@ -4,14 +4,12 @@
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.*;
+
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyObject;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import org.mockito.Mockito;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
@@ -26,8 +24,8 @@
DataTypesService dataTypesService = new DataTypesService(componentsUtils);
Map<String, DataTypeDefinition> mapreturn = new HashMap<>();
- TitanOperationStatus titanOperationStatus = TitanOperationStatus.NOT_FOUND;
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes;
+ JanusGraphOperationStatus janusGraphOperationStatus = JanusGraphOperationStatus.NOT_FOUND;
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes;
@Before
public void setup() {
@@ -44,7 +42,7 @@
@Test
public void getAllDataTypes_failure() {
- allDataTypes = Either.right(titanOperationStatus);
+ allDataTypes = Either.right(janusGraphOperationStatus);
when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
Assert.assertEquals(true,dataTypesService.getAllDataTypes(applicationDataTypeCache).isRight());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java
index d445c9c..75355b9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java
@@ -13,12 +13,12 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
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.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition;
@@ -32,7 +32,7 @@
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.GroupingDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.ElementOperation;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -73,13 +73,13 @@
private Resource notDeletedResource = new Resource();
@Mock
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Mock
private ToscaOperationFacade toscaOperationFacade;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private UserValidations userValidations;
@@ -109,7 +109,7 @@
initServicesList();
initResourceslist();
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
}
private void initCategoriesList() {
@@ -158,9 +158,10 @@
public void testFetchElementsByCategoryName_filterDeleted() {
ArgumentCaptor<Map> criteriaCapture = ArgumentCaptor.forClass(Map.class);
- when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.ServiceNewCategory), criteriaCapture.capture(), eq(CategoryData.class)))
+ when(janusGraphGenericDao
+ .getByCriteria(eq(NodeTypeEnum.ServiceNewCategory), criteriaCapture.capture(), eq(CategoryData.class)))
.thenReturn(Either.left(categories));
- when(titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ServiceNewCategory),
+ when(janusGraphGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ServiceNewCategory),
CATEGORY_UNIQUE_ID, GraphEdgeLabels.CATEGORY, NodeTypeEnum.Service, ServiceMetadataData.class))
.thenReturn(Either.left(services));
when(toscaOperationFacade.getToscaElement(SERVICE_NOT_DELETED_ID, JsonParseFlagEnum.ParseMetadata))
@@ -185,7 +186,7 @@
@Test
public void testFetchResourcesBySubcategoryUid_filterDeleted() {
- when(titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceSubcategory),
+ when(janusGraphGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceSubcategory),
CATEGORY_UNIQUE_ID, GraphEdgeLabels.CATEGORY, NodeTypeEnum.Resource, ResourceMetadataData.class))
.thenReturn(Either.left(resources));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
index 6d30003..6f97621 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
@@ -39,7 +39,7 @@
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -50,7 +50,7 @@
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.user.Role;
@@ -78,7 +78,7 @@
private UserBusinessLogic userAdminManager;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private UserValidations userValidations;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
index 2ddfcb4..6024462 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
@@ -42,8 +42,8 @@
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -56,9 +56,9 @@
import org.openecomp.sdc.be.model.GroupInstanceProperty;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
@@ -109,7 +109,7 @@
@Mock
private PropertyOperation propertyOperation;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
PolicyTargetsUpdateHandler policyTargetsUpdateHandler;
@@ -125,7 +125,7 @@
List<GroupDefinition> groupDefinitions = new ArrayList<>();
GroupDefinition groupDefinition = new GroupDefinition();
groupDefinitions.add(groupDefinition);
- when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
result = test.createGroups(component, groupDefinitions, true);
Assert.assertTrue(result.isRight());
}
@@ -277,7 +277,7 @@
when(accessValidations.validateUserCanWorkOnComponent("compid", ComponentTypeEnum.SERVICE, "USR01", "DeleteGroup")).thenReturn(component);
when(groupsOperation.deleteGroups(anyObject(),anyList())).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
- when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
GroupDefinition Gdefinition = test.deleteGroup("compid", ComponentTypeEnum.SERVICE, "GRP.01",
"USR01");
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
index ffeb80e..9d7ca19 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
@@ -28,30 +28,21 @@
import static org.mockito.Mockito.when;
import fj.data.Either;
-import java.util.Arrays;
-import java.util.Optional;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.property.PropertyDeclarationOrchestrator;
import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -71,14 +62,22 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.be.user.IUserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
public class InputsBusinessLogicTest {
private static final String COMPONENT_INSTANCE_ID = "instanceId";
@@ -120,7 +119,7 @@
private PropertyOperation propertyOperation;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private DataTypeBusinessLogic dataTypeBusinessLogic;
@@ -251,7 +250,7 @@
when(propertyDeclarationOrchestrator.declarePropertiesToInputs(any(), any())).thenReturn(Either.left(
declaredPropertiesToInputs));
when(toscaOperationFacadeMock.addInputsToComponent(any(), any())).thenReturn(Either.left(declaredPropertiesToInputs));
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
when(graphLockOperation.lockComponent(any(), any())).thenReturn(StorageOperationStatus.OK);
when(graphLockOperation.unlockComponent(any(), any())).thenReturn(StorageOperationStatus.OK);
when(componentInstanceBusinessLogic.setInputConstraint(any())).thenReturn(Collections.emptyList());
@@ -456,7 +455,7 @@
// for createListInputsInGraph:
when(toscaOperationFacadeMock.addInputsToComponent(anyMap(), eq(COMPONENT_ID))).thenReturn(Either.left(Arrays.asList(listInput)));
// for rollback/commit:
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
// for unlock resource
when(graphLockOperation.unlockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
@@ -510,7 +509,7 @@
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacadeMock.addDataTypesToComponent(dataTypesMapCaptor.capture(), eq(COMPONENT_ID))).thenReturn(Either.left(new ArrayList<>()));
when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(applicationDataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
when(componentsUtilsMock.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)).thenReturn(new ResponseFormat());
Either<List<InputDefinition>, ResponseFormat> result =
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
index d5b1f06..42eca25 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
@@ -44,8 +44,8 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -57,9 +57,9 @@
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations;
-import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
@@ -89,7 +89,7 @@
@Mock
private IGraphLockOperation graphLockOperation;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private InterfaceLifecycleOperation interfaceLifecycleOperation;
@Mock
@@ -122,7 +122,7 @@
when(interfaceOperationValidation
.validateDeleteOperationContainsNoMappedOutput(any(), any(), any()))
.thenReturn(Either.left(true));
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
}
private List<InputDefinition> createInputsForResource() {
@@ -432,7 +432,7 @@
@Test
public void getInterfaceOperationTestFailOnException() {
- when(titanDao.commit()).thenThrow(new RuntimeException());
+ when(janusGraphDao.commit()).thenThrow(new RuntimeException());
Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
Collections.singletonList(operationId), user, true).isRight());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
index e55578c..d5abdab 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
@@ -51,8 +51,8 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -72,8 +72,8 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PolicyTypeOperation;
@@ -98,7 +98,7 @@
@Mock
private UserValidations userValidations;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private ApplicationDataTypeCache dataTypeCache;
@Mock
@@ -144,7 +144,7 @@
public void initBl() {
businessLogic.setComponentsUtils(componentsUtils);
businessLogic.setToscaOperationFacade(toscaOperationFacade);
- businessLogic.setTitanGenericDao(titanDao);
+ businessLogic.setJanusGraphGenericDao(janusGraphDao);
businessLogic.setUserValidations(userValidations);
businessLogic.setGraphLockOperation(graphLockOperation);
businessLogic.setPolicyTypeOperation(policyTypeOperation);
@@ -452,11 +452,11 @@
}
private void stubCommit() {
- when(titanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
}
private void stubRollback() {
- when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
}
private void stubUnlockAndCommit() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
index 04f0a58..3b9a43a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
@@ -45,7 +45,7 @@
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -55,7 +55,7 @@
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -73,7 +73,7 @@
private UserValidations userValidations;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private ToscaOperationFacade toscaOperationFacade;
@@ -90,7 +90,7 @@
@Before
public void setUp() throws Exception {
testInstance.setUserValidations(userValidations);
- testInstance.setTitanGenericDao(titanDao);
+ testInstance.setJanusGraphGenericDao(janusGraphDao);
testInstance.setToscaOperationFacade(toscaOperationFacade);
testInstance.setComponentsUtils(componentsUtils);
@@ -121,7 +121,7 @@
@After
public void tearDown() {
- verify(titanDao).commit();
+ verify(janusGraphDao).commit();
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java
index db74b2d..d9be411 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java
@@ -34,7 +34,7 @@
import org.openecomp.sdc.be.components.utils.PolicyTypeBuilder;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.PolicyTypeDefinition;
import org.openecomp.sdc.be.model.User;
@@ -63,7 +63,7 @@
@InjectMocks
private PolicyTypeBusinessLogic testInstance;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private PolicyTypeOperation policyTypeOperation;
@Mock
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java
index e8d7300..dd523b8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java
@@ -36,7 +36,7 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.components.validation.ValidationUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -48,7 +48,7 @@
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.GroupingDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -87,7 +87,7 @@
private ToscaOperationFacade toscaOperationFacade;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private ValidationUtils validationUtils;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
index 3cac5f5..da72650 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
@@ -28,8 +28,8 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -42,8 +42,8 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.RequirementOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.user.Role;
@@ -73,7 +73,7 @@
private final String componentId = "resourceId1";
private final String requirementId = "uniqueId1";
- private final TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ private final JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
private final UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class);
private final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
private final UserValidations userValidations = Mockito.mock(UserValidations.class);
@@ -124,14 +124,14 @@
"0", "10"))));
when(requirementOperation.deleteRequirements( anyObject(), anyString()))
.thenReturn(StorageOperationStatus.OK);
- when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
requirementsBusinessLogicMock = new RequirementBusinessLogic();
requirementsBusinessLogicMock.setComponentsUtils(componentsUtils);
requirementsBusinessLogicMock.setUserAdmin(mockUserAdmin);
requirementsBusinessLogicMock.setGraphLockOperation(graphLockOperation);
- requirementsBusinessLogicMock.setTitanGenericDao(mockTitanDao);
+ requirementsBusinessLogicMock.setJanusGraphGenericDao(mockJanusGraphDao);
requirementsBusinessLogicMock.setToscaOperationFacade(toscaOperationFacade);
requirementsBusinessLogicMock.setUserValidations(userValidations);
requirementsBusinessLogicMock.setRequirementOperation(requirementOperation);
@@ -265,7 +265,7 @@
}
@Test
- public void shouldFailUpdateRequirementWhenOperationFailedInTitan(){
+ public void shouldFailUpdateRequirementWhenOperationFailedInJanusGraph(){
List<RequirementDefinition> requirementDefinitions = createMockRequirementListToReturn(
createRequirement("reqName", "capType", "node", "source1",
"6", "11"));
@@ -287,7 +287,7 @@
@Test
- public void shouldFailDeleteRequirementWhenOperationFailedInTitan(){
+ public void shouldFailDeleteRequirementWhenOperationFailedInJanusGraph(){
Resource resource = createComponent(true);
resource.setComponentType(ComponentTypeEnum.RESOURCE);
validateUserRoles(Role.ADMIN, Role.DESIGNER);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
index 9b5387c..5844047 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
@@ -45,8 +45,8 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -62,10 +62,10 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation;
@@ -143,7 +143,7 @@
final ServletContext servletContext = Mockito.mock(ServletContext.class);
IElementOperation mockElementDao;
- TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class);
ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
NodeTypeOperation nodeTypeOperation = Mockito.mock(NodeTypeOperation.class);
@@ -242,7 +242,7 @@
when(toscaOperationFacade.createToscaComponent(any(Resource.class))).thenReturn(eitherCreate);
Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<>();
when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
- when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
// BL object
artifactManager.setNodeTemplateOperation(nodeTemplateOperation);
@@ -255,7 +255,7 @@
bl.setGraphLockOperation(graphLockOperation);
bl.setArtifactsManager(artifactManager);
bl.setPropertyOperation(propertyOperation);
- bl.setTitanGenericDao(mockTitanDao);
+ bl.setJanusGraphGenericDao(mockJanusGraphDao);
bl.setApplicationDataTypeCache(applicationDataTypeCache);
bl.setCacheManagerOperation(cacheManager);
bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
index e54ac69..67f7e2d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
@@ -31,7 +31,7 @@
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
index 5c53947..c8e3fd9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
@@ -37,14 +37,14 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CacheMangerOperation;
@@ -75,9 +75,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
public class ServiceBusinessLogicTest {
@@ -93,7 +91,7 @@
private AuditCassandraDao auditingDao = Mockito.mock(AuditCassandraDao.class);
private ArtifactsBusinessLogic artifactBl = Mockito.mock(ArtifactsBusinessLogic.class);
private GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class);
- private TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
+ private JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
private ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
private CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class);
private GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class);
@@ -168,7 +166,7 @@
bl.setUserAdmin(mockUserAdmin);
bl.setArtifactBl(artifactBl);
bl.setGraphLockOperation(graphLockOperation);
- bl.setTitanGenericDao(mockTitanDao);
+ bl.setJanusGraphGenericDao(mockJanusGraphDao);
bl.setToscaOperationFacade(toscaOperationFacade);
bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic);
bl.setComponentsUtils(componentsUtils);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java
index 6f23faa..a37feb9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java
@@ -11,7 +11,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.Arrays;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java
index 7cad89c..e12bfb4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java
@@ -20,7 +20,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.ArrayList;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java
index dbacd82..3819175 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java
@@ -17,7 +17,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.List;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java
index 82bf761..2723746 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java
@@ -36,7 +36,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.List;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java
index 151303f..347c952 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java
@@ -44,7 +44,7 @@
import org.openecomp.sdc.be.components.impl.AnnotationBusinessLogic;
import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic;
import org.openecomp.sdc.be.components.validation.AnnotationValidator;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations;
@@ -59,7 +59,7 @@
@Mock
private AnnotationValidator annotationValidator;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private User user;
@@ -103,7 +103,7 @@
AnnotationBusinessLogic annotationBusinessLogic = new AnnotationBusinessLogic(annotationTypeOperations,
annotationValidator);
- handler = new YamlTemplateParsingHandler(titanDao, groupTypeBusinessLogic, annotationBusinessLogic);
+ handler = new YamlTemplateParsingHandler(janusGraphDao, groupTypeBusinessLogic, annotationBusinessLogic);
stubGetGroupType();
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
index d85226d..f8401e8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
@@ -49,15 +49,18 @@
super.setup();
// checkout transition object
- certifyTransitionObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ certifyTransitionObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
certifyTransitionObj.setConfigurationManager(configurationManager);
certifyTransitionObj.setLifeCycleOperation(toscaElementLifecycleOperation);
- certificationCancelObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ certificationCancelObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
certificationCancelObj.setConfigurationManager(configurationManager);
certificationCancelObj.setLifeCycleOperation(toscaElementLifecycleOperation);
- certificationFailObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ certificationFailObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
certificationFailObj.setConfigurationManager(configurationManager);
certificationFailObj.setLifeCycleOperation(toscaElementLifecycleOperation);
@@ -74,7 +77,8 @@
User user = new User("cs0008", "Carlos", "Santana", "cs@sdc.com", "DESIGNER", null);
for (LifeCycleTransitionEnum value : LifeCycleTransitionEnum.values()) {
- new CertificationChangeTransition(value, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ new CertificationChangeTransition(value, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java
index 3a686e5..70833f4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java
@@ -33,8 +33,8 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CapabilityOperation;
import org.openecomp.sdc.be.tosca.ToscaExportHandler;
@@ -66,7 +66,8 @@
@Before
public void setup() {
super.setup();
- rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceBusinessLogic, toscaOperationFacade, titanDao);
+ rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceBusinessLogic, toscaOperationFacade,
+ janusGraphDao);
rfcObj.setConfigurationManager(configurationManager);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java
index 0f18de2..48b79ea 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java
@@ -26,14 +26,14 @@
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.impl.AuditingDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -48,7 +48,7 @@
private CertificationRequestTransition createTestSubject() {
return new CertificationRequestTransition(
new ComponentsUtils(new AuditingManager(new AuditingDao(), new AuditCassandraDao(), new TestConfigurationProvider())),
- new ToscaElementLifecycleOperation(), new ServiceBusinessLogic(), new ToscaOperationFacade(), new TitanDao(new TitanGraphClient()));
+ new ToscaElementLifecycleOperation(), new ServiceBusinessLogic(), new ToscaOperationFacade(), new JanusGraphDao(new JanusGraphClient()));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java
index d6bf92f..7e1310d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java
@@ -44,7 +44,8 @@
super.setup();
// checkout transition object
- checkinObj = new CheckinTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ checkinObj = new CheckinTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
checkinObj.setLifeCycleOperation(toscaElementLifecycleOperation);
checkinObj.setConfigurationManager(configurationManager);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java
index 4097f7a..8f5362a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java
@@ -48,7 +48,8 @@
super.setup();
// checkout transition object
- checkoutObj = new CheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ checkoutObj = new CheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
checkoutObj.setLifeCycleOperation(toscaElementLifecycleOperation);
checkoutObj.setConfigurationManager(configurationManager);
bl.setToscaOperationFacade(toscaOperationFacade);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
index 9cdeaec..e2432ce 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
@@ -31,18 +31,18 @@
import org.openecomp.sdc.be.components.impl.ResponseFormatManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.user.Role;
@@ -76,7 +76,7 @@
protected Service serviceResponse;
protected static ConfigurationManager configurationManager = null;
protected ResponseFormatManager responseManager = null;
- protected TitanDao titanDao = Mockito.mock(TitanDao.class);
+ protected JanusGraphDao janusGraphDao = Mockito.mock(JanusGraphDao.class);
protected ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
protected static ComponentsUtils componentsUtils;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java
index 3d3bb24..ac43c53 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java
@@ -43,7 +43,8 @@
super.setup();
// checkout transition object
- undoCheckoutObj = new UndoCheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ undoCheckoutObj = new UndoCheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade,
+ janusGraphDao);
undoCheckoutObj.setLifeCycleOperation(toscaElementLifecycleOperation);
undoCheckoutObj.setConfigurationManager(configurationManager);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java
index 89b82b9..5f1ddd2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java
@@ -14,7 +14,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.List;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
index ed554d2..2eb45df 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
@@ -13,7 +13,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import static org.junit.Assert.*;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java
index 26b0034..e8b2535 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java
@@ -19,7 +19,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import java.util.List;
import java.util.Map;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java
index b815251..ef20068 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java
@@ -18,7 +18,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import java.util.List;
import java.util.stream.Stream;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java
index e1d4d39..bbeae6d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import java.util.List;
import java.util.Map;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java
index 817aa5d..3506959 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java
@@ -17,7 +17,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import java.util.Arrays;
import java.util.List;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
index d4d79b9..19181c9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
@@ -10,7 +10,7 @@
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java
index af6b72e..65783fd 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java
@@ -21,7 +21,7 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java
index f94906b..8385ea8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java
@@ -21,7 +21,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import java.util.Collections;
import java.util.List;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java
index 69caa8e..5e4fb9e 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java
@@ -24,7 +24,7 @@
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.api.UserRoleEnum;
import org.openecomp.sdc.test.utils.InterfaceOperationTestUtils;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
index c9c9f66..38506e1 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
index c6e5bed..5d69a82 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java
index 1b6aa00..eef868d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java
@@ -18,7 +18,7 @@
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
index 65f8835..6f1725d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
@@ -9,7 +9,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation;
import javax.annotation.Resource;
import java.util.*;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
index 85e4cb2..2cefada 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
@@ -13,7 +13,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.api.UserRoleEnum;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java
index 5d5ccb0..228b821 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java
@@ -20,7 +20,7 @@
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.HashMap;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java
index 32edf3e..54fbdbc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java
@@ -14,7 +14,7 @@
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.Collections;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java
index 98cd89c..ee43f11 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java
@@ -12,7 +12,7 @@
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.Collections;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java
index ef87dba..b1585ff 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java
@@ -11,11 +11,11 @@
import org.openecomp.sdc.be.components.utils.GroupDefinitionBuilder;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
import org.openecomp.sdc.be.components.utils.ServiceBuilder;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -39,11 +39,11 @@
private ToscaOperationFacade toscaOperationFacade;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Before
public void startUp() {
- ExceptionUtils exceptionUtils = new ExceptionUtils(titanDao);
+ ExceptionUtils exceptionUtils = new ExceptionUtils(janusGraphDao);
mergeInstanceUtils = new MergeInstanceUtils(toscaOperationFacade, exceptionUtils);
}
@@ -121,7 +121,7 @@
when(toscaOperationFacade.getToscaElement("inst1Uid")).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
assertThatExceptionOfType(StorageException.class)
.isThrownBy(() -> mergeInstanceUtils.mapOldToNewCapabilitiesOwnerIds(container, oldVf, "inst1", emptyList()));
- verify(titanDao).rollback();
+ verify(janusGraphDao).rollback();
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
index 0af5915..095463b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
@@ -6,14 +6,14 @@
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
-import org.openecomp.sdc.be.components.path.beans.TitanGraphTestSetup;
+import org.openecomp.sdc.be.components.path.beans.JanusGraphTestSetup;
import org.openecomp.sdc.be.components.path.utils.GraphTestUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
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.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter;
@@ -48,7 +48,7 @@
private ForwardingPathDataDefinition forwardingPathDataDefinition;
@Autowired
- protected TitanGraphClient titanGraphClient;
+ protected JanusGraphClient janusGraphClient;
@Autowired
protected CapabilityRequirementConverter capabiltyRequirementConvertor;
@@ -66,11 +66,11 @@
protected ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
@javax.annotation.Resource
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Before
- public void initTitan() {
- TitanGraphTestSetup.createGraph(titanGraphClient.getGraph().left().value());
+ public void initJanusGraph() {
+ JanusGraphTestSetup.createGraph(janusGraphClient.getGraph().left().value());
categoryDefinition = new CategoryDefinition();
categoryDefinition.setName(CATEGORY_NAME);
}
@@ -105,12 +105,13 @@
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, "org.openecomp.resource.abstract.nodes.service");
- GraphTestUtils.createServiceVertex(titanDao, props);
+ GraphTestUtils.createServiceVertex(janusGraphDao, props);
- GraphVertex resourceVertex = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.PNF);
+ GraphVertex resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.PNF);
resourceVertex.setJsonMetadataField(JsonPresentationFields.VERSION, "0.1");
- Either<GraphVertex, TitanOperationStatus> vertexTitanOperationStatusEither = titanDao.updateVertex(resourceVertex);
- assertTrue(vertexTitanOperationStatusEither.isLeft());
+ Either<GraphVertex, JanusGraphOperationStatus> vertexJanusGraphOperationStatusEither = janusGraphDao
+ .updateVertex(resourceVertex);
+ assertTrue(vertexJanusGraphOperationStatusEither.isLeft());
}
private Service createTestService() {
@@ -153,7 +154,7 @@
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
- Either<GraphVertex, TitanOperationStatus> catRes = titanDao.createVertex(cat);
+ Either<GraphVertex, JanusGraphOperationStatus> catRes = janusGraphDao.createVertex(cat);
assertTrue(catRes.isLeft());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
index fd9e25f..eca9986 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
@@ -14,7 +14,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
index 09e1a72..3656caf 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
@@ -4,7 +4,7 @@
import org.openecomp.sdc.be.impl.ForwardingPathUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@org.springframework.stereotype.Component("tosca-operation-facade")
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java
new file mode 100644
index 0000000..10bd1ab
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java
@@ -0,0 +1,216 @@
+package org.openecomp.sdc.be.components.path.beans;
+
+
+import org.janusgraph.core.*;
+import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
+import org.janusgraph.core.util.JanusGraphCleanup;
+import org.janusgraph.diskstorage.BackendException;
+import org.janusgraph.diskstorage.ResourceUnavailableException;
+import org.janusgraph.diskstorage.locking.PermanentLockingException;
+import org.janusgraph.graphdb.database.idassigner.IDPoolExhaustedException;
+import fj.data.Either;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+@Component("janusgraph-client")
+public class InMemoryJanusGraphClient extends JanusGraphClient {
+
+
+ private static final Logger logger = LoggerFactory.getLogger(InMemoryJanusGraphClient.class);
+
+ private static final String OK = "GOOD";
+
+ public InMemoryJanusGraphClient() {
+ }
+
+
+ private JanusGraph graph;
+ JanusGraphClientStrategy janusGraphClientStrategy;
+
+ public InMemoryJanusGraphClient(JanusGraphClientStrategy janusGraphClientStrategy) {
+ super();
+ this.janusGraphClientStrategy = janusGraphClientStrategy;
+ logger.info("** JanusGraphClient created");
+ }
+
+ @PostConstruct
+ public JanusGraphOperationStatus createGraph() {
+
+ logger.info("** createGraph started **");
+ graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
+ createJanusGraphSchema();
+
+ logger.info("** in memory graph created");
+ return JanusGraphOperationStatus.OK;
+
+ }
+
+
+ public void cleanupGraph() {
+ if (graph != null) {
+ // graph.shutdown();
+ graph.close();
+ try {
+ JanusGraphFactory.drop(graph);
+ } catch (BackendException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public JanusGraphOperationStatus createGraph(String janusGraphCfgFile) {
+ logger.info("** open graph with {} started", janusGraphCfgFile);
+ try {
+ logger.info("openGraph : try to load file {}", janusGraphCfgFile);
+ graph = JanusGraphFactory.open(janusGraphCfgFile);
+ if (graph.isClosed()) {
+ logger.error("janusgraph graph was not initialized");
+ return JanusGraphOperationStatus.NOT_CREATED;
+ }
+
+ } catch (Exception e) {
+ this.graph = null;
+ logger.info("createGraph : failed to open JanusGraph graph with configuration file: {}", janusGraphCfgFile, e);
+ return JanusGraphOperationStatus.NOT_CONNECTED;
+ }
+
+ logger.info("** JanusGraph graph created ");
+
+ return JanusGraphOperationStatus.OK;
+ }
+
+
+ public Either<JanusGraph, JanusGraphOperationStatus> getGraph() {
+ if (graph != null) {
+ return Either.left(graph);
+ } else {
+ return Either.right(JanusGraphOperationStatus.NOT_CREATED);
+ }
+ }
+
+ public JanusGraphOperationStatus commit() {
+ if (graph != null) {
+ try {
+ graph.tx().commit();
+ return JanusGraphOperationStatus.OK;
+ } catch (Exception e) {
+ return handleJanusGraphException(e);
+ }
+ } else {
+ return JanusGraphOperationStatus.NOT_CREATED;
+ }
+ }
+
+ public JanusGraphOperationStatus rollback() {
+ if (graph != null) {
+ try {
+ // graph.rollback();
+ graph.tx().rollback();
+ return JanusGraphOperationStatus.OK;
+ } catch (Exception e) {
+ return handleJanusGraphException(e);
+ }
+ } else {
+ return JanusGraphOperationStatus.NOT_CREATED;
+ }
+ }
+
+ public static JanusGraphOperationStatus handleJanusGraphException(Exception e) {
+ if (e instanceof JanusGraphConfigurationException) {
+ return JanusGraphOperationStatus.JANUSGRAPH_CONFIGURATION;
+ }
+ if (e instanceof SchemaViolationException) {
+ return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION;
+ }
+ if (e instanceof PermanentLockingException) {
+ return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION;
+ }
+ if (e instanceof IDPoolExhaustedException) {
+ return JanusGraphOperationStatus.GENERAL_ERROR;
+ }
+ if (e instanceof InvalidElementException) {
+ return JanusGraphOperationStatus.INVALID_ELEMENT;
+ }
+ if (e instanceof InvalidIDException) {
+ return JanusGraphOperationStatus.INVALID_ID;
+ }
+ if (e instanceof QueryException) {
+ return JanusGraphOperationStatus.INVALID_QUERY;
+ }
+ if (e instanceof ResourceUnavailableException) {
+ return JanusGraphOperationStatus.RESOURCE_UNAVAILABLE;
+ }
+ if (e instanceof IllegalArgumentException) {
+ // TODO check the error message??
+ return JanusGraphOperationStatus.ILLEGAL_ARGUMENT;
+ }
+
+ return JanusGraphOperationStatus.GENERAL_ERROR;
+ }
+
+ public boolean getHealth() {
+ return true;
+ }
+
+ private boolean isGraphOpen() {
+ return true;
+ }
+
+
+ private static final String JANUSGRAPH_HEALTH_CHECK_STR = "janusGraphHealthCheck";
+
+
+ private void createJanusGraphSchema() {
+
+ JanusGraphManagement graphMgt = graph.openManagement();
+ JanusGraphIndex index = null;
+ for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
+ PropertyKey propKey = null;
+ if (!graphMgt.containsPropertyKey(prop.getProperty())) {
+ Class<?> clazz = prop.getClazz();
+ if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) {
+ propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
+ }
+ } else {
+ propKey = graphMgt.getPropertyKey(prop.getProperty());
+ }
+ if (prop.isIndexed()) {
+ if (!graphMgt.containsGraphIndex(prop.getProperty())) {
+ if (prop.isUnique()) {
+ index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
+
+ graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures
+ // only
+ // one
+ // name
+ // per
+ // vertex
+ graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures
+ // name
+ // uniqueness
+ // in
+ // the
+ // graph
+
+ } else {
+ graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
+ }
+ }
+ }
+ }
+ graphMgt.commit();
+ }
+
+}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java
deleted file mode 100644
index 96899b4..0000000
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package org.openecomp.sdc.be.components.path.beans;
-
-
-import com.thinkaurelius.titan.core.*;
-import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
-import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
-import com.thinkaurelius.titan.core.util.TitanCleanup;
-import com.thinkaurelius.titan.diskstorage.ResourceUnavailableException;
-import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException;
-import com.thinkaurelius.titan.graphdb.database.idassigner.IDPoolExhaustedException;
-import fj.data.Either;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
-import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-@Component("titan-client")
-public class InMemoryTitanGraphClient extends TitanGraphClient {
-
-
- private static final Logger logger = LoggerFactory.getLogger(InMemoryTitanGraphClient.class);
-
- private static final String OK = "GOOD";
-
- public InMemoryTitanGraphClient() {
- }
-
-
- private TitanGraph graph;
- TitanClientStrategy titanClientStrategy;
-
- public InMemoryTitanGraphClient(TitanClientStrategy titanClientStrategy) {
- super();
- this.titanClientStrategy = titanClientStrategy;
- logger.info("** TitanGraphClient created");
- }
-
- @PostConstruct
- public TitanOperationStatus createGraph() {
-
- logger.info("** createGraph started **");
- graph = TitanFactory.build().set("storage.backend", "inmemory").open();
- createTitanSchema();
-
- logger.info("** in memory graph created");
- return TitanOperationStatus.OK;
-
- }
-
-
- public void cleanupGraph() {
- if (graph != null) {
- // graph.shutdown();
- graph.close();
- TitanCleanup.clear(graph);
- }
- }
-
- public TitanOperationStatus createGraph(String titanCfgFile) {
- logger.info("** open graph with {} started", titanCfgFile);
- try {
- logger.info("openGraph : try to load file {}", titanCfgFile);
- graph = TitanFactory.open(titanCfgFile);
- if (graph.isClosed()) {
- logger.error("titan graph was not initialized");
- return TitanOperationStatus.NOT_CREATED;
- }
-
- } catch (Exception e) {
- this.graph = null;
- logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile, e);
- return TitanOperationStatus.NOT_CONNECTED;
- }
-
- logger.info("** Titan graph created ");
-
- return TitanOperationStatus.OK;
- }
-
-
- public Either<TitanGraph, TitanOperationStatus> getGraph() {
- if (graph != null) {
- return Either.left(graph);
- } else {
- return Either.right(TitanOperationStatus.NOT_CREATED);
- }
- }
-
- public TitanOperationStatus commit() {
- if (graph != null) {
- try {
- graph.tx().commit();
- return TitanOperationStatus.OK;
- } catch (Exception e) {
- return handleTitanException(e);
- }
- } else {
- return TitanOperationStatus.NOT_CREATED;
- }
- }
-
- public TitanOperationStatus rollback() {
- if (graph != null) {
- try {
- // graph.rollback();
- graph.tx().rollback();
- return TitanOperationStatus.OK;
- } catch (Exception e) {
- return handleTitanException(e);
- }
- } else {
- return TitanOperationStatus.NOT_CREATED;
- }
- }
-
- public static TitanOperationStatus handleTitanException(Exception e) {
- if (e instanceof TitanConfigurationException) {
- return TitanOperationStatus.TITAN_CONFIGURATION;
- }
- if (e instanceof SchemaViolationException) {
- return TitanOperationStatus.TITAN_SCHEMA_VIOLATION;
- }
- if (e instanceof PermanentLockingException) {
- return TitanOperationStatus.TITAN_SCHEMA_VIOLATION;
- }
- if (e instanceof IDPoolExhaustedException) {
- return TitanOperationStatus.GENERAL_ERROR;
- }
- if (e instanceof InvalidElementException) {
- return TitanOperationStatus.INVALID_ELEMENT;
- }
- if (e instanceof InvalidIDException) {
- return TitanOperationStatus.INVALID_ID;
- }
- if (e instanceof QueryException) {
- return TitanOperationStatus.INVALID_QUERY;
- }
- if (e instanceof ResourceUnavailableException) {
- return TitanOperationStatus.RESOURCE_UNAVAILABLE;
- }
- if (e instanceof IllegalArgumentException) {
- // TODO check the error message??
- return TitanOperationStatus.ILLEGAL_ARGUMENT;
- }
-
- return TitanOperationStatus.GENERAL_ERROR;
- }
-
- public boolean getHealth() {
- return true;
- }
-
- private boolean isGraphOpen() {
- return true;
- }
-
-
- private static final String TITAN_HEALTH_CHECK_STR = "titanHealthCheck";
-
-
- private void createTitanSchema() {
-
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
- for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
- PropertyKey propKey = null;
- if (!graphMgt.containsPropertyKey(prop.getProperty())) {
- Class<?> clazz = prop.getClazz();
- if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) {
- propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
- }
- } else {
- propKey = graphMgt.getPropertyKey(prop.getProperty());
- }
- if (prop.isIndexed()) {
- if (!graphMgt.containsGraphIndex(prop.getProperty())) {
- if (prop.isUnique()) {
- index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
-
- graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures
- // only
- // one
- // name
- // per
- // vertex
- graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures
- // name
- // uniqueness
- // in
- // the
- // graph
-
- } else {
- graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
- }
- }
- }
- }
- graphMgt.commit();
- }
-
-}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java
similarity index 88%
rename from catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java
rename to catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java
index 7a7eff8..0a11c45 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java
@@ -1,11 +1,11 @@
package org.openecomp.sdc.be.components.path.beans;
-import com.thinkaurelius.titan.core.PropertyKey;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
-import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
-import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
+import org.janusgraph.core.PropertyKey;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphQuery;
+import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
@@ -25,24 +25,24 @@
import java.util.HashMap;
import java.util.Map;
-public class TitanGraphTestSetup {
+public class JanusGraphTestSetup {
- private static final Logger logger = LoggerFactory.getLogger(TitanGraphTestSetup.class);
+ private static final Logger logger = LoggerFactory.getLogger(JanusGraphTestSetup.class);
- private static TitanGraph graph;
+ private static JanusGraph graph;
- public static boolean createGraph( TitanGraph graph) {
- TitanGraphTestSetup.graph = graph;
+ public static boolean createGraph( JanusGraph graph) {
+ JanusGraphTestSetup.graph = graph;
createIndexesAndDefaults();
- logger.info("** Titan graph created ");
+ logger.info("** JanusGraph graph created ");
return true;
}
private static boolean isVertexExist(Map<String, Object> properties) {
- TitanGraphQuery query = graph.query();
+ JanusGraphQuery query = graph.query();
if (properties != null && !properties.isEmpty()) {
for (Map.Entry<String, Object> entry : properties.entrySet()) {
@@ -96,8 +96,8 @@
private static void createVertexIndixes() {
logger.info("** createVertexIndixes started");
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
+ JanusGraphManagement graphMgt = graph.openManagement();
+ JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
@@ -139,7 +139,7 @@
private static void createEdgeIndixes() {
logger.info("** createEdgeIndixes started");
- TitanManagement graphMgt = graph.openManagement();
+ JanusGraphManagement graphMgt = graph.openManagement();
for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java
index 78f4964..0ae1d8c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java
@@ -20,15 +20,15 @@
package org.openecomp.sdc.be.components.path.utils;
-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 org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -44,21 +44,21 @@
public final class GraphTestUtils {
- public static GraphVertex createRootCatalogVertex(TitanDao titanDao) {
+ public static GraphVertex createRootCatalogVertex(JanusGraphDao janusGraphDao) {
GraphVertex catalogRootVertex = new GraphVertex(VertexTypeEnum.CATALOG_ROOT);
catalogRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(catalogRootVertex)
+ return janusGraphDao.createVertex(catalogRootVertex)
.either(v -> v, s -> null);
}
- public static GraphVertex createRootArchiveVertex(TitanDao titanDao) {
+ public static GraphVertex createRootArchiveVertex(JanusGraphDao janusGraphDao) {
GraphVertex archiveRootVertex = new GraphVertex(VertexTypeEnum.ARCHIVE_ROOT);
archiveRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(archiveRootVertex)
+ return janusGraphDao.createVertex(archiveRootVertex)
.either(v -> v, s -> null);
}
- public static GraphVertex createResourceVertex(TitanDao titanDao, Map<GraphPropertyEnum,Object> metadataProps, ResourceTypeEnum type) {
+ public static GraphVertex createResourceVertex(JanusGraphDao janusGraphDao, Map<GraphPropertyEnum,Object> metadataProps, ResourceTypeEnum type) {
GraphVertex vertex = new GraphVertex();
if (type == ResourceTypeEnum.VF) {
vertex.setLabel(VertexTypeEnum.TOPOLOGY_TEMPLATE);
@@ -77,12 +77,12 @@
for (Map.Entry<GraphPropertyEnum, Object> prop : metadataProps.entrySet()) {
vertex.addMetadataProperty(prop.getKey(), prop.getValue());
}
- titanDao.createVertex(vertex);
- titanDao.commit();
+ janusGraphDao.createVertex(vertex);
+ janusGraphDao.commit();
return vertex;
}
- public static GraphVertex createServiceVertex(TitanDao titanDao, Map<GraphPropertyEnum, Object> metadataProps){
+ public static GraphVertex createServiceVertex(JanusGraphDao janusGraphDao, Map<GraphPropertyEnum, Object> metadataProps){
GraphVertex vertex = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
String uuid = UUID.randomUUID().toString();
@@ -95,27 +95,27 @@
for (Map.Entry<GraphPropertyEnum, Object> prop : metadataProps.entrySet()) {
vertex.addMetadataProperty(prop.getKey(), prop.getValue());
}
- titanDao.createVertex(vertex);
- titanDao.commit();
+ janusGraphDao.createVertex(vertex);
+ janusGraphDao.commit();
return vertex;
}
- public static void clearGraph(TitanDao titanDao) {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ public static void clearGraph(JanusGraphDao janusGraphDao) {
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanDao.commit();
+ janusGraphDao.commit();
}
- public static String exportGraphMl(TitanGraph graph, String outputDirectory) {
+ public static String exportGraphMl(JanusGraph graph, String outputDirectory) {
String result = null;
String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
try {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java
index c2bbb03..9c2752e 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java
@@ -11,7 +11,7 @@
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.LinkedList;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java
index 14a4a02..8ea89d2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java
@@ -53,7 +53,7 @@
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java
index bad7196..0f744c2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java
@@ -59,7 +59,7 @@
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java
index b432502..c9e32e7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java
@@ -50,7 +50,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java
index 11292dc..68889a3 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java
@@ -22,7 +22,7 @@
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@RunWith(MockitoJUnitRunner.class)
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java
index 586cc55..9577b53 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java
@@ -27,7 +27,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java
index f85388a..0f065b8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java
@@ -17,7 +17,7 @@
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java
index c44b907..e343202 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java
@@ -2,8 +2,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -21,7 +19,6 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic;
import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
@@ -30,7 +27,7 @@
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
public class ComponentInstancePropertyToPolicyDeclaratorTest {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java
index ea9095f..c23bb1c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java
@@ -34,7 +34,7 @@
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -53,8 +53,8 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.ServiceMetadataDefinition;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -106,7 +106,7 @@
private UpgradeOperation upgradeOperation;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@InjectMocks
private UpgradeBusinessLogic upgradeBusinessLogic;
@@ -116,7 +116,8 @@
MockitoAnnotations.initMocks(this);
upgradeBusinessLogic = new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic,
- userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, titanDao);
+ userValidations, toscaOperationFacade, componentsUtils, upgradeOperation,
+ janusGraphDao);
user = new User();
user.setRole(Role.ADMIN.name());
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
index 480c8cf..8815510 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
@@ -34,7 +34,7 @@
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.Annotation;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -71,7 +71,7 @@
public void setUp() throws Exception {
annotationValidator = new AnnotationValidator(propertyValidator, exceptionUtils, dataTypeCache, componentsUtils);
allData = Collections.emptyMap();
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> cacheResponse = Either.left(allData);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> cacheResponse = Either.left(allData);
Mockito.when(dataTypeCache.getAll()).thenReturn(cacheResponse);
annotationTypeProperties = Collections.emptyList();
propertyDataDefinitions = new ArrayList<>();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
index c3b5a6b..c6d7e56 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
@@ -33,7 +33,7 @@
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java
index dfc1b18..1ff159f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java
@@ -39,7 +39,7 @@
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
import org.openecomp.sdc.exception.ResponseFormat;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
index 95020b6..16df8f3 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
@@ -29,14 +29,14 @@
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.be.components.impl.ResponseFormatManager;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyConstraint;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -68,7 +68,7 @@
@Test
public void primitiveValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -84,7 +84,7 @@
@Test
public void primitiveValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -100,7 +100,7 @@
@Test
public void complexWithValidValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -116,7 +116,7 @@
@Test
public void complexWithValidValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -132,7 +132,7 @@
@Test
public void complexWithListWithPrimitiveValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -148,7 +148,7 @@
@Test
public void complexWithListWithPrimitiveValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -164,7 +164,7 @@
@Test
public void complexWithMapWithPrimitiveValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -180,7 +180,7 @@
@Test
public void complexWithMapWithPrimitiveValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -196,7 +196,7 @@
@Test
public void inputValidValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
InputDefinition inputDefinition = new InputDefinition();
@@ -216,7 +216,7 @@
@Test
public void inputValidValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
InputDefinition inputDefinition = new InputDefinition();
@@ -235,7 +235,7 @@
@Test
public void serviceConsumptionValidValueSuccessTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
@@ -251,7 +251,7 @@
}
@Test
public void serviceConsumptionValidValueFailTest() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
index 5a2b598..e011aab 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
@@ -35,16 +35,16 @@
import org.openecomp.sdc.be.components.path.utils.GraphTestUtils;
import org.openecomp.sdc.be.components.validation.AccessValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.dto.ExternalRefDTO;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -52,8 +52,8 @@
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.*;
-import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.impl.OperationUtils;
@@ -110,7 +110,7 @@
private static final ToscaOperationFacade toscaOperationFacadeMock = Mockito.mock(ToscaOperationFacade.class);
private static final AccessValidations accessValidationsMock = Mockito.mock(AccessValidations.class);
private static final ComponentLocker componentLocker = Mockito.mock(ComponentLocker.class);
- private static final HealingTitanGenericDao titanGenericDao = Mockito.mock(HealingTitanGenericDao.class);
+ private static final HealingJanusGraphGenericDao janusGraphGenericDao = Mockito.mock(HealingJanusGraphGenericDao.class);
private static final ICacheMangerOperation cacheManagerOperation = Mockito.mock(ICacheMangerOperation.class);
private static final IGraphLockOperation graphLockOperation = Mockito.mock(IGraphLockOperation.class);
@@ -136,7 +136,7 @@
private GraphVertex serviceVertex;
private GraphVertex resourceVertex;
private ExternalReferencesOperation externalReferenceOperation;
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private OperationUtils operationUtils;
@Bean
@@ -145,7 +145,7 @@
}
@Bean
- OperationUtils operationUtils() {return new OperationUtils(titanDao());}
+ OperationUtils operationUtils() {return new OperationUtils(janusGraphDao());}
@Bean
ComponentExceptionMapper componentExceptionMapper() {
@@ -174,9 +174,9 @@
@Bean
ExternalReferencesOperation externalReferencesOperation() {
- this.externalReferenceOperation = new ExternalReferencesOperation(titanDao(), nodeTypeOpertaion(), topologyTemplateOperation(), idMapper());
+ this.externalReferenceOperation = new ExternalReferencesOperation(janusGraphDao(), nodeTypeOpertaion(), topologyTemplateOperation(), idMapper());
this.externalReferenceOperation.setHealingPipelineDao(healingPipelineDao());
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
return this.externalReferenceOperation;
}
@@ -202,7 +202,7 @@
@Bean
ArchiveOperation archiveOperation() {
- return new ArchiveOperation(titanDao(), graphLockOperation());
+ return new ArchiveOperation(janusGraphDao(), graphLockOperation());
}
@Bean
@@ -231,19 +231,19 @@
}
@Bean
- HealingTitanDao titanDao() {
- this.titanDao = new HealingTitanDao(titanGraphClient());
- return titanDao;
+ HealingJanusGraphDao janusGraphDao() {
+ this.janusGraphDao = new HealingJanusGraphDao(janusGraphClient());
+ return janusGraphDao;
}
@Bean
- TitanGraphClient titanGraphClient() {
- return new TitanGraphClient(titanClientStrategy());
+ JanusGraphClient janusGraphClient() {
+ return new JanusGraphClient(janusGraphClientStrategy());
}
@Bean
- TitanClientStrategy titanClientStrategy() {
- return new DAOTitanStrategy();
+ JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
}
@Bean
@@ -257,8 +257,8 @@
}
@Bean
- TitanGenericDao titanGenericDao() {
- return titanGenericDao;
+ JanusGraphGenericDao janusGraphGenericDao() {
+ return janusGraphGenericDao;
}
@Bean("healingPipelineDao")
@@ -273,11 +273,11 @@
private void initGraphForTest() {
if (!setupDone) {
- resourceVertex = GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VF);
+ resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VF);
resourceVertexUuid = resourceVertex.getUniqueId();
//create a service and add ref
- serviceVertex = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
serviceVertexUuid = this.serviceVertex.getUniqueId();
//monitoring references
@@ -289,8 +289,8 @@
//workflow references
externalReferenceOperation.addExternalReference(serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE, REF_6);
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
}
}
@@ -353,7 +353,7 @@
ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setJanusGraphInMemoryGraph(true);
configurationManager.setConfiguration(configuration);
ExternalConfiguration.setAppName("catalog-be");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
index f315ddf..2ad5225 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
@@ -53,17 +53,17 @@
import org.openecomp.sdc.be.components.validation.AccessValidations;
import org.openecomp.sdc.be.components.validation.ComponentValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -75,13 +75,13 @@
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
-import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.CategoryOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CategoryOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -121,14 +121,15 @@
private static final AccessValidations accessValidationsMock = mock(AccessValidations.class);
private static final ComponentValidations componentValidationsMock = mock(ComponentValidations.class);
private static final IGraphLockOperation graphLockOperation = mock(IGraphLockOperation.class);
- private static final HealingTitanGenericDao titanGenericDao = mock(HealingTitanGenericDao.class);
+ private static final HealingJanusGraphGenericDao
+ janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class);
private static final HealingPipelineDao HEALING_PIPELINE_DAO = mock(HealingPipelineDao.class);
private static final ICacheMangerOperation cacheManagerOperation = mock(ICacheMangerOperation.class);
private static GraphVertex serviceVertex;
private static GraphVertex resourceVertex;
private static GraphVertex resourceVertexVspArchived;
- private static HealingTitanDao titanDao;
+ private static HealingJanusGraphDao janusGraphDao;
@Configuration
@PropertySource("classpath:dao.properties")
@@ -158,13 +159,13 @@
@Bean
ArchiveBusinessLogic archiveBusinessLogic() {
- return new ArchiveBusinessLogic(titanDao(), accessValidations(), archiveOperation(), toscaOperationFacade(), componentUtils);
+ return new ArchiveBusinessLogic(janusGraphDao(), accessValidations(), archiveOperation(), toscaOperationFacade(), componentUtils);
}
@Bean
ArchiveOperation archiveOperation() {
- this.archiveOperation = new ArchiveOperation(titanDao(), graphLockOperation());
- GraphTestUtils.clearGraph(titanDao);
+ this.archiveOperation = new ArchiveOperation(janusGraphDao(), graphLockOperation());
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
return this.archiveOperation;
}
@@ -210,19 +211,19 @@
}
@Bean
- HealingTitanDao titanDao() {
- titanDao = new HealingTitanDao(titanGraphClient());
- return titanDao;
+ HealingJanusGraphDao janusGraphDao() {
+ janusGraphDao = new HealingJanusGraphDao(janusGraphClient());
+ return janusGraphDao;
}
@Bean
- TitanGraphClient titanGraphClient() {
- return new TitanGraphClient(titanClientStrategy());
+ JanusGraphClient janusGraphClient() {
+ return new JanusGraphClient(janusGraphClientStrategy());
}
@Bean
- TitanClientStrategy titanClientStrategy() {
- return new DAOTitanStrategy();
+ JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
}
@Bean
@@ -236,8 +237,8 @@
}
@Bean
- TitanGenericDao titanGenericDao() {
- return titanGenericDao;
+ JanusGraphGenericDao janusGraphGenericDao() {
+ return janusGraphGenericDao;
}
@Bean
@@ -247,31 +248,31 @@
private void initGraphForTest() {
//Create Catalog Root
- catalogVertex = GraphTestUtils.createRootCatalogVertex(titanDao);
+ catalogVertex = GraphTestUtils.createRootCatalogVertex(janusGraphDao);
//Create Archive Root
- GraphTestUtils.createRootArchiveVertex(titanDao);
+ GraphTestUtils.createRootArchiveVertex(janusGraphDao);
createSingleVersionServiceAndResource();
}
private void createSingleVersionServiceAndResource() {
//Create Service for Scenario 1 Tests (1 Service)
- serviceVertex = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
Map<GraphPropertyEnum, Object> props = propsForHighestVersion();
props.put(GraphPropertyEnum.IS_VSP_ARCHIVED, false);
props.put(GraphPropertyEnum.CSAR_UUID, CSAR_UUID1);
- resourceVertex = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.VF);
+ resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.VF);
props = propsForHighestVersion();
props.put(GraphPropertyEnum.IS_VSP_ARCHIVED, true);
props.put(GraphPropertyEnum.CSAR_UUID, CSAR_UUID2);
- resourceVertexVspArchived = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.VF);
+ resourceVertexVspArchived = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.VF);
//Connect Service/Resource to Catalog Root
- titanDao.createEdge(catalogVertex, serviceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
- titanDao.createEdge(catalogVertex, resourceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao.createEdge(catalogVertex, serviceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao.createEdge(catalogVertex, resourceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
private Map<GraphPropertyEnum, Object> propsForHighestVersion(){
@@ -328,7 +329,7 @@
ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setJanusGraphInMemoryGraph(true);
configurationManager.setConfiguration(configuration);
ExternalConfiguration.setAppName("catalog-be");
@@ -412,16 +413,16 @@
}
private void checkoutComponent(GraphVertex component) {
- Either<GraphVertex, TitanOperationStatus> vE = titanDao.getVertexById(component.getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> vE = janusGraphDao.getVertexById(component.getUniqueId());
GraphVertex v = vE.left().value();
v.addMetadataProperty(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
v.setJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
- titanDao.updateVertex(v);
- titanDao.commit();
+ janusGraphDao.updateVertex(v);
+ janusGraphDao.commit();
}
private void assertOnVertexProp(String componentId, Object expectedValue) {
- Either<GraphVertex, TitanOperationStatus> vE = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vE = janusGraphDao.getVertexById(componentId);
GraphVertex v = vE.left().value();
assertThat(v.getMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED)).isEqualTo(expectedValue);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
index 2a959ec..60fb579 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
@@ -19,13 +19,13 @@
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
@@ -71,7 +71,7 @@
private static ToscaOperationFacade toscaOperationFacade;
private static ComponentsUtils componentsUtils;
private static UpgradeOperation upgradeOperation;
- private static TitanDao titanDao;
+ private static JanusGraphDao janusGraphDao;
private static User user;
private static Resource vfPrev;
@@ -96,7 +96,8 @@
@Bean
UpgradeBusinessLogic upgradeBusinessLogic() {
- return new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic, userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, titanDao);
+ return new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic, userValidations, toscaOperationFacade, componentsUtils, upgradeOperation,
+ janusGraphDao);
}
}
@@ -108,7 +109,7 @@
toscaOperationFacade = mock(ToscaOperationFacade.class);
componentsUtils = mock(ComponentsUtils.class);
upgradeOperation = mock(UpgradeOperation.class);
- titanDao = mock(TitanDao.class);
+ janusGraphDao = mock(JanusGraphDao.class);
user = mock(User.class);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java
index 38373bd..d9ae9cc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java
@@ -23,7 +23,7 @@
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GroupOperation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java
index 1af04ac..6acfd36 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java
@@ -15,8 +15,8 @@
import org.openecomp.sdc.be.components.utils.GroupTypeBuilder;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -47,7 +47,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
public class GroupTypesEndpointTest extends JerseySpringBaseTest {
@@ -57,10 +56,10 @@
private static final HashSet<String> EXCLUDED_TYPES = Sets.newHashSet("Root", "Heat");
private static ComponentsUtils componentsUtils;
- private static TitanGenericDao titanGenericDao;
+ private static JanusGraphGenericDao janusGraphGenericDao;
private static CapabilityTypeOperation capabilityTypeOperation;
private static DerivedFromOperation derivedFromOperation;
- private static TitanDao titanDao;
+ private static JanusGraphDao janusGraphDao;
private static PropertyOperation propertyOperation;
private static CapabilityOperation capabilityOperation;
private static UserValidations userValidations;
@@ -81,12 +80,12 @@
@Bean
GroupTypeBusinessLogic groupTypeBusinessLogic() {
- return new GroupTypeBusinessLogic(groupTypeOperation(), titanDao, userValidations, componentsUtils);
+ return new GroupTypeBusinessLogic(groupTypeOperation(), janusGraphDao, userValidations, componentsUtils);
}
@Bean
GroupTypeOperation groupTypeOperation() {
- return new GroupTypeOperation(titanGenericDao, propertyOperation, capabilityTypeOperation, capabilityOperation, derivedFromOperation, operationUtils);
+ return new GroupTypeOperation(janusGraphGenericDao, propertyOperation, capabilityTypeOperation, capabilityOperation, derivedFromOperation, operationUtils);
}
}
@@ -95,8 +94,8 @@
componentsUtils = mock(ComponentsUtils.class);
propertyOperation = mock(PropertyOperation.class);
capabilityTypeOperation = mock(CapabilityTypeOperation.class);
- titanDao = mock(TitanDao.class);
- titanGenericDao = mock(TitanGenericDao.class);
+ janusGraphDao = mock(JanusGraphDao.class);
+ janusGraphGenericDao = mock(JanusGraphGenericDao.class);
userValidations = mock(UserValidations.class);
operationUtils = mock(OperationUtils.class);
user = mock(User.class);
@@ -105,7 +104,7 @@
@Before
public void init() {
when(userValidations.validateUserExists(eq(USER_ID), anyString(), anyBoolean())).thenReturn(user);
- when(titanGenericDao.getByCriteriaWithPredicate(eq(NodeTypeEnum.GroupType), any(), eq(GroupTypeData.class))).thenReturn(Either.left(buildGroupTypeDataList()));
+ when(janusGraphGenericDao.getByCriteriaWithPredicate(eq(NodeTypeEnum.GroupType), any(), eq(GroupTypeData.class))).thenReturn(Either.left(buildGroupTypeDataList()));
}
@Override
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
index d542088..7ff94c7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
@@ -52,7 +52,7 @@
import org.openecomp.sdc.be.model.PolicyTargetDTO;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.common.api.Constants;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
index 5eecc77..4a9cdad 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
@@ -18,9 +18,8 @@
import org.mockito.Mockito;
import org.openecomp.sdc.be.components.impl.CommonImportManager;
import org.openecomp.sdc.be.components.validation.AccessValidations;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.AnnotationTypeDefinition;
@@ -56,7 +55,7 @@
static final String userId = "jh0003";
private static AccessValidations accessValidations;
- private static HealingTitanGenericDao titanGenericDao;
+ private static HealingJanusGraphGenericDao janusGraphGenericDao;
private static PropertyOperation propertyOperation;
private static ComponentsUtils componentUtils;
private static OperationUtils operationUtils;
@@ -82,13 +81,13 @@
@Bean
CommonTypeOperations commonTypeOperations() {
- return new CommonTypeOperations(titanGenericDao, propertyOperation, operationUtils);
+ return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils);
}
}
@BeforeClass
public static void initClass() {
- titanGenericDao = mock(HealingTitanGenericDao.class);
+ janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class);
accessValidations = mock(AccessValidations.class);
propertyOperation = mock(PropertyOperation.class);
componentUtils = Mockito.mock(ComponentsUtils.class);
@@ -113,14 +112,16 @@
@Test
public void creatingAnnotationTypeSuccessTest() {
doNothing().when(accessValidations).validateUserExists(eq(userId), anyString());
- when(titanGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
- when(titanGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
- when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
+ when(janusGraphGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
+ when(janusGraphGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenReturn(Either.left(emptyMap()));
- when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(TitanOperationStatus.OK);
- when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao);
- when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(
+ JanusGraphOperationStatus.OK);
+ when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao);
+ when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
FileDataBodyPart filePart = new FileDataBodyPart("annotationTypesZip", new File("src/test/resources/types/annotationTypes.zip"));
MultiPart multipartEntity = new FormDataMultiPart();
multipartEntity.bodyPart(filePart);
@@ -149,14 +150,17 @@
@Test
public void creatingAnnotationTypeFailureTest() {
doNothing().when(accessValidations).validateUserExists(eq(userId), anyString());
- when(titanGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
- when(titanGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
- when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
- when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenThrow(new StorageException(TitanOperationStatus.MATCH_NOT_FOUND));
- when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(TitanOperationStatus.OK);
- when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao);
- when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
+ when(janusGraphGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData()));
+ when(janusGraphGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
+ when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenThrow(new StorageException(
+ JanusGraphOperationStatus.MATCH_NOT_FOUND));
+ when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(
+ JanusGraphOperationStatus.OK);
+ when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao);
+ when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
FileDataBodyPart filePart = new FileDataBodyPart("annotationTypesZip", new File("src/test/resources/types/annotationTypes.zip"));
MultiPart multipartEntity = new FormDataMultiPart();
multipartEntity.bodyPart(filePart);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
index ff522e1..ec06c86 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
@@ -35,10 +35,12 @@
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.tosca.model.SubstitutionMapping;
import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
+import org.openecomp.sdc.be.tosca.model.ToscaTemplateCapability;
import fj.data.Either;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
index 8b1fe5f..5b84066 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
@@ -50,20 +50,17 @@
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
import org.openecomp.sdc.be.dao.cassandra.SdcSchemaFilesCassandraDao;
-import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData;
@@ -71,7 +68,6 @@
import org.openecomp.sdc.be.tosca.model.ToscaTemplate;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import org.openecomp.sdc.exception.ResponseFormat;
import fj.data.Either;
import mockit.Deencapsulation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 90dc926..0252d5a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -21,7 +21,7 @@
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
@@ -51,7 +51,7 @@
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
import org.openecomp.sdc.be.tosca.model.SubstitutionMapping;
@@ -64,7 +64,6 @@
import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
import org.openecomp.sdc.be.tosca.model.ToscaTopolgyTemplate;
import org.openecomp.sdc.be.tosca.utils.InputConverter;
-import org.yaml.snakeyaml.Yaml;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;
@@ -182,7 +181,7 @@
component = getNewService();
Mockito.when(capabiltyRequirementConvertor.convertRequirements(Mockito.any(Map.class),Mockito.any(Service.class),
Mockito.any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
- Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
// default test when component is Service
result = testSubject.exportComponent(component);
@@ -195,7 +194,7 @@
((Resource) component).setInterfaces(new HashMap<>());
- Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
Mockito.when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()).thenReturn(Either.left(Collections.emptyMap()));
// default test when convertInterfaceNodeType is right
result = testSubject.exportComponentInterface(component, false);
@@ -450,7 +449,7 @@
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
Either<ToscaTemplate, ToscaError> result;
- Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.ALREADY_EXIST));
+ Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
Mockito.when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
.thenReturn(Either.left(Collections.emptyMap()));
// default test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
index b31ed58..9c34b1d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
@@ -12,13 +12,12 @@
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.common.api.UserRoleEnum;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -36,7 +35,7 @@
@Mock
private ComponentsUtils componentsUtils;
@Mock
- private TitanGenericDao titanDao;
+ private JanusGraphGenericDao janusGraphDao;
@Before
public void setUp() {
@@ -339,8 +338,8 @@
Mockito.when(userAdminOperation.getUserData(userIdToUpdate, false)).thenReturn(value2);
List<Edge> list = new LinkedList<>();
- list.add(new DetachedEdge("sdas", "fdfs", new HashMap<>(), Pair.with("sadas", "sadasd"),
- Pair.with("sadas", "sadasd")));
+ list.add(new DetachedEdge("sdas", "fdfs", new HashMap<>(),"sadas","sadasd",
+ "sadas","sadasd" ));
Either<List<Edge>, StorageOperationStatus> value3 = Either.left(list);
Mockito.when(userAdminOperation.getUserPendingTasksList(Mockito.any(), Mockito.any())).thenReturn(value3);
@@ -657,7 +656,7 @@
Mockito.when(userAdminOperation.getUserData("mockDU", false)).thenReturn(value2);
LinkedList<Edge> a = new LinkedList<>();
a.add(new DetachedEdge(userUniuqeIdToDeactive, userUniuqeIdToDeactive, new HashMap<>(),
- Pair.with("dsfds", "dsfds"), Pair.with("dsfds", "dsfds")));
+ "dsfds","dsfds", "dsfds", "dsfds"));
Either<List<Edge>, StorageOperationStatus> value3 = Either.left(a);
Mockito.when(userAdminOperation.getUserPendingTasksList(Mockito.any(), Mockito.any())).thenReturn(value3);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java
index 900fdc5..091e156 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java
@@ -28,8 +28,8 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ResourceUploadStatus;
import org.openecomp.sdc.be.dao.impl.ESCatalogDAO;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
@@ -48,17 +48,17 @@
public class SdncTransactionTest {
private static ESCatalogDAO esCatalogDao = Mockito.mock(ESCatalogDAO.class);
- private static TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class);
+ private static JanusGraphGenericDao janusGraphGenericDao = Mockito.mock(JanusGraphGenericDao.class);
private static final Logger log = Mockito.spy(Logger.getLogger(SdncTransactionTest.class));
private static int transactionId = 0;
private static ConfigurationManager configurationManager;
public enum TestAction {
- TitanAction, Rollback, GeneralAction
+ JanusGraphAction, Rollback, GeneralAction
}
public enum TestResponse {
- TitanResponseSuccess, GeneralSuccess
+ JanusGraphResponseSuccess, GeneralSuccess
}
@BeforeClass
@@ -75,22 +75,24 @@
public void beforeTest() {
reset(log);
reset(esCatalogDao);
- reset(titanGenericDao);
+ reset(janusGraphGenericDao);
}
@Test
- public void testInvokeTitanAction() {
+ public void testInvokeJanusGraphAction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
- doBasicTitanAction(transactionId, tx, false, true);
+ doBasicJanusGraphAction(transactionId, tx, false, true);
assertSame(tx.getStatus(), TransactionStatusEnum.OPEN);
}
@Test
public void testInvokeESAction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doESAddArtifactAction(transactionId, tx, true, true);
assertSame(tx.getStatus(), TransactionStatusEnum.OPEN);
@@ -99,7 +101,8 @@
@Test
public void testfinishTransaction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doFinishTransaction(transactionId, tx, true);
assertSame(tx.getStatus(), TransactionStatusEnum.CLOSED);
}
@@ -107,7 +110,8 @@
@Test
public void testFinishOnClosedTransaction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doFinishTransaction(transactionId, tx, true);
TransactionCodeEnum finishTransaction = tx.finishTransaction();
@@ -120,30 +124,33 @@
@Test
public void testCallingLastActionTwice() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
- doBasicTitanAction(transactionId, tx, true, true);
- Either<TestResponse, TransactionCodeEnum> doBasicTitanAction = doBasicTitanAction(transactionId, tx, true, false);
- assertTrue(doBasicTitanAction.isRight());
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
+ doBasicJanusGraphAction(transactionId, tx, true, true);
+ Either<TestResponse, TransactionCodeEnum> doBasicJanusGraphAction = doBasicJanusGraphAction(transactionId, tx, true, false);
+ assertTrue(doBasicJanusGraphAction.isRight());
assertNotSame(tx.getStatus(), TransactionStatusEnum.OPEN);
- verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DOUBLE_FINISH_FLAG_ACTION, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DOUBLE_FINISH_FLAG_ACTION, transactionId, DBTypeEnum.JANUSGRAPH
+ .name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
}
@Test
public void testActionOnClosedTransaction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doFinishTransaction(transactionId, tx, true);
Either<DBActionCodeEnum, TransactionCodeEnum> eitherESResult = tx.invokeESAction(false, ESActionTypeEnum.ADD_ARTIFACT, createDummyArtifactData());
assertTrue(eitherESResult.isRight());
assertSame(eitherESResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED);
- Either<Object, TransactionCodeEnum> eitherTitanResult = tx.invokeTitanAction(false, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess));
- assertTrue(eitherTitanResult.isRight());
- assertSame(eitherTitanResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED);
+ Either<Object, TransactionCodeEnum> eitherJanusGraphResult = tx.invokeJanusGraphAction(false, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess));
+ assertTrue(eitherJanusGraphResult.isRight());
+ assertSame(eitherJanusGraphResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED);
- Either<Object, TransactionCodeEnum> eitherGeneralDBAction = tx.invokeGeneralDBAction(true, DBTypeEnum.TITAN, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess),
- createBasicAction(TestAction.Rollback, TestResponse.TitanResponseSuccess));
+ Either<Object, TransactionCodeEnum> eitherGeneralDBAction = tx.invokeGeneralDBAction(true, DBTypeEnum.JANUSGRAPH, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess),
+ createBasicAction(TestAction.Rollback, TestResponse.JanusGraphResponseSuccess));
assertTrue(eitherGeneralDBAction.isRight());
assertSame(eitherGeneralDBAction.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED);
@@ -155,9 +162,10 @@
@Test
public void testBasicHappyScenario() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
- doBasicTitanAction(transactionId, tx, false, true);
+ doBasicJanusGraphAction(transactionId, tx, false, true);
assertSame(tx.getStatus(), TransactionStatusEnum.OPEN);
doESAddArtifactAction(transactionId, tx, true, true);
@@ -172,23 +180,27 @@
@Test
public void testRollbackSucceededOnAction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doESAddArtifactAction(transactionId, tx, false, true);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
String crushMessage = "DB Crush Simulation";
- Either<TestResponse, TransactionCodeEnum> eitherTransactionResult = tx.invokeTitanAction(false, createCrushingAction(TestAction.TitanAction, crushMessage));
+ Either<TestResponse, TransactionCodeEnum> eitherTransactionResult = tx.invokeJanusGraphAction(false, createCrushingAction(TestAction.JanusGraphAction, crushMessage));
assertTrue(eitherTransactionResult.isRight());
assertSame(eitherTransactionResult.right().value(), TransactionCodeEnum.ROLLBACK_SUCCESS);
assertSame(tx.getStatus(), TransactionStatusEnum.CLOSED);
- verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.TITAN.name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log).info(LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
@@ -197,35 +209,40 @@
@Test
public void testRollbackFailedOnAction() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doESAddArtifactAction(transactionId, tx, false, true);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.NOT_CONNECTED);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.NOT_CONNECTED);
String crushMessage = "DB Crush Simulation";
- Either<TestResponse, TransactionCodeEnum> eitherTransactionResult = tx.invokeTitanAction(false, createCrushingAction(TestAction.TitanAction, crushMessage));
+ Either<TestResponse, TransactionCodeEnum> eitherTransactionResult = tx.invokeJanusGraphAction(false, createCrushingAction(TestAction.JanusGraphAction, crushMessage));
assertTrue(eitherTransactionResult.isRight());
assertSame(tx.getStatus(), TransactionStatusEnum.FAILED_ROLLBACK);
assertSame(eitherTransactionResult.right().value(), TransactionCodeEnum.ROLLBACK_FAILED);
- verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.TITAN.name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
}
@Test
public void testRollbackSucceededOnCommit() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doESAddArtifactAction(transactionId, tx, false, true);
- doBasicTitanAction(transactionId, tx, true, true);
+ doBasicJanusGraphAction(transactionId, tx, true, true);
- when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.GENERAL_ERROR);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.GENERAL_ERROR);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
// finishTransaction
TransactionCodeEnum transactionCode = tx.finishTransaction();
assertSame(transactionCode, TransactionCodeEnum.ROLLBACK_SUCCESS);
@@ -234,8 +251,10 @@
verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log).info(LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
@@ -244,12 +263,13 @@
@Test
public void testRollbackFailedOnCommit() {
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
doESAddArtifactAction(transactionId, tx, false, true);
- doBasicTitanAction(transactionId, tx, true, true);
+ doBasicJanusGraphAction(transactionId, tx, true, true);
- when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.GENERAL_ERROR);
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.GENERAL_ERROR);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
String esError = "No Connection to Es";
Mockito.doThrow(new RuntimeException(esError)).when(esCatalogDao).deleteArtifact(Mockito.anyString());
// finishTransaction
@@ -260,15 +280,18 @@
verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH
+ .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
}
@Test
public void testInvokeGeneralAction() {
- when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK);
int transactionId = getNextTransactionId();
- TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao);
+ TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao,
+ janusGraphGenericDao);
IDBAction generalAction = createBasicAction(TestAction.GeneralAction, TestResponse.GeneralSuccess);
IDBAction rollbackAction = createBasicAction(TestAction.Rollback, TestResponse.GeneralSuccess);
String crushMessage = "No DB Connection";
@@ -294,30 +317,31 @@
}
- private Either<TestResponse, TransactionCodeEnum> doBasicTitanAction(int transactionId, TransactionSdncImpl tx, boolean isLastAction, boolean isVerifyAction) {
- // Add Titan Action
- Either<TestResponse, TransactionCodeEnum> eitherTitanResult = tx.invokeTitanAction(isLastAction, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess));
+ private Either<TestResponse, TransactionCodeEnum> doBasicJanusGraphAction(int transactionId, TransactionSdncImpl tx, boolean isLastAction, boolean isVerifyAction) {
+ // Add JanusGraph Action
+ Either<TestResponse, TransactionCodeEnum> eitherJanusGraphResult = tx.invokeJanusGraphAction(isLastAction, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess));
if (isVerifyAction) {
- // Check Titan Action
- assertTrue(eitherTitanResult.isLeft());
- assertSame(eitherTitanResult.left().value(), TestResponse.TitanResponseSuccess);
- verify(log).debug(TestAction.TitanAction.name());
- verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ // Check JanusGraph Action
+ assertTrue(eitherJanusGraphResult.isLeft());
+ assertSame(eitherJanusGraphResult.left().value(), TestResponse.JanusGraphResponseSuccess);
+ verify(log).debug(TestAction.JanusGraphAction.name());
+ verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.JANUSGRAPH.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
verifyNoErrorsInLog();
verifyNoInfoInLog();
}
- return eitherTitanResult;
+ return eitherJanusGraphResult;
}
private TransactionCodeEnum doFinishTransaction(int transactionId, TransactionSdncImpl tx, boolean isVerifyAction) {
// Prerequisite finishTransaction
- when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
// finishTransaction
TransactionCodeEnum transactionCode = tx.finishTransaction();
if (isVerifyAction) {
// Check finishTransaction
verify(log).debug(LogMessages.COMMIT_ACTION_ALL_DB, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
- verify(log).debug(LogMessages.COMMIT_ACTION_SPECIFIC_DB, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
+ verify(log).debug(LogMessages.COMMIT_ACTION_SPECIFIC_DB, transactionId, DBTypeEnum.JANUSGRAPH
+ .name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
assertSame(transactionCode, TransactionCodeEnum.SUCCESS);
}
return transactionCode;
@@ -332,7 +356,7 @@
Either<DBActionCodeEnum, TransactionCodeEnum> eitherEsAction = tx.invokeESAction(isLastAction, ESActionTypeEnum.ADD_ARTIFACT, createDummyArtifactData());
if (isVerifyAction) {
- // Check Titan Action
+ // Check JanusGraph Action
assertTrue(eitherEsAction.isLeft());
assertSame(eitherEsAction.left().value(), DBActionCodeEnum.SUCCESS);
verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.ELASTIC_SEARCH.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name());
diff --git a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/configuration.yaml
index e8bebc8..803805e 100644
--- a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml
+++ b/catalog-be/src/test/resources/config/catalog-be/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
diff --git a/catalog-be/src/test/resources/paths/path-context.xml b/catalog-be/src/test/resources/paths/path-context.xml
index b9415bf..8f6dea2 100644
--- a/catalog-be/src/test/resources/paths/path-context.xml
+++ b/catalog-be/src/test/resources/paths/path-context.xml
@@ -38,7 +38,7 @@
org.openecomp.sdc.be.dao.neo4j,
org.openecomp.sdc.be.model.operations.impl,
org.openecomp.sdc.be.model.cache,
- org.openecomp.sdc.be.dao.titan,
+ org.openecomp.sdc.be.dao.janusgraph,
org.openecomp.sdc.be.user,
org.openecomp.sdc.be.impl,
org.openecomp.sdc.be.auditing.impl,
@@ -51,8 +51,8 @@
org.openecomp.sdc.be.switchover.detector,
org.openecomp.sdc.be.tosca,
org.openecomp.sdc.be.model.operations.impl,
- org.openecomp.sdc.be.model.jsontitan.operations,
- org.openecomp.sdc.be.model.jsontitan.utils,
+ org.openecomp.sdc.be.model.jsonjanusgraph.operations,
+ org.openecomp.sdc.be.model.jsonjanusgraph.utils,
org.openecomp.sdc.be.components.csar,
org.openecomp.sdc.be.datamodel.utils,
org.openecomp.sdc.be.model.utils,
@@ -79,7 +79,7 @@
<bean id="distribution-engine-cluster-health" class="org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth" />
<bean id="categoriesImportManager" class="org.openecomp.sdc.be.components.impl.CategoriesImportManager" />
<bean id="asset-metadata-utils" class="org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter" />
- <bean id="titan-client" class="org.openecomp.sdc.be.components.path.beans.InMemoryTitanGraphClient" />
+ <bean id="janusgraph-client" class="org.openecomp.sdc.be.components.path.beans.InMemoryJanusGraphClient" />
<bean class="org.openecomp.sdc.be.dao.config.DAOSpringConfig"/>
<bean id="component-cassandra-dao" class="org.openecomp.sdc.be.components.path.beans.ComponentCassandraDaoMock" />
<bean id="cassandra-client" class="org.openecomp.sdc.be.components.path.beans.CassandraClientMock" />
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index ee2da54..3e04560 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -230,11 +230,10 @@
<scope>test</scope>
</dependency>
- <!-- TITAN -->
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-core</artifactId>
+ <version>${janusgraph.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -257,9 +256,9 @@
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-cassandra</artifactId>
+ <version>${janusgraph.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -275,7 +274,6 @@
<version>${lang3.version}</version>
<scope>provided</scope>
</dependency>
- <!-- TITAN END -->
<!-- CASSANDRA -->
<dependency>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java
similarity index 91%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java
index 2452245..1a96ebf 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java
@@ -22,11 +22,11 @@
import org.openecomp.sdc.be.config.ConfigurationManager;
-public class DAOTitanStrategy implements TitanClientStrategy {
+public class DAOJanusGraphStrategy implements JanusGraphClientStrategy {
@Override
public String getConfigFile() {
- return ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile();
+ return ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphCfgFile();
}
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/JanusGraphClientStrategy.java
similarity index 95%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/JanusGraphClientStrategy.java
index 36aaec8..14e12e9 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/JanusGraphClientStrategy.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.dao;
-public interface TitanClientStrategy {
+public interface JanusGraphClientStrategy {
String getConfigFile();
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
index 5af12a8..53d71fe 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
@@ -120,7 +120,7 @@
Map<String, Map<String, List<String>>> cassndraMetadata = parseKeyspaceMetadata(keyspacesMetadateFromCassandra);
log.info("Cassandra Metadata: {}" ,cassndraMetadata);
cassndraMetadata.forEach((k, v) -> {
- if (AuditingTypesConstants.TITAN_KEYSPACE.equals(k)) {
+ if (AuditingTypesConstants.janusGraph_KEYSPACE.equals(k)) {
// session.execute("")
} else if (AuditingTypesConstants.ARTIFACT_KEYSPACE.equals(k)) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java
index 99acb3b..e40b5aa 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java
@@ -26,7 +26,7 @@
import org.springframework.context.annotation.PropertySource;
@Configuration
-@Import({TitanSpringConfig.class})
+@Import({JanusGraphSpringConfig.class})
@ComponentScan({
"org.openecomp.sdc.be.dao.cassandra",
"org.openecomp.sdc.be.dao.neo4j",
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java
new file mode 100644
index 0000000..d30caf1
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java
@@ -0,0 +1,54 @@
+package org.openecomp.sdc.be.dao.config;
+
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
+import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.transactions.SimpleJanusGraphTransactionManager;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@ComponentScan({
+ "org.openecomp.sdc.be.dao.jsongraph",
+})
+@EnableTransactionManagement
+public class JanusGraphSpringConfig {
+
+ @Bean(name = "janusgraph-generic-dao")
+ @Primary
+ public HealingJanusGraphGenericDao janusGraphGenericDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) {
+ return new HealingJanusGraphGenericDao(janusGraphClient);
+ }
+
+ @Bean(name = "janusgraph-client", initMethod = "createGraph")
+ @Primary
+ public JanusGraphClient janusGraphClient(@Qualifier("dao-client-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
+ }
+
+ @Bean(name = "dao-client-strategy")
+ public JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
+ }
+
+ @Bean
+ public PlatformTransactionManager txManager() {
+ return new SimpleJanusGraphTransactionManager(janusGraphClient(janusGraphClientStrategy()));
+ }
+
+ @Bean(name = "healingPipelineDao")
+ public HealingPipelineDao healingPipeline(){
+ HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
+ healingPipelineDao.setHealVersion(1);
+ healingPipelineDao.initHealVersion();
+ return healingPipelineDao;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/TitanSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/TitanSpringConfig.java
deleted file mode 100644
index 34a860d..0000000
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/TitanSpringConfig.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.openecomp.sdc.be.dao.config;
-
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
-import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.transactions.SimpleTitanTransactionManager;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-@Configuration
-@ComponentScan({
- "org.openecomp.sdc.be.dao.jsongraph",
-})
-@EnableTransactionManagement
-public class TitanSpringConfig {
-
- @Bean(name = "titan-generic-dao")
- @Primary
- public HealingTitanGenericDao titanGenericDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) {
- return new HealingTitanGenericDao(titanGraphClient);
- }
-
- @Bean(name = "titan-client", initMethod = "createGraph")
- @Primary
- public TitanGraphClient titanGraphClient(@Qualifier("dao-client-strategy") TitanClientStrategy titanClientStrategy) {
- return new TitanGraphClient(titanClientStrategy);
- }
-
- @Bean(name = "dao-client-strategy")
- public TitanClientStrategy titanClientStrategy() {
- return new DAOTitanStrategy();
- }
-
- @Bean
- public PlatformTransactionManager txManager() {
- return new SimpleTitanTransactionManager(titanGraphClient(titanClientStrategy()));
- }
-
- @Bean(name = "healingPipelineDao")
- public HealingPipelineDao healingPipeline(){
- HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
- healingPipelineDao.setHealVersion(1);
- healingPipelineDao.initHealVersion();
- return healingPipelineDao;
- }
-}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/HealingPipelineDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/HealingPipelineDao.java
index 5b219b2..f757b58 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/HealingPipelineDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/HealingPipelineDao.java
@@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -33,7 +33,7 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.impl.heal.HealGraphDao;
import org.openecomp.sdc.be.dao.impl.heal.HealNodeGraphDao;
-import org.openecomp.sdc.be.dao.impl.heal.HealTitanGraphDao;
+import org.openecomp.sdc.be.dao.impl.heal.HealJanusGraphDao;
import org.openecomp.sdc.be.dao.impl.heal.HealVertexGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.heal.Heal;
@@ -58,7 +58,7 @@
private HealGraphDao healNodeGraphDao;
private HealGraphDao healVertexGraphDao;
- private HealGraphDao healTitanVertexGraphDao;
+ private HealGraphDao healJanusGraphVertexGraphDao;
public HealingPipelineDao() {
healingPipeline = ImmutableListMultimap.of();
@@ -74,7 +74,7 @@
public void initGraphHealers() {
healNodeGraphDao = new HealNodeGraphDao(this);
healVertexGraphDao = new HealVertexGraphDao(this);
- healTitanVertexGraphDao = new HealTitanGraphDao(this);
+ healJanusGraphVertexGraphDao = new HealJanusGraphDao(this);
}
@@ -85,8 +85,8 @@
if (graphNode instanceof GraphElement) {
return healNodeGraphDao;
}
- if (graphNode instanceof TitanVertex) {
- return healTitanVertexGraphDao;
+ if (graphNode instanceof JanusGraphVertex) {
+ return healJanusGraphVertexGraphDao;
}
return null;
@@ -133,7 +133,7 @@
graphVertex.addMetadataProperty(GraphPropertyEnum.HEALING_VERSION, currentHealVersion.getVersion());
}
- public void setHealingVersion(TitanVertex graphVertex) {
+ public void setHealingVersion(JanusGraphVertex graphVertex) {
graphVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty(), currentHealVersion.getVersion());
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealTitanGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
similarity index 78%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealTitanGraphDao.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
index 1e33c61..76be4a6 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealTitanGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.be.dao.impl.heal;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
import org.openecomp.sdc.be.dao.jsongraph.heal.Heal;
import org.openecomp.sdc.be.dao.jsongraph.heal.HealConstants;
@@ -9,16 +9,16 @@
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-public class HealTitanGraphDao implements HealGraphDao<TitanVertex, GraphEdgeLabels> {
+public class HealJanusGraphDao implements HealGraphDao<JanusGraphVertex, GraphEdgeLabels> {
private HealingPipelineDao healingPipelineDao;
- public HealTitanGraphDao(HealingPipelineDao healingPipelineDao) {
+ public HealJanusGraphDao(HealingPipelineDao healingPipelineDao) {
this.healingPipelineDao = healingPipelineDao;
}
@Override
- public TitanVertex performGraphReadHealing(TitanVertex childVertex, GraphEdgeLabels graphEdgeLabels) {
+ public JanusGraphVertex performGraphReadHealing(JanusGraphVertex childVertex, GraphEdgeLabels graphEdgeLabels) {
final Integer healingVersionInt = (Integer) childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty()).orElse(HealConstants.DEFAULT_HEAL_VERSION);
HealVersion<Integer> healingVersion = HealVersionBuilder.build(healingVersionInt);
healingPipelineDao.getHealersForVertex(graphEdgeLabels.name(), healingVersion).forEach(heal -> healGraphVertex(childVertex, heal));
@@ -27,7 +27,7 @@
}
- private TitanVertex healGraphVertex(TitanVertex childVertex, Heal<TitanVertex> heal) {
+ private JanusGraphVertex healGraphVertex(JanusGraphVertex childVertex, Heal<JanusGraphVertex> heal) {
heal.healData(childVertex);
final HealVersion<Integer> healVersion = heal.fromVersion();
HealVersion newerVersion = HealVersionBuilder.build(healVersion.getVersion() + 1);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealNodeGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealNodeGraphDao.java
index 2fc5c8f..9bc75a0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealNodeGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealNodeGraphDao.java
@@ -20,12 +20,12 @@
public GraphNode performGraphReadHealing(GraphNode childVertex, GraphEdge graphEdge) {
Integer healingVersionInt = childVertex.getHealingVersion();
HealVersion<Integer> healingVersion = HealVersionBuilder.build(healingVersionInt);
- healingPipelineDao.getHealersForVertex(graphEdge.getEdgeType().getProperty(), healingVersion).forEach(heal -> healTitanVertex(childVertex, heal));
+ healingPipelineDao.getHealersForVertex(graphEdge.getEdgeType().getProperty(), healingVersion).forEach(heal -> healJanusGraphVertex(childVertex, heal));
childVertex.setHealingVersion(healingPipelineDao.getCurrentHealVersion().getVersion());
return childVertex;
}
- private GraphNode healTitanVertex(GraphNode childVertex, Heal<GraphNode> heal) {
+ private GraphNode healJanusGraphVertex(GraphNode childVertex, Heal<GraphNode> heal) {
heal.healData(childVertex);
final HealVersion<Integer> healVersion = heal.fromVersion();
HealVersion<Integer> newerVersion = HealVersionBuilder.build(healVersion.getVersion() + 1);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/HealingTitanGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
similarity index 66%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/HealingTitanGenericDao.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
index 37546a5..f8ab531 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/HealingTitanGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openecomp.sdc.be.dao.titan;
+package org.openecomp.sdc.be.dao.janusgraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.util.List;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -25,9 +25,7 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
-import org.openecomp.sdc.be.dao.jsongraph.heal.Heal;
import org.openecomp.sdc.be.dao.jsongraph.heal.HealConstants;
-import org.openecomp.sdc.be.dao.jsongraph.heal.HealVersion;
import org.openecomp.sdc.be.dao.jsongraph.heal.HealVersionBuilder;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -35,28 +33,28 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-@Component("titan-generic-dao")
-public class HealingTitanGenericDao extends TitanGenericDao {
+@Component("janusgraph-generic-dao")
+public class HealingJanusGraphGenericDao extends JanusGraphGenericDao {
@Autowired
private HealingPipelineDao healingPipelineDao;
- public HealingTitanGenericDao(TitanGraphClient titanClient) {
- super(titanClient);
+ public HealingJanusGraphGenericDao(JanusGraphClient janusGraphClient) {
+ super(janusGraphClient);
}
@Override
- public ImmutablePair<TitanVertex, Edge> getChildVertex(TitanVertex childVertex, GraphEdgeLabels edgeType) {
- ImmutablePair<TitanVertex, Edge> childVertexEdgeImmutablePair = super.getChildVertex(childVertex, edgeType);
- final TitanVertex graphVertex = childVertexEdgeImmutablePair.left;
+ public ImmutablePair<JanusGraphVertex, Edge> getChildVertex(JanusGraphVertex childVertex, GraphEdgeLabels edgeType) {
+ ImmutablePair<JanusGraphVertex, Edge> childVertexEdgeImmutablePair = super.getChildVertex(childVertex, edgeType);
+ final JanusGraphVertex graphVertex = childVertexEdgeImmutablePair.left;
healingPipelineDao.performGraphReadHealing(graphVertex, edgeType);
healingPipelineDao.setHealingVersion(graphVertex);
return childVertexEdgeImmutablePair;
}
@Override
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> either = super.getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz, withEdges);
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> either = super.getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz, withEdges);
if (either.isRight()) {
return either;
}
@@ -66,8 +64,8 @@
}
@Override
- public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, TitanOperationStatus> getChild(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
- Either<ImmutablePair<T, GraphEdge>, TitanOperationStatus> eitherChild = super.getChild(key, uniqueId, edgeType, nodeTypeEnum, clazz);
+ public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> getChild(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> eitherChild = super.getChild(key, uniqueId, edgeType, nodeTypeEnum, clazz);
if (eitherChild.isRight()) {
return eitherChild;
}
@@ -89,19 +87,19 @@
}
@Override
- public Either<List<ImmutablePair<TitanVertex, Edge>>, TitanOperationStatus> getChildrenVertecies(String key, String uniqueId, GraphEdgeLabels edgeType) {
- Either<List<ImmutablePair<TitanVertex, Edge>>, TitanOperationStatus> either = super.getChildrenVertecies(key, uniqueId, edgeType);
+ public Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> getChildrenVertecies(String key, String uniqueId, GraphEdgeLabels edgeType) {
+ Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> either = super.getChildrenVertecies(key, uniqueId, edgeType);
if (either.isRight()) {
return either;
}
- List<ImmutablePair<TitanVertex, Edge>> list = either.left().value();
+ List<ImmutablePair<JanusGraphVertex, Edge>> list = either.left().value();
list.forEach(this::transformVertexPair);
return either;
}
- private void transformVertexPair(ImmutablePair<TitanVertex, Edge> either) {
+ private void transformVertexPair(ImmutablePair<JanusGraphVertex, Edge> either) {
String edgeType = either.right.label();
- TitanVertex childVertex = either.left;
+ JanusGraphVertex childVertex = either.left;
VertexProperty<Integer> healingVersionProperty = childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty());
Integer healingVersioInt = healingVersionProperty.orElse(HealConstants.DEFAULT_HEAL_VERSION);
HealVersionBuilder.build(healingVersioInt);
@@ -110,13 +108,13 @@
}
@Override
- public <T extends GraphNode> Either<T, TitanOperationStatus> updateNode(GraphNode node, Class<T> clazz) {
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> updateNode(GraphNode node, Class<T> clazz) {
healingPipelineDao.setHealingVersion(node);
return super.updateNode(node, clazz);
}
@Override
- public TitanOperationStatus updateVertex(GraphNode node, Vertex vertex) {
+ public JanusGraphOperationStatus updateVertex(GraphNode node, Vertex vertex) {
healingPipelineDao.setHealingVersion(node);
return super.updateVertex(node, vertex);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
similarity index 61%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
index 9d5ff9d..5be907c 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
@@ -18,24 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.dao.titan;
+package org.openecomp.sdc.be.dao.janusgraph;
-import com.thinkaurelius.titan.core.*;
-import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
-import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
-import com.thinkaurelius.titan.core.util.TitanCleanup;
-import com.thinkaurelius.titan.diskstorage.ResourceUnavailableException;
-import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException;
-import com.thinkaurelius.titan.graphdb.database.idassigner.IDPoolExhaustedException;
+import org.janusgraph.core.*;
+import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
+import org.janusgraph.diskstorage.BackendException;
+import org.janusgraph.diskstorage.ResourceUnavailableException;
+import org.janusgraph.diskstorage.locking.PermanentLockingException;
+import org.janusgraph.graphdb.database.idassigner.IDPoolExhaustedException;
import fj.data.Either;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,23 +47,23 @@
import java.util.concurrent.*;
-@Component("titan-client")
-public class TitanGraphClient {
- private static Logger logger = LoggerFactory.getLogger(TitanGraphClient.class.getName());
- private static Logger healthLogger = LoggerFactory.getLogger("titan.healthcheck");
+@Component("janusgraph-client")
+public class JanusGraphClient {
+ private static Logger logger = LoggerFactory.getLogger(JanusGraphClient.class.getName());
+ private static Logger healthLogger = LoggerFactory.getLogger("janusgraph.healthcheck");
private static final String HEALTH_CHECK = GraphPropertiesDictionary.HEALTH_CHECK.getProperty();
private static final String OK = "GOOD";
- public TitanGraphClient() {
+ public JanusGraphClient() {
}
private class HealthCheckTask implements Callable<Vertex> {
@Override
public Vertex call() {
- TitanVertex v = (TitanVertex) graph.query().has(HEALTH_CHECK, OK).vertices().iterator().next();
- TitanVertexProperty<String> property = v.property("healthcheck", OK + "_" + System.currentTimeMillis());
+ JanusGraphVertex v = (JanusGraphVertex) graph.query().has(HEALTH_CHECK, OK).vertices().iterator().next();
+ JanusGraphVertexProperty<String> property = v.property("healthcheck", OK + "_" + System.currentTimeMillis());
healthLogger.trace("Health Check Node Found...{}", v.property(HEALTH_CHECK));
graph.tx().commit();
@@ -74,11 +74,11 @@
private class HealthCheckScheduledTask implements Runnable {
@Override
public void run() {
- healthLogger.trace("Executing TITAN Health Check Task - Start");
+ healthLogger.trace("Executing janusGraph Health Check Task - Start");
boolean healthStatus = isGraphOpen();
- healthLogger.trace("Executing TITAN Health Check Task - Status = {}", healthStatus);
+ healthLogger.trace("Executing janusGraph Health Check Task - Status = {}", healthStatus);
if (healthStatus != lastHealthState) {
- logger.trace("TITAN Health State Changed to {}. Issuing alarm / recovery alarm...", healthStatus);
+ logger.trace("janusGraph Health State Changed to {}. Issuing alarm / recovery alarm...", healthStatus);
lastHealthState = healthStatus;
logAlarm();
}
@@ -88,14 +88,14 @@
private class ReconnectTask implements Runnable {
@Override
public void run() {
- logger.trace("Trying to reconnect to Titan...");
+ logger.trace("Trying to reconnect to JanusGraph...");
if (graph == null) {
- createGraph(titanCfgFile);
+ createGraph(janusGraphCfgFile);
}
}
}
- private TitanGraph graph;
+ private JanusGraph graph;
// Health Check Variables
@@ -105,7 +105,7 @@
ExecutorService healthCheckExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
- return new Thread(r, "Titan-Health-Check-Thread");
+ return new Thread(r, "JanusGraph-Health-Check-Thread");
}
});
private long healthCheckReadTimeout = 2;
@@ -121,51 +121,51 @@
@SuppressWarnings("rawtypes")
private Future reconnectFuture;
- private String titanCfgFile = null;
- TitanClientStrategy titanClientStrategy;
+ private String janusGraphCfgFile = null;
+ JanusGraphClientStrategy janusGraphClientStrategy;
- public TitanGraphClient(TitanClientStrategy titanClientStrategy) {
+ public JanusGraphClient(JanusGraphClientStrategy janusGraphClientStrategy) {
super();
- this.titanClientStrategy = titanClientStrategy;
+ this.janusGraphClientStrategy = janusGraphClientStrategy;
// Initialize a single threaded scheduler for health-check
this.healthCheckScheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
- return new Thread(r, "Titan-Health-Check-Task");
+ return new Thread(r, "JanusGraph-Health-Check-Task");
}
});
- healthCheckReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanHealthCheckReadTimeout(2);
- reconnectInterval = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanReconnectIntervalInSeconds(3);
+ healthCheckReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphHealthCheckReadTimeout(2);
+ reconnectInterval = ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphReconnectIntervalInSeconds(3);
- logger.info("** TitanGraphClient created");
+ logger.info("** JanusGraphClient created");
}
@PostConstruct
- public TitanOperationStatus createGraph() {
+ public JanusGraphOperationStatus createGraph() {
logger.info("** createGraph started **");
- if (ConfigurationManager.getConfigurationManager().getConfiguration().getTitanInMemoryGraph()) {
+ if (ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphInMemoryGraph()) {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("storage.backend", "inmemory");
- graph = TitanFactory.open(conf);
- createTitanSchema();
+ graph = JanusGraphFactory.open(conf);
+ createJanusGraphSchema();
logger.info("** in memory graph created");
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
} else {
- this.titanCfgFile = titanClientStrategy.getConfigFile();
- if (titanCfgFile == null || titanCfgFile.isEmpty()) {
- titanCfgFile = "config/titan.properties";
+ this.janusGraphCfgFile = janusGraphClientStrategy.getConfigFile();
+ if (janusGraphCfgFile == null || janusGraphCfgFile.isEmpty()) {
+ janusGraphCfgFile = "config/janusgraph.properties";
}
// yavivi
// In case connection failed on init time, schedule a reconnect task
// in the BG
- TitanOperationStatus status = createGraph(titanCfgFile);
- logger.debug("Create Titan graph status {}", status);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = createGraph(janusGraphCfgFile);
+ logger.debug("Create JanusGraph graph status {}", status);
+ if (status != JanusGraphOperationStatus.OK) {
this.startReconnectTask();
}
@@ -178,7 +178,7 @@
}
/**
- * This method will be invoked ONLY on init time in case Titan storage is down.
+ * This method will be invoked ONLY on init time in case JanusGraph storage is down.
*/
private void startReconnectTask() {
this.reconnectTask = new ReconnectTask();
@@ -186,7 +186,7 @@
this.reconnectScheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
- return new Thread(r, "Titan-Reconnect-Task");
+ return new Thread(r, "JanusGraph-Reconnect-Task");
}
});
@@ -198,45 +198,49 @@
if (graph != null) {
// graph.shutdown();
graph.close();
- TitanCleanup.clear(graph);
+ try {
+ JanusGraphFactory.drop(graph);
+ } catch (BackendException e) {
+ e.printStackTrace();
+ }
}
}
private boolean graphInitialized(){
- TitanManagement graphMgmt = graph.openManagement();
+ JanusGraphManagement graphMgmt = graph.openManagement();
return graphMgmt.containsPropertyKey(HEALTH_CHECK) && graphMgmt.containsGraphIndex(HEALTH_CHECK);
}
- public TitanOperationStatus createGraph(String titanCfgFile) {
- logger.info("** open graph with {} started", titanCfgFile);
+ public JanusGraphOperationStatus createGraph(String janusGraphCfgFile) {
+ logger.info("** open graph with {} started", janusGraphCfgFile);
try {
- logger.info("openGraph : try to load file {}", titanCfgFile);
- graph = TitanFactory.open(titanCfgFile);
+ logger.info("openGraph : try to load file {}", janusGraphCfgFile);
+ graph = JanusGraphFactory.open(janusGraphCfgFile);
if (graph.isClosed() || !graphInitialized()) {
- logger.error("titan graph was not initialized");
- return TitanOperationStatus.NOT_CREATED;
+ logger.error("janusgraph graph was not initialized");
+ return JanusGraphOperationStatus.NOT_CREATED;
}
} catch (Exception e) {
this.graph = null;
- logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile);
+ logger.info("createGraph : failed to open JanusGraph graph with configuration file: {}", janusGraphCfgFile);
logger.debug("createGraph : failed with exception.", e);
- return TitanOperationStatus.NOT_CONNECTED;
+ return JanusGraphOperationStatus.NOT_CONNECTED;
}
- logger.info("** Titan graph created ");
+ logger.info("** JanusGraph graph created ");
// Do some post creation actions
this.onGraphOpened();
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private void onGraphOpened() {
// if a reconnect task is running, cancel it.
if (this.reconnectFuture != null) {
- logger.info("** Cancelling Titan reconnect task");
+ logger.info("** Cancelling JanusGraph reconnect task");
reconnectFuture.cancel(true);
}
@@ -254,72 +258,72 @@
}
- public Either<TitanGraph, TitanOperationStatus> getGraph() {
+ public Either<JanusGraph, JanusGraphOperationStatus> getGraph() {
if (graph != null) {
return Either.left(graph);
} else {
- return Either.right(TitanOperationStatus.NOT_CREATED);
+ return Either.right(JanusGraphOperationStatus.NOT_CREATED);
}
}
- public TitanOperationStatus commit() {
+ public JanusGraphOperationStatus commit() {
if (graph != null) {
try {
graph.tx().commit();
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
} catch (Exception e) {
- return handleTitanException(e);
+ return handleJanusGraphException(e);
}
} else {
- return TitanOperationStatus.NOT_CREATED;
+ return JanusGraphOperationStatus.NOT_CREATED;
}
}
- public TitanOperationStatus rollback() {
+ public JanusGraphOperationStatus rollback() {
if (graph != null) {
try {
// graph.rollback();
graph.tx().rollback();
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
} catch (Exception e) {
- return handleTitanException(e);
+ return handleJanusGraphException(e);
}
} else {
- return TitanOperationStatus.NOT_CREATED;
+ return JanusGraphOperationStatus.NOT_CREATED;
}
}
- public static TitanOperationStatus handleTitanException(Exception e) {
- if (e instanceof TitanConfigurationException) {
- return TitanOperationStatus.TITAN_CONFIGURATION;
+ public static JanusGraphOperationStatus handleJanusGraphException(Exception e) {
+ if (e instanceof JanusGraphConfigurationException) {
+ return JanusGraphOperationStatus.JANUSGRAPH_CONFIGURATION;
}
if (e instanceof SchemaViolationException) {
- return TitanOperationStatus.TITAN_SCHEMA_VIOLATION;
+ return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION;
}
if (e instanceof PermanentLockingException) {
- return TitanOperationStatus.TITAN_SCHEMA_VIOLATION;
+ return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION;
}
if (e instanceof IDPoolExhaustedException) {
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
if (e instanceof InvalidElementException) {
- return TitanOperationStatus.INVALID_ELEMENT;
+ return JanusGraphOperationStatus.INVALID_ELEMENT;
}
if (e instanceof InvalidIDException) {
- return TitanOperationStatus.INVALID_ID;
+ return JanusGraphOperationStatus.INVALID_ID;
}
if (e instanceof QueryException) {
- return TitanOperationStatus.INVALID_QUERY;
+ return JanusGraphOperationStatus.INVALID_QUERY;
}
if (e instanceof ResourceUnavailableException) {
- return TitanOperationStatus.RESOURCE_UNAVAILABLE;
+ return JanusGraphOperationStatus.RESOURCE_UNAVAILABLE;
}
if (e instanceof IllegalArgumentException) {
// TODO check the error message??
- return TitanOperationStatus.ILLEGAL_ARGUMENT;
+ return JanusGraphOperationStatus.ILLEGAL_ARGUMENT;
}
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
public boolean getHealth() {
@@ -327,7 +331,7 @@
}
private boolean isGraphOpen() {
- healthLogger.trace("Invoking Titan health check ...");
+ healthLogger.trace("Invoking JanusGraph health check ...");
Vertex v = null;
if (graph != null) {
try {
@@ -340,7 +344,7 @@
if (message == null) {
message = e.getClass().getName();
}
- logger.error("Titan Health Check Failed. {}", message);
+ logger.error("JanusGraph Health Check Failed. {}", message);
return false;
}
return true;
@@ -351,7 +355,7 @@
public static void main(String[] args) throws InterruptedException {
- TitanGraphClient client = new TitanGraphClient(new DAOTitanStrategy());
+ JanusGraphClient client = new JanusGraphClient(new DAOJanusGraphStrategy());
client.createGraph();
while (true) {
@@ -363,20 +367,20 @@
}
- private static final String TITAN_HEALTH_CHECK_STR = "titanHealthCheck";
+ private static final String JANUSGRAPH_HEALTH_CHECK = "janusgraphHealthCheck";
private void logAlarm() {
if (lastHealthState) {
- BeEcompErrorManager.getInstance().logBeHealthCheckTitanRecovery(TITAN_HEALTH_CHECK_STR);
+ BeEcompErrorManager.getInstance().logBeHealthCheckJanusGraphRecovery(JANUSGRAPH_HEALTH_CHECK);
} else {
- BeEcompErrorManager.getInstance().logBeHealthCheckTitanError(TITAN_HEALTH_CHECK_STR);
+ BeEcompErrorManager.getInstance().logBeHealthCheckJanusGraphError(JANUSGRAPH_HEALTH_CHECK);
}
}
- private void createTitanSchema() {
+ private void createJanusGraphSchema() {
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
+ JanusGraphManagement graphMgt = graph.openManagement();
+ JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
similarity index 64%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
index 2123910..591d7f3 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.dao.titan;
+package org.openecomp.sdc.be.dao.janusgraph;
-import com.thinkaurelius.titan.core.PropertyKey;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
-import com.thinkaurelius.titan.core.TitanVertex;
-import com.thinkaurelius.titan.core.TitanVertexQuery;
-import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
+import org.janusgraph.core.PropertyKey;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphQuery;
+import org.janusgraph.core.JanusGraphVertex;
+import org.janusgraph.core.JanusGraphVertexQuery;
+import org.janusgraph.graphdb.query.JanusGraphPredicate;
import fj.data.Either;
import java.util.ArrayList;
import java.util.HashMap;
@@ -58,28 +58,28 @@
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Qualifier;
-public class TitanGenericDao {
+public class JanusGraphGenericDao {
private static final String FAILED_TO_RETRIEVE_GRAPH_STATUS_IS = "Failed to retrieve graph. status is {}";
private static final String NO_EDGES_IN_GRAPH_FOR_CRITERIA = "No edges in graph for criteria";
private static final String FAILED_TO_CREATE_EDGE_FROM_TO = "Failed to create edge from [{}] to [{}]";
- private TitanGraphClient titanClient;
- private static Logger log = Logger.getLogger(TitanGenericDao.class.getName());
+ private JanusGraphClient janusGraphClient;
+ private static Logger log = Logger.getLogger(JanusGraphGenericDao.class.getName());
private static final String LOCK_NODE_PREFIX = "lock_";
- public TitanGenericDao(@Qualifier("titan-client") TitanGraphClient titanClient) {
- this.titanClient = titanClient;
- log.info("** TitanGenericDao created");
+ public JanusGraphGenericDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) {
+ this.janusGraphClient = janusGraphClient;
+ log.info("** JanusGraphGenericDao created");
}
- public TitanOperationStatus commit() {
+ public JanusGraphOperationStatus commit() {
log.debug("doing commit.");
- return titanClient.commit();
+ return janusGraphClient.commit();
}
- public TitanOperationStatus rollback() {
+ public JanusGraphOperationStatus rollback() {
log.error("Going to execute rollback on graph.");
- return titanClient.rollback();
+ return janusGraphClient.rollback();
}
public <T, TStatus> void handleTransactionCommitRollback(boolean inTransaction, Either<T, TStatus> result) {
@@ -92,13 +92,13 @@
}
}
- public Either<TitanGraph, TitanOperationStatus> getGraph() {
- return titanClient.getGraph();
+ public Either<JanusGraph, JanusGraphOperationStatus> getGraph() {
+ return janusGraphClient.getGraph();
}
// For healthCheck
public boolean isGraphOpen() {
- return titanClient.getHealth();
+ return janusGraphClient.getHealth();
}
/**
@@ -107,13 +107,13 @@
* @param clazz
* @return
*/
- public <T extends GraphNode> Either<T, TitanOperationStatus> createNode(T node, Class<T> clazz) {
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> createNode(T node, Class<T> clazz) {
log.debug("try to create node for ID [{}]", node.getKeyValueId());
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
T newNode;
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
Vertex vertex = tGraph.addVertex();
@@ -131,7 +131,7 @@
} catch (Exception e) {
log.debug("Failed to create Node for ID [{}]", node.getKeyValueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -140,14 +140,14 @@
}
}
- public Either<TitanVertex, TitanOperationStatus> createNode(GraphNode node) {
+ public Either<JanusGraphVertex, JanusGraphOperationStatus> createNode(GraphNode node) {
log.debug("try to create node for ID [{}]", node.getKeyValueId());
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanVertex vertex = tGraph.addVertex();
+ JanusGraphVertex vertex = tGraph.addVertex();
vertex.property(GraphPropertiesDictionary.LABEL.getProperty(), node.getLabel());
@@ -160,7 +160,7 @@
} catch (Exception e) {
log.debug("Failed to create Node for ID [{}]", node.getKeyValueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -174,7 +174,7 @@
* @param relation
* @return
*/
- public Either<GraphRelation, TitanOperationStatus> createRelation(GraphRelation relation) {
+ public Either<GraphRelation, JanusGraphOperationStatus> createRelation(GraphRelation relation) {
log.debug("try to create relation from [{}] to [{}] ", relation.getFrom(), relation.getTo());
RelationEndPoint from = relation.getFrom();
@@ -186,25 +186,25 @@
}
- private Either<GraphRelation, TitanOperationStatus> createEdge(String type, ImmutablePair<String, Object> from, ImmutablePair<String, Object> to, String fromLabel, String toLabel, Map<String, Object> properties) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ private Either<GraphRelation, JanusGraphOperationStatus> createEdge(String type, ImmutablePair<String, Object> from, ImmutablePair<String, Object> to, String fromLabel, String toLabel, Map<String, Object> properties) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- Either<Vertex, TitanOperationStatus> fromV = getVertexByPropertyAndLabel(from.getKey(), from.getValue(), fromLabel);
+ Either<Vertex, JanusGraphOperationStatus> fromV = getVertexByPropertyAndLabel(from.getKey(), from.getValue(), fromLabel);
if (fromV.isRight()) {
- TitanOperationStatus error = fromV.right().value();
- if (TitanOperationStatus.NOT_FOUND.equals(error)) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ JanusGraphOperationStatus error = fromV.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(error)) {
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
} else {
return Either.right(error);
}
}
- Either<Vertex, TitanOperationStatus> toV = getVertexByPropertyAndLabel(to.getKey(), to.getValue(), toLabel);
+ Either<Vertex, JanusGraphOperationStatus> toV = getVertexByPropertyAndLabel(to.getKey(), to.getValue(), toLabel);
if (toV.isRight()) {
- TitanOperationStatus error = toV.right().value();
- if (TitanOperationStatus.NOT_FOUND.equals(error)) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ JanusGraphOperationStatus error = toV.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(error)) {
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
} else {
return Either.right(error);
}
@@ -230,7 +230,7 @@
return Either.left(newRelation);
} catch (Exception e) {
log.debug(FAILED_TO_CREATE_EDGE_FROM_TO, from, to, e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
log.debug("Failed to create edge from [{}] to [{}] {}", from, to, graph.right().value());
@@ -238,14 +238,14 @@
}
}
- public TitanOperationStatus createEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
+ public JanusGraphOperationStatus createEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
try {
Edge edge = addEdge(vertexOut, vertexIn, type, properties);
} catch (Exception e) {
log.debug(FAILED_TO_CREATE_EDGE_FROM_TO, vertexOut, vertexIn, e);
- return TitanGraphClient.handleTitanException(e);
+ return JanusGraphClient.handleJanusGraphException(e);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@@ -264,7 +264,7 @@
* @param edge
* @return the copy operation status
*/
- public Either<Edge, TitanOperationStatus> copyEdge(Vertex out, Vertex in, Edge edge) {
+ public Either<Edge, JanusGraphOperationStatus> copyEdge(Vertex out, Vertex in, Edge edge) {
GraphEdgeLabels byName = GraphEdgeLabels.getByName(edge.label());
return this.saveEdge(out, in, byName, edgePropertiesToMap(edge));
}
@@ -274,30 +274,30 @@
return StreamSupport.stream(propertiesIterable.spliterator(), false).collect(Collectors.toMap(Property::key, Property::value));
}
- public Either<Edge, TitanOperationStatus> saveEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
+ public Either<Edge, JanusGraphOperationStatus> saveEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
try {
Edge edge = addEdge(vertexOut, vertexIn, type, properties);
return Either.left(edge);
} catch (Exception e) {
log.debug(FAILED_TO_CREATE_EDGE_FROM_TO, vertexOut, vertexIn, e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
}
- public TitanOperationStatus createEdge(TitanVertex vertexOut, GraphNode to, GraphEdgeLabels type, Map<String, Object> properties) {
+ public JanusGraphOperationStatus createEdge(JanusGraphVertex vertexOut, GraphNode to, GraphEdgeLabels type, Map<String, Object> properties) {
- TitanVertex vertexIn;
- Either<Vertex, TitanOperationStatus> toV = getVertexByPropertyAndLabel(to.getUniqueIdKey(), to.getUniqueId(), to.getLabel());
+ JanusGraphVertex vertexIn;
+ Either<Vertex, JanusGraphOperationStatus> toV = getVertexByPropertyAndLabel(to.getUniqueIdKey(), to.getUniqueId(), to.getLabel());
if (toV.isRight()) {
- TitanOperationStatus error = toV.right().value();
- if (TitanOperationStatus.NOT_FOUND.equals(error)) {
- return TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus error = toV.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(error)) {
+ return JanusGraphOperationStatus.INVALID_ID;
} else {
return error;
}
}
- vertexIn = (TitanVertex) toV.left().value();
+ vertexIn = (JanusGraphVertex) toV.left().value();
return createEdge(vertexOut, vertexIn, type, properties);
}
@@ -309,26 +309,26 @@
* @param properties
* @return
*/
- public Either<GraphRelation, TitanOperationStatus> createRelation(GraphNode from, GraphNode to, GraphEdgeLabels label, Map<String, Object> properties) {
+ public Either<GraphRelation, JanusGraphOperationStatus> createRelation(GraphNode from, GraphNode to, GraphEdgeLabels label, Map<String, Object> properties) {
log.debug("try to create relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId());
return createEdge(label.getProperty(), from.getKeyValueId(), to.getKeyValueId(), from.getLabel(), to.getLabel(), properties);
}
- public Either<GraphRelation, TitanOperationStatus> replaceRelationLabel(GraphNode from, GraphNode to, GraphEdgeLabels label, GraphEdgeLabels newLabel) {
+ public Either<GraphRelation, JanusGraphOperationStatus> replaceRelationLabel(GraphNode from, GraphNode to, GraphEdgeLabels label, GraphEdgeLabels newLabel) {
log.debug("try to replace relation {} to {} from [{}] to [{}]", label.name(), newLabel.name(), from.getKeyValueId(), to.getKeyValueId());
- Either<GraphRelation, TitanOperationStatus> getRelationResult = getRelation(from, to, label);
+ Either<GraphRelation, JanusGraphOperationStatus> getRelationResult = getRelation(from, to, label);
if (getRelationResult.isRight()) {
return getRelationResult;
}
GraphRelation origRelation = getRelationResult.left().value();
- Either<GraphRelation, TitanOperationStatus> createRelationResult = createRelation(from, to, newLabel, origRelation.toGraphMap());
+ Either<GraphRelation, JanusGraphOperationStatus> createRelationResult = createRelation(from, to, newLabel, origRelation.toGraphMap());
if (createRelationResult.isRight()) {
return createRelationResult;
}
- Either<GraphRelation, TitanOperationStatus> deleteRelationResult = deleteRelation(origRelation);
+ Either<GraphRelation, JanusGraphOperationStatus> deleteRelationResult = deleteRelation(origRelation);
if (deleteRelationResult.isRight()) {
return deleteRelationResult;
}
@@ -342,11 +342,11 @@
* @param clazz
* @return
*/
- public <T extends GraphNode> Either<T, TitanOperationStatus> getNode(String keyName, Object keyValue, Class<T> clazz) {
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> getNode(String keyName, Object keyValue, Class<T> clazz) {
log.debug("Try to get node for key [{}] with value [{}] ", keyName, keyValue);
- Either<TitanVertex, TitanOperationStatus> vertexByProperty = getVertexByProperty(keyName, keyValue);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexByProperty = getVertexByProperty(keyName, keyValue);
if (vertexByProperty.isLeft()) {
try {
@@ -356,7 +356,7 @@
return Either.left(node);
} catch (Exception e) {
log.debug("Failed to get node for key [{}] with value [{}] ", keyName, keyValue, e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
log.debug("Failed to get node for key [{}] with value [{}] ", keyName, keyValue, vertexByProperty.right().value());
@@ -371,10 +371,10 @@
* @param label
* @return
*/
- public Either<GraphRelation, TitanOperationStatus> getRelation(GraphNode from, GraphNode to, GraphEdgeLabels label) {
+ public Either<GraphRelation, JanusGraphOperationStatus> getRelation(GraphNode from, GraphNode to, GraphEdgeLabels label) {
log.debug("try to get relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId());
- Either<Edge, TitanOperationStatus> edge = getEdgeByNodes(from, to, label);
+ Either<Edge, JanusGraphOperationStatus> edge = getEdgeByNodes(from, to, label);
if (edge.isLeft()) {
try {
@@ -383,7 +383,7 @@
return Either.left(relation);
} catch (Exception e) {
log.debug("Failed to get get relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
log.debug("Failed to get get relation from [{}] to [{}] {}", from.getKeyValueId(), to.getKeyValueId(), edge.right().value());
@@ -391,18 +391,18 @@
}
}
- public Either<Edge, TitanOperationStatus> getEdgeByNodes(GraphNode from, GraphNode to, GraphEdgeLabels label) {
+ public Either<Edge, JanusGraphOperationStatus> getEdgeByNodes(GraphNode from, GraphNode to, GraphEdgeLabels label) {
ImmutablePair<String, Object> keyValueIdFrom = from.getKeyValueId();
ImmutablePair<String, Object> keyValueIdTo = to.getKeyValueId();
return getEdgeByVerticies(keyValueIdFrom.getKey(), keyValueIdFrom.getValue(), keyValueIdTo.getKey(), keyValueIdTo.getValue(), label.getProperty());
}
- public Either<GraphRelation, TitanOperationStatus> deleteIncomingRelationByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<GraphRelation, JanusGraphOperationStatus> deleteIncomingRelationByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
- Either<Edge, TitanOperationStatus> edgeByCriteria = getIncomingEdgeByCriteria(to, label, props);
+ Either<Edge, JanusGraphOperationStatus> edgeByCriteria = getIncomingEdgeByCriteria(to, label, props);
if (edgeByCriteria.isLeft()) {
- Either<TitanGraph, TitanOperationStatus> graph = getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = getGraph();
if (graph.isLeft()) {
Edge edge = edgeByCriteria.left().value();
log.debug("delete edge {} to {} ", label.getProperty(), to.getUniqueId());
@@ -425,11 +425,11 @@
}
- public Either<GraphRelation, TitanOperationStatus> getIncomingRelationByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<GraphRelation, JanusGraphOperationStatus> getIncomingRelationByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
- Either<Edge, TitanOperationStatus> edgeByCriteria = getIncomingEdgeByCriteria(to, label, props);
+ Either<Edge, JanusGraphOperationStatus> edgeByCriteria = getIncomingEdgeByCriteria(to, label, props);
if (edgeByCriteria.isLeft()) {
- Either<TitanGraph, TitanOperationStatus> graph = getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = getGraph();
if (graph.isLeft()) {
Edge edge = edgeByCriteria.left().value();
Map<String, Object> properties = getProperties(edge);
@@ -450,17 +450,17 @@
}
- public Either<Edge, TitanOperationStatus> getIncomingEdgeByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<Edge, JanusGraphOperationStatus> getIncomingEdgeByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
ImmutablePair<String, Object> keyValueIdTo = to.getKeyValueId();
- Either<TitanVertex, TitanOperationStatus> vertexFrom = getVertexByProperty(keyValueIdTo.getKey(), keyValueIdTo.getValue());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexFrom = getVertexByProperty(keyValueIdTo.getKey(), keyValueIdTo.getValue());
if (vertexFrom.isRight()) {
return Either.right(vertexFrom.right().value());
}
Vertex vertex = vertexFrom.left().value();
- TitanVertex titanVertex = (TitanVertex) vertex;
- TitanVertexQuery<?> query = titanVertex.query();
+ JanusGraphVertex janusGraphVertex = (JanusGraphVertex) vertex;
+ JanusGraphVertexQuery<?> query = janusGraphVertex.query();
query = query.labels(label.getProperty());
if (props != null && !props.isEmpty()) {
@@ -469,34 +469,34 @@
}
}
Edge matchingEdge = null;
- Iterable<TitanEdge> edges = query.edges();
+ Iterable<JanusGraphEdge> edges = query.edges();
if (edges == null) {
log.debug(NO_EDGES_IN_GRAPH_FOR_CRITERIA);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
if (eIter.hasNext()) {
matchingEdge = eIter.next();
}
if (matchingEdge == null) {
log.debug(NO_EDGES_IN_GRAPH_FOR_CRITERIA);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(matchingEdge);
}
- public Either<Edge, TitanOperationStatus> getEdgeByVerticies(String keyNameFrom, Object keyValueFrom, String keyNameTo, Object keyValueTo, String label) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public Either<Edge, JanusGraphOperationStatus> getEdgeByVerticies(String keyNameFrom, Object keyValueFrom, String keyNameTo, Object keyValueTo, String label) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- Either<TitanVertex, TitanOperationStatus> vertexFrom = getVertexByProperty(keyNameFrom, keyValueFrom);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexFrom = getVertexByProperty(keyNameFrom, keyValueFrom);
if (vertexFrom.isRight()) {
return Either.right(vertexFrom.right().value());
}
- Iterable<TitanEdge> edges = vertexFrom.left().value().query().labels(label).edges();
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterable<JanusGraphEdge> edges = vertexFrom.left().value().query().labels(label).edges();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
while (eIter.hasNext()) {
Edge edge = eIter.next();
Vertex vertexIn = edge.inVertex();
@@ -505,22 +505,22 @@
}
}
log.debug("No relation in graph from [{}={}] to [{}={}]", keyNameFrom, keyValueFrom, keyNameTo, keyValueTo);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
} catch (Exception e) {
log.debug("Failed to get get relation from [{}={}] to [{}={}]", keyNameFrom, keyValueFrom, keyNameTo, keyValueTo, e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
return Either.right(graph.right().value());
}
}
- public Either<List<Edge>, TitanOperationStatus> getEdgesForNode(GraphNode node, Direction requestedDirection) {
+ public Either<List<Edge>, JanusGraphOperationStatus> getEdgesForNode(GraphNode node, Direction requestedDirection) {
- Either<List<Edge>, TitanOperationStatus> result;
+ Either<List<Edge>, JanusGraphOperationStatus> result;
ImmutablePair<String, Object> keyValueId = node.getKeyValueId();
- Either<TitanVertex, TitanOperationStatus> eitherVertex = getVertexByProperty(keyValueId.getKey(), keyValueId.getValue());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> eitherVertex = getVertexByProperty(keyValueId.getKey(), keyValueId.getValue());
if (eitherVertex.isLeft()) {
List<Edge> edges = prepareEdgesList(eitherVertex.left().value(), requestedDirection);
@@ -534,7 +534,7 @@
private List<Edge> prepareEdgesList(Vertex vertex, Direction requestedDirection) {
List<Edge> edges = new ArrayList<>();
- Iterator<TitanEdge> edgesItr = ((TitanVertex) vertex).query().edges().iterator();
+ Iterator<JanusGraphEdge> edgesItr = ((JanusGraphVertex) vertex).query().edges().iterator();
while (edgesItr.hasNext()) {
Edge edge = edgesItr.next();
Direction currEdgeDirection = getEdgeDirection(vertex, edge);
@@ -566,14 +566,14 @@
* @param properties
* @return
*/
- public Either<GraphRelation, TitanOperationStatus> updateRelation(GraphNode from, GraphNode to, GraphEdgeLabels label, Map<String, Object> properties) {
+ public Either<GraphRelation, JanusGraphOperationStatus> updateRelation(GraphNode from, GraphNode to, GraphEdgeLabels label, Map<String, Object> properties) {
log.debug("try to update relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId());
return updateEdge(label.getProperty(), from.getKeyValueId(), to.getKeyValueId(), from.getLabel(), to.getLabel(), properties);
}
- private Either<GraphRelation, TitanOperationStatus> updateEdge(String type, ImmutablePair<String, Object> from, ImmutablePair<String, Object> to, String fromLabel, String toLabel, Map<String, Object> properties) {
+ private Either<GraphRelation, JanusGraphOperationStatus> updateEdge(String type, ImmutablePair<String, Object> from, ImmutablePair<String, Object> to, String fromLabel, String toLabel, Map<String, Object> properties) {
- Either<Edge, TitanOperationStatus> edgeS = getEdgeByVerticies(from.getKey(), from.getValue(), to.getKey(), to.getValue(), type);
+ Either<Edge, JanusGraphOperationStatus> edgeS = getEdgeByVerticies(from.getKey(), from.getValue(), to.getKey(), to.getValue(), type);
if (edgeS.isLeft()) {
try {
@@ -597,7 +597,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed to update relation from [{}] to [{}] ", from, to, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
if (log.isDebugEnabled()) {
@@ -612,7 +612,7 @@
* @param relation
* @return
*/
- public Either<GraphRelation, TitanOperationStatus> updateRelation(GraphRelation relation) {
+ public Either<GraphRelation, JanusGraphOperationStatus> updateRelation(GraphRelation relation) {
log.debug("try to update relation from [{}] to [{}]", relation.getFrom(), relation.getTo());
RelationEndPoint from = relation.getFrom();
RelationEndPoint to = relation.getTo();
@@ -623,17 +623,17 @@
}
- private Either<Vertex, TitanOperationStatus> getVertexByPropertyAndLabel(String name, Object value, String label) {
+ private Either<Vertex, JanusGraphOperationStatus> getVertexByPropertyAndLabel(String name, Object value, String label) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertecies = tGraph.query().has(name, value).has(GraphPropertiesDictionary.LABEL.getProperty(), label).vertices();
+ Iterable<JanusGraphVertex> vertecies = tGraph.query().has(name, value).has(GraphPropertiesDictionary.LABEL.getProperty(), label).vertices();
- java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ java.util.Iterator<JanusGraphVertex> iterator = vertecies.iterator();
if (iterator.hasNext()) {
Vertex vertex = iterator.next();
return Either.left(vertex);
@@ -641,12 +641,12 @@
if (log.isDebugEnabled()) {
log.debug("No vertex in graph for key =" + name + " and value = " + value + " label = " + label);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Failed to get vertex in graph for key ={} and value = {} label = {}",name,value,label);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -657,37 +657,37 @@
}
}
- public Either<TitanVertex, TitanOperationStatus> getVertexByProperty(String name, Object value) {
+ public Either<JanusGraphVertex, JanusGraphOperationStatus> getVertexByProperty(String name, Object value) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (value == null) {
if (log.isDebugEnabled()) {
log.debug("No vertex in graph for key = {} and value = {}", name, value);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertecies = tGraph.query().has(name, value).vertices();
+ Iterable<JanusGraphVertex> vertecies = tGraph.query().has(name, value).vertices();
- java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ java.util.Iterator<JanusGraphVertex> iterator = vertecies.iterator();
if (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
return Either.left(vertex);
} else {
if (log.isDebugEnabled()) {
log.debug("No vertex in graph for key ={} and value = {}", name, value);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Failed to get vertex in graph for key = {} and value = ", name, value);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
if (log.isDebugEnabled()) {
@@ -697,13 +697,13 @@
}
}
- public <T extends GraphNode> Either<List<T>, TitanOperationStatus> getByCriteria(NodeTypeEnum type, Map<String, Object> hasProps, Map<String, Object> hasNotProps, Class<T> clazz) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public <T extends GraphNode> Either<List<T>, JanusGraphOperationStatus> getByCriteria(NodeTypeEnum type, Map<String, Object> hasProps, Map<String, Object> hasNotProps, Class<T> clazz) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
query = query.has(GraphPropertiesDictionary.LABEL.getProperty(), type.getName());
if (hasProps != null && !hasProps.isEmpty()) {
@@ -716,12 +716,12 @@
query = query.hasNot(entry.getKey(), entry.getValue());
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
@@ -736,7 +736,7 @@
log.debug("Number of fetced nodes in graph for criteria : from type = {} and properties has = {}, properties hasNot = {} is {}", type, hasProps, hasNotProps, result.size());
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(result);
@@ -744,7 +744,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed get by criteria for type = {}", type, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -755,13 +755,13 @@
}
}
- public <T extends GraphNode> Either<List<T>, TitanOperationStatus> getByCriteria(NodeTypeEnum type, Class<T> clazz, List<ImmutableTriple<QueryType, String, Object>> props) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public <T extends GraphNode> Either<List<T>, JanusGraphOperationStatus> getByCriteria(NodeTypeEnum type, Class<T> clazz, List<ImmutableTriple<QueryType, String, Object>> props) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
query = query.has(GraphPropertiesDictionary.LABEL.getProperty(), type.getName());
for (ImmutableTriple<QueryType, String, Object> prop : props) {
if (QueryType.HAS.equals(prop.getLeft())) {
@@ -770,12 +770,12 @@
query = query.hasNot(prop.getMiddle(), prop.getRight());
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
@@ -787,7 +787,7 @@
result.add(element);
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(result);
@@ -795,7 +795,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed get by criteria for type = {}", type, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -806,13 +806,13 @@
}
}
- public <T extends GraphNode> Either<List<T>, TitanOperationStatus> getByCriteria(NodeTypeEnum type, Map<String, Object> props, Class<T> clazz) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public <T extends GraphNode> Either<List<T>, JanusGraphOperationStatus> getByCriteria(NodeTypeEnum type, Map<String, Object> props, Class<T> clazz) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
query = query.has(GraphPropertiesDictionary.LABEL.getProperty(), type.getName());
if (props != null && !props.isEmpty()) {
@@ -820,12 +820,12 @@
query = query.has(entry.getKey(), entry.getValue());
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
@@ -840,7 +840,7 @@
log.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size());
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(result);
@@ -848,7 +848,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -859,30 +859,30 @@
}
}
- public <T extends GraphNode> Either<List<T>, TitanOperationStatus> getByCriteriaWithPredicate(NodeTypeEnum type, Map<String, Entry<TitanPredicate, Object>> props, Class<T> clazz) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public <T extends GraphNode> Either<List<T>, JanusGraphOperationStatus> getByCriteriaWithPredicate(NodeTypeEnum type, Map<String, Entry<JanusGraphPredicate, Object>> props, Class<T> clazz) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
query = query.has(GraphPropertiesDictionary.LABEL.getProperty(), type.getName());
if (props != null && !props.isEmpty()) {
- TitanPredicate predicate = null;
+ JanusGraphPredicate predicate = null;
Object object = null;
- for (Map.Entry<String, Entry<TitanPredicate, Object>> entry : props.entrySet()) {
+ for (Map.Entry<String, Entry<JanusGraphPredicate, Object>> entry : props.entrySet()) {
predicate = entry.getValue().getKey();
object = entry.getValue().getValue();
query = query.has(entry.getKey(), predicate, object);
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
@@ -893,7 +893,7 @@
result.add(element);
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
if (log.isDebugEnabled()) {
log.debug("No nodes in graph for criteria : from type = {} and properties = {}", type, props);
@@ -903,7 +903,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -914,7 +914,7 @@
}
}
- public <T extends GraphNode> Either<List<T>, TitanOperationStatus> getAll(NodeTypeEnum type, Class<T> clazz) {
+ public <T extends GraphNode> Either<List<T>, JanusGraphOperationStatus> getAll(NodeTypeEnum type, Class<T> clazz) {
return getByCriteria(type, null, clazz);
}
@@ -924,11 +924,11 @@
* @param clazz
* @return
*/
- public <T extends GraphNode> Either<T, TitanOperationStatus> updateNode(GraphNode node, Class<T> clazz) {
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> updateNode(GraphNode node, Class<T> clazz) {
log.debug("Try to update node for {}", node.getKeyValueId());
ImmutablePair<String, Object> keyValueId = node.getKeyValueId();
- Either<Vertex, TitanOperationStatus> vertexByProperty = getVertexByPropertyAndLabel(keyValueId.getKey(), keyValueId.getValue(), node.getLabel());
+ Either<Vertex, JanusGraphOperationStatus> vertexByProperty = getVertexByPropertyAndLabel(keyValueId.getKey(), keyValueId.getValue(), node.getLabel());
if (vertexByProperty.isLeft()) {
try {
@@ -942,7 +942,7 @@
}
}
- Either<Vertex, TitanOperationStatus> vertexByPropertyAndLabel = getVertexByPropertyAndLabel(keyValueId.getKey(), keyValueId.getValue(), node.getLabel());
+ Either<Vertex, JanusGraphOperationStatus> vertexByPropertyAndLabel = getVertexByPropertyAndLabel(keyValueId.getKey(), keyValueId.getValue(), node.getLabel());
if (vertexByPropertyAndLabel.isRight()) {
return Either.right(vertexByPropertyAndLabel.right().value());
} else {
@@ -954,7 +954,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed to update node for {}", node.getKeyValueId(), e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
if (log.isDebugEnabled()) {
@@ -965,7 +965,7 @@
}
- public TitanOperationStatus updateVertex(GraphNode node, Vertex vertex) {
+ public JanusGraphOperationStatus updateVertex(GraphNode node, Vertex vertex) {
log.debug("Try to update node for {}", node.getKeyValueId());
try {
@@ -981,9 +981,9 @@
if (log.isDebugEnabled()) {
log.debug("Failed to update node for {}", node.getKeyValueId(), e);
}
- return TitanGraphClient.handleTitanException(e);
+ return JanusGraphClient.handleJanusGraphException(e);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@@ -993,7 +993,7 @@
* @param clazz
* @return
*/
- public <T extends GraphNode> Either<T, TitanOperationStatus> deleteNode(GraphNode node, Class<T> clazz) {
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> deleteNode(GraphNode node, Class<T> clazz) {
log.debug("Try to delete node for {}", node.getKeyValueId());
ImmutablePair<String, Object> keyValueId = node.getKeyValueId();
return deleteNode(keyValueId.getKey(), keyValueId.getValue(), clazz);
@@ -1006,8 +1006,8 @@
* @param clazz
* @return
*/
- public <T extends GraphNode> Either<T, TitanOperationStatus> deleteNode(String keyName, Object keyValue, Class<T> clazz) {
- Either<TitanVertex, TitanOperationStatus> vertexByProperty = getVertexByProperty(keyName, keyValue);
+ public <T extends GraphNode> Either<T, JanusGraphOperationStatus> deleteNode(String keyName, Object keyValue, Class<T> clazz) {
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexByProperty = getVertexByProperty(keyName, keyValue);
if (vertexByProperty.isLeft()) {
try {
@@ -1019,9 +1019,9 @@
T node = GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties, clazz);
if (node != null) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
vertex.remove();
} else {
return Either.right(graph.right().value());
@@ -1031,19 +1031,19 @@
if (log.isDebugEnabled()) {
log.debug("Failed to delete node for {} = {} Missing label property on node", keyName, keyValue);
}
- return Either.right(TitanOperationStatus.MISSING_NODE_LABEL);
+ return Either.right(JanusGraphOperationStatus.MISSING_NODE_LABEL);
}
} else {
if (log.isDebugEnabled()) {
log.debug("Failed to delete node for {} = {} Missing label property on node", keyName, keyValue);
}
- return Either.right(TitanOperationStatus.MISSING_NODE_LABEL);
+ return Either.right(JanusGraphOperationStatus.MISSING_NODE_LABEL);
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Failed to delete node for {} = {}", keyName, keyValue, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -1051,7 +1051,7 @@
}
}
- public Either<GraphRelation, TitanOperationStatus> deleteRelation(GraphRelation relation) {
+ public Either<GraphRelation, JanusGraphOperationStatus> deleteRelation(GraphRelation relation) {
log.debug("try to delete relation from [{}] to [{}]", relation.getFrom(), relation.getTo());
RelationEndPoint from = relation.getFrom();
RelationEndPoint to = relation.getTo();
@@ -1062,21 +1062,21 @@
}
- public Either<Boolean, TitanOperationStatus> isRelationExist(GraphNode from, GraphNode to, GraphEdgeLabels edgeLabel) {
+ public Either<Boolean, JanusGraphOperationStatus> isRelationExist(GraphNode from, GraphNode to, GraphEdgeLabels edgeLabel) {
return getEdgeByNodes(from, to, edgeLabel)
.left()
.map(edge -> true)
.right()
- .bind(err -> err == TitanOperationStatus.NOT_FOUND ? Either.left(false): Either.right(err));
+ .bind(err -> err == JanusGraphOperationStatus.NOT_FOUND ? Either.left(false): Either.right(err));
}
- public Either<GraphRelation, TitanOperationStatus> deleteRelation(GraphNode from, GraphNode to, GraphEdgeLabels label) {
+ public Either<GraphRelation, JanusGraphOperationStatus> deleteRelation(GraphNode from, GraphNode to, GraphEdgeLabels label) {
log.debug("try to delete relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId());
return deleteEdge(label.getProperty(), from.getKeyValueId(), to.getKeyValueId(), from.getLabel(), to.getLabel());
}
- private Either<GraphRelation, TitanOperationStatus> deleteEdge(String type, ImmutablePair<String, Object> fromKeyId, ImmutablePair<String, Object> toKeyId, String fromLabel, String toLabel) {
- Either<Edge, TitanOperationStatus> edgeS = getEdgeByVerticies(fromKeyId.getKey(), fromKeyId.getValue(), toKeyId.getKey(), toKeyId.getValue(), type);
+ private Either<GraphRelation, JanusGraphOperationStatus> deleteEdge(String type, ImmutablePair<String, Object> fromKeyId, ImmutablePair<String, Object> toKeyId, String fromLabel, String toLabel) {
+ Either<Edge, JanusGraphOperationStatus> edgeS = getEdgeByVerticies(fromKeyId.getKey(), fromKeyId.getValue(), toKeyId.getKey(), toKeyId.getValue(), type);
if (edgeS.isLeft()) {
try {
Edge edge = edgeS.left().value();
@@ -1089,7 +1089,7 @@
GraphRelation newRelation = GraphElementFactory.createRelation(edge.label(), getProperties(edge), nodeOut, nodeIn);
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
edge.remove();
@@ -1105,7 +1105,7 @@
if (log.isDebugEnabled()) {
log.debug("Failed to delete relation {} from {} to {}", type, fromKeyId, toKeyId, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
if (log.isDebugEnabled()) {
@@ -1115,11 +1115,11 @@
}
}
- public void setTitanGraphClient(TitanGraphClient titanGraphClient) {
- this.titanClient = titanGraphClient;
+ public void setJanusGraphClient(JanusGraphClient janusGraphClient) {
+ this.janusGraphClient = janusGraphClient;
}
- public Either<GraphRelation, TitanOperationStatus> deleteIncomingRelation(GraphRelation relation) {
+ public Either<GraphRelation, JanusGraphOperationStatus> deleteIncomingRelation(GraphRelation relation) {
RelationEndPoint to = relation.getTo();
ImmutablePair<String, Object> toKeyId = new ImmutablePair<>(to.getIdName(), to.getIdValue());
@@ -1128,12 +1128,12 @@
}
- private Either<GraphRelation, TitanOperationStatus> deleteIncomingEdge(String type, ImmutablePair<String, Object> toKeyId) {
+ private Either<GraphRelation, JanusGraphOperationStatus> deleteIncomingEdge(String type, ImmutablePair<String, Object> toKeyId) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
- Either<TitanVertex, TitanOperationStatus> rootVertexResult = getVertexByProperty(toKeyId.getKey(), toKeyId.getValue());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> rootVertexResult = getVertexByProperty(toKeyId.getKey(), toKeyId.getValue());
if (rootVertexResult.isLeft()) {
Vertex rootVertex = rootVertexResult.left().value();
Iterator<Edge> edgesIterator = rootVertex.edges(Direction.IN, type);
@@ -1144,10 +1144,10 @@
if (edgesIterator.hasNext()) {
edge = edgesIterator.next();
if (edgesIterator.hasNext()) {
- return Either.right(TitanOperationStatus.MULTIPLE_EDGES_WITH_SAME_LABEL);
+ return Either.right(JanusGraphOperationStatus.MULTIPLE_EDGES_WITH_SAME_LABEL);
}
} else {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
log.debug("Find the tail vertex of the edge of type {} to vertex {}", type, toKeyId);
@@ -1166,7 +1166,7 @@
return Either.left(newRelation);
} else {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} else {
@@ -1179,7 +1179,7 @@
}
- public Either<GraphRelation, TitanOperationStatus> deleteOutgoingRelation(GraphRelation relation) {
+ public Either<GraphRelation, JanusGraphOperationStatus> deleteOutgoingRelation(GraphRelation relation) {
RelationEndPoint from = relation.getFrom();
ImmutablePair<String, Object> fromKeyId = new ImmutablePair<>(from.getIdName(), from.getIdValue());
@@ -1188,12 +1188,12 @@
}
- private Either<GraphRelation, TitanOperationStatus> deleteOutgoingEdge(String type, ImmutablePair<String, Object> toKeyId) {
+ private Either<GraphRelation, JanusGraphOperationStatus> deleteOutgoingEdge(String type, ImmutablePair<String, Object> toKeyId) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
- Either<TitanVertex, TitanOperationStatus> rootVertexResult = getVertexByProperty(toKeyId.getKey(), toKeyId.getValue());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> rootVertexResult = getVertexByProperty(toKeyId.getKey(), toKeyId.getValue());
if (rootVertexResult.isLeft()) {
Vertex rootVertex = rootVertexResult.left().value();
Iterator<Edge> edgesIterator = rootVertex.edges(Direction.OUT, type);
@@ -1204,10 +1204,10 @@
if (edgesIterator.hasNext()) {
edge = edgesIterator.next();
if (edgesIterator.hasNext()) {
- return Either.right(TitanOperationStatus.MULTIPLE_EDGES_WITH_SAME_LABEL);
+ return Either.right(JanusGraphOperationStatus.MULTIPLE_EDGES_WITH_SAME_LABEL);
}
} else {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
log.debug("Find the tail vertex of the edge of type {} to vertex ", type, toKeyId);
@@ -1226,7 +1226,7 @@
return Either.left(newRelation);
} else {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} else {
@@ -1244,34 +1244,34 @@
* @return
*/
- public TitanOperationStatus lockElement(String id, NodeTypeEnum type) {
+ public JanusGraphOperationStatus lockElement(String id, NodeTypeEnum type) {
StringBuffer lockId = new StringBuffer(LOCK_NODE_PREFIX);
lockId.append(type.getName()).append("_").append(id);
return lockNode(lockId.toString());
}
- public TitanOperationStatus lockElement(GraphNode node) {
+ public JanusGraphOperationStatus lockElement(GraphNode node) {
StringBuffer lockId = createLockElementId(node);
return lockNode(lockId.toString());
}
- private TitanOperationStatus lockNode(String lockId) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ private JanusGraphOperationStatus lockNode(String lockId) {
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
GraphNodeLock lockNode = new GraphNodeLock(lockId);
- Either<GraphNodeLock, TitanOperationStatus> lockNodeNew = createNode(lockNode, GraphNodeLock.class);
+ Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew = createNode(lockNode, GraphNodeLock.class);
if (lockNodeNew.isLeft()) {
log.debug("before commit, Lock node created for {}", lockId);
- return titanClient.commit();
+ return janusGraphClient.commit();
} else {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
- TitanGraph tGraph = graph.left().value();
- Either<TitanVertex, TitanOperationStatus> vertex = getVertexByProperty(lockNode.getUniqueIdKey(), lockNode.getUniqueId());
+ JanusGraph tGraph = graph.left().value();
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertex = getVertexByProperty(lockNode.getUniqueIdKey(), lockNode.getUniqueId());
if (vertex.isLeft()) {
status = relockNode(lockNode, lockNodeNew, tGraph, vertex);
} else {
@@ -1284,45 +1284,45 @@
return status;
}
- private TitanOperationStatus relockNode(GraphNodeLock lockNode, Either<GraphNodeLock, TitanOperationStatus> lockNodeNew, TitanGraph tGraph, Either<TitanVertex, TitanOperationStatus> vertex) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ private JanusGraphOperationStatus relockNode(GraphNodeLock lockNode, Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew, JanusGraph tGraph, Either<JanusGraphVertex, JanusGraphOperationStatus> vertex) {
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
Long time = vertex.left().value().value(GraphPropertiesDictionary.CREATION_DATE.getProperty());
- Long lockTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanLockTimeout();
+ Long lockTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphLockTimeout();
if (time + lockTimeout * 1000 < System.currentTimeMillis()) {
log.debug("Found not released lock node with id {}", lockNode.getUniqueId());
vertex.left().value().remove();
lockNodeNew = createNode(lockNode, GraphNodeLock.class);
if (lockNodeNew.isLeft()) {
log.debug("Lock node created for {}", lockNode.getUniqueIdKey());
- return titanClient.commit();
+ return janusGraphClient.commit();
} else {
log.debug("Failed Lock node for {} . Commit transacton for deleted previous vertex .", lockNode.getUniqueIdKey());
- titanClient.commit();
+ janusGraphClient.commit();
status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
} else {
log.debug("Failed Lock node for {} rollback transacton", lockNode.getUniqueIdKey());
- titanClient.rollback();
+ janusGraphClient.rollback();
status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
return status;
}
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
List<ImmutablePair<T, GraphEdge>> immutablePairs = new ArrayList<>();
- Either<TitanGraph, TitanOperationStatus> graphRes = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphRes = janusGraphClient.getGraph();
if (graphRes.isRight()) {
log.error(FAILED_TO_RETRIEVE_GRAPH_STATUS_IS, graphRes);
return Either.right(graphRes.right().value());
}
- TitanGraph titanGraph = graphRes.left().value();
+ JanusGraph janusGraph = graphRes.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = titanGraph.query().has(key, uniqueId).vertices();
+ Iterable<JanusGraphVertex> vertices = janusGraph.query().has(key, uniqueId).vertices();
if (vertices == null || !vertices.iterator().hasNext()) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
Vertex rootVertex = vertices.iterator().next();
@@ -1349,28 +1349,28 @@
}
if (immutablePairs.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(immutablePairs);
}
- public Either<List<ImmutablePair<TitanVertex, Edge>>, TitanOperationStatus> getChildrenVertecies(String key, String uniqueId, GraphEdgeLabels edgeType) {
+ public Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> getChildrenVertecies(String key, String uniqueId, GraphEdgeLabels edgeType) {
- List<ImmutablePair<TitanVertex, Edge>> immutablePairs = new ArrayList<>();
+ List<ImmutablePair<JanusGraphVertex, Edge>> immutablePairs = new ArrayList<>();
- Either<TitanGraph, TitanOperationStatus> graphRes = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphRes = janusGraphClient.getGraph();
if (graphRes.isRight()) {
log.error(FAILED_TO_RETRIEVE_GRAPH_STATUS_IS, graphRes);
return Either.right(graphRes.right().value());
}
- TitanGraph titanGraph = graphRes.left().value();
+ JanusGraph janusGraph = graphRes.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = titanGraph.query().has(key, uniqueId).vertices();
+ Iterable<JanusGraphVertex> vertices = janusGraph.query().has(key, uniqueId).vertices();
if (vertices == null || !vertices.iterator().hasNext()) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
Vertex rootVertex = vertices.iterator().next();
@@ -1379,30 +1379,31 @@
if (edgesCreatorIterator != null) {
while (edgesCreatorIterator.hasNext()) {
Edge edge = edgesCreatorIterator.next();
- TitanVertex vertex = (TitanVertex) edge.inVertex();
+ JanusGraphVertex vertex = (JanusGraphVertex) edge.inVertex();
- ImmutablePair<TitanVertex, Edge> immutablePair = new ImmutablePair<>(vertex, edge);
+ ImmutablePair<JanusGraphVertex, Edge> immutablePair = new ImmutablePair<>(vertex, edge);
immutablePairs.add(immutablePair);
}
}
if (immutablePairs.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(immutablePairs);
}
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
return this.getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz, true);
}
- private TitanOperationStatus checkLockError(String lockId, Either<GraphNodeLock, TitanOperationStatus> lockNodeNew) {
- TitanOperationStatus status;
- TitanOperationStatus error = lockNodeNew.right().value();
+ private JanusGraphOperationStatus checkLockError(String lockId, Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew) {
+ JanusGraphOperationStatus status;
+ JanusGraphOperationStatus error = lockNodeNew.right().value();
log.debug("Failed to Lock node for {} error = {}", lockId, error);
- if (error.equals(TitanOperationStatus.TITAN_SCHEMA_VIOLATION) || error.equals(TitanOperationStatus.ILLEGAL_ARGUMENT)) {
- status = TitanOperationStatus.ALREADY_LOCKED;
+ if (error.equals(JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION) || error.equals(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT)) {
+ status = JanusGraphOperationStatus.ALREADY_LOCKED;
} else {
status = error;
}
@@ -1414,28 +1415,28 @@
* @param node
* @return
*/
- public TitanOperationStatus releaseElement(GraphNode node) {
+ public JanusGraphOperationStatus releaseElement(GraphNode node) {
StringBuffer lockId = createLockElementId(node);
return unlockNode(lockId);
}
- private TitanOperationStatus unlockNode(StringBuffer lockId) {
+ private JanusGraphOperationStatus unlockNode(StringBuffer lockId) {
GraphNodeLock lockNode = new GraphNodeLock(lockId.toString());
- Either<GraphNodeLock, TitanOperationStatus> lockNodeNew = deleteNode(lockNode, GraphNodeLock.class);
+ Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew = deleteNode(lockNode, GraphNodeLock.class);
if (lockNodeNew.isLeft()) {
log.debug("Lock node released for lock id = {}", lockId);
- return titanClient.commit();
+ return janusGraphClient.commit();
} else {
- titanClient.rollback();
- TitanOperationStatus error = lockNodeNew.right().value();
+ janusGraphClient.rollback();
+ JanusGraphOperationStatus error = lockNodeNew.right().value();
log.debug("Failed to Release node for lock id {} error = {}", lockId, error);
return error;
}
}
- public TitanOperationStatus releaseElement(String id, NodeTypeEnum type) {
+ public JanusGraphOperationStatus releaseElement(String id, NodeTypeEnum type) {
StringBuffer lockId = new StringBuffer(LOCK_NODE_PREFIX);
lockId.append(type.getName()).append("_").append(id);
return unlockNode(lockId);
@@ -1447,9 +1448,9 @@
return lockId;
}
- public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, TitanOperationStatus> getChild(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> getChild(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> childrenNodes = getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
if (childrenNodes.isRight()) {
return Either.right(childrenNodes.right().value());
@@ -1458,43 +1459,43 @@
List<ImmutablePair<T, GraphEdge>> value = childrenNodes.left().value();
if (value.size() > 1) {
- return Either.right(TitanOperationStatus.MULTIPLE_CHILDS_WITH_SAME_EDGE);
+ return Either.right(JanusGraphOperationStatus.MULTIPLE_CHILDS_WITH_SAME_EDGE);
}
return Either.left(value.get(0));
}
- public ImmutablePair<TitanVertex, Edge> getChildVertex(TitanVertex vertex, GraphEdgeLabels edgeType) {
+ public ImmutablePair<JanusGraphVertex, Edge> getChildVertex(JanusGraphVertex vertex, GraphEdgeLabels edgeType) {
- ImmutablePair<TitanVertex, Edge> pair = null;
+ ImmutablePair<JanusGraphVertex, Edge> pair = null;
Iterator<Edge> edges = vertex.edges(Direction.OUT, edgeType.getProperty());
if (edges.hasNext()) {
// get only first edge
Edge edge = edges.next();
- pair = new ImmutablePair<>((TitanVertex) edge.inVertex(), edge);
+ pair = new ImmutablePair<>((JanusGraphVertex) edge.inVertex(), edge);
}
return pair;
}
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> getParentNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getParentNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
List<ImmutablePair<T, GraphEdge>> immutablePairs = new ArrayList<>();
T data = null;
GraphEdge graphEdge = null;
- Either<TitanGraph, TitanOperationStatus> graphRes = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphRes = janusGraphClient.getGraph();
if (graphRes.isRight()) {
log.error(FAILED_TO_RETRIEVE_GRAPH_STATUS_IS, graphRes);
return Either.right(graphRes.right().value());
}
- TitanGraph titanGraph = graphRes.left().value();
+ JanusGraph janusGraph = graphRes.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = titanGraph.query().has(key, uniqueId).vertices();
+ Iterable<JanusGraphVertex> vertices = janusGraph.query().has(key, uniqueId).vertices();
if (vertices == null || !vertices.iterator().hasNext()) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
Vertex rootVertex = vertices.iterator().next();
@@ -1517,16 +1518,16 @@
}
if (immutablePairs.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(immutablePairs);
}
- public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, TitanOperationStatus> getParentNode(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> getParentNode(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> parentNodesRes = this.getParentNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> parentNodesRes = this.getParentNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
if (parentNodesRes.isRight()) {
log.debug("failed to get edge key:{} uniqueId:{} edgeType {} nodeTypeEnum: {}, reason:{}", key, uniqueId, edgeType, nodeTypeEnum, parentNodesRes.right().value());
@@ -1536,17 +1537,17 @@
List<ImmutablePair<T, GraphEdge>> value = parentNodesRes.left().value();
if (value.size() > 1) {
- return Either.right(TitanOperationStatus.MULTIPLE_CHILDS_WITH_SAME_EDGE);
+ return Either.right(JanusGraphOperationStatus.MULTIPLE_CHILDS_WITH_SAME_EDGE);
}
return Either.left(value.get(0));
}
- public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, TitanOperationStatus> getChildByEdgeCriteria(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, Map<String, Object> edgeProperties) {
+ public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> getChildByEdgeCriteria(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, Map<String, Object> edgeProperties) {
- Either<Edge, TitanOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgeByCriteria(key, uniqueId, edgeType, edgeProperties);
+ Either<Edge, JanusGraphOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgeByCriteria(key, uniqueId, edgeType, edgeProperties);
if (outgoingEdgeByCriteria.isRight()) {
- TitanOperationStatus status = outgoingEdgeByCriteria.right().value();
+ JanusGraphOperationStatus status = outgoingEdgeByCriteria.right().value();
log.debug("Cannot find outgoing edge from vertex {} with label {} and properties {}" + uniqueId, edgeType, edgeProperties);
return Either.right(status);
}
@@ -1565,30 +1566,30 @@
return Either.left(immutablePair);
}
- public Either<ImmutablePair<TitanVertex, Edge>, TitanOperationStatus> getChildByEdgeCriteria(TitanVertex vertex, GraphEdgeLabels edgeType, Map<String, Object> edgeProperties) {
+ public Either<ImmutablePair<JanusGraphVertex, Edge>, JanusGraphOperationStatus> getChildByEdgeCriteria(JanusGraphVertex vertex, GraphEdgeLabels edgeType, Map<String, Object> edgeProperties) {
- Either<Edge, TitanOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgeByCriteria(vertex, edgeType, edgeProperties);
+ Either<Edge, JanusGraphOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgeByCriteria(vertex, edgeType, edgeProperties);
if (outgoingEdgeByCriteria.isRight()) {
- TitanOperationStatus status = outgoingEdgeByCriteria.right().value();
+ JanusGraphOperationStatus status = outgoingEdgeByCriteria.right().value();
log.debug("Cannot find outgoing edge from vertex {} with label {} and properties {}", vertex, edgeType, edgeProperties);
return Either.right(status);
}
Edge edge = outgoingEdgeByCriteria.left().value();
- TitanVertex outgoingVertex = (TitanVertex) edge.inVertex();
+ JanusGraphVertex outgoingVertex = (JanusGraphVertex) edge.inVertex();
- ImmutablePair<TitanVertex, Edge> immutablePair = new ImmutablePair<>(outgoingVertex, edge);
+ ImmutablePair<JanusGraphVertex, Edge> immutablePair = new ImmutablePair<>(outgoingVertex, edge);
return Either.left(immutablePair);
}
- public Either<Edge, TitanOperationStatus> getOutgoingEdgeByCriteria(String key, String value, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<Edge, JanusGraphOperationStatus> getOutgoingEdgeByCriteria(String key, String value, GraphEdgeLabels label, Map<String, Object> props) {
- Either<TitanVertex, TitanOperationStatus> vertexFrom = getVertexByProperty(key, value);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexFrom = getVertexByProperty(key, value);
if (vertexFrom.isRight()) {
- TitanOperationStatus status = vertexFrom.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ JanusGraphOperationStatus status = vertexFrom.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
return Either.right(status);
}
@@ -1596,9 +1597,9 @@
return getOutgoingEdgeByCriteria(vertexFrom.left().value(), label, props);
}
- public Either<Edge, TitanOperationStatus> getOutgoingEdgeByCriteria(TitanVertex vertex, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<Edge, JanusGraphOperationStatus> getOutgoingEdgeByCriteria(JanusGraphVertex vertex, GraphEdgeLabels label, Map<String, Object> props) {
- TitanVertexQuery<?> query = vertex.query();
+ JanusGraphVertexQuery<?> query = vertex.query();
query = query.direction(Direction.OUT).labels(label.getProperty());
if (props != null && !props.isEmpty()) {
@@ -1607,40 +1608,40 @@
}
}
Edge matchingEdge = null;
- Iterable<TitanEdge> edges = query.edges();
+ Iterable<JanusGraphEdge> edges = query.edges();
if (edges == null) {
log.debug(NO_EDGES_IN_GRAPH_FOR_CRITERIA);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
if (eIter.hasNext()) {
matchingEdge = eIter.next();
}
if (matchingEdge == null) {
log.debug(NO_EDGES_IN_GRAPH_FOR_CRITERIA);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(matchingEdge);
}
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> deleteChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> deleteChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) {
List<ImmutablePair<T, GraphEdge>> result = new ArrayList<>();
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> childrenNodesRes = getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> childrenNodesRes = getChildrenNodes(key, uniqueId, edgeType, nodeTypeEnum, clazz);
if (childrenNodesRes.isRight()) {
- TitanOperationStatus status = childrenNodesRes.right().value();
+ JanusGraphOperationStatus status = childrenNodesRes.right().value();
return Either.right(status);
}
List<ImmutablePair<T, GraphEdge>> list = childrenNodesRes.left().value();
for (ImmutablePair<T, GraphEdge> pair : list) {
T node = pair.getKey();
- Either<T, TitanOperationStatus> deleteNodeRes = this.deleteNode(node, clazz);
+ Either<T, JanusGraphOperationStatus> deleteNodeRes = this.deleteNode(node, clazz);
if (deleteNodeRes.isRight()) {
- TitanOperationStatus status = deleteNodeRes.right().value();
+ JanusGraphOperationStatus status = deleteNodeRes.right().value();
log.error("Failed to delete node {} . status is {}", node, status);
return Either.right(status);
}
@@ -1686,8 +1687,8 @@
return result;
}
- public Object getProperty(TitanVertex vertex, String key) {
- PropertyKey propertyKey = titanClient.getGraph().left().value().getPropertyKey(key);
+ public Object getProperty(JanusGraphVertex vertex, String key) {
+ PropertyKey propertyKey = janusGraphClient.getGraph().left().value().getPropertyKey(key);
return vertex.valueOrNull(propertyKey);
}
@@ -1700,14 +1701,14 @@
return value;
}
- public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> getChildrenByEdgeCriteria(Vertex vertex, String vertexUniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz,
- Map<String, Object> edgeProperties) {
+ public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenByEdgeCriteria(Vertex vertex, String vertexUniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz,
+ Map<String, Object> edgeProperties) {
List<ImmutablePair<T, GraphEdge>> result = new ArrayList<>();
- Either<List<Edge>, TitanOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgesByCriteria(vertex, edgeType, edgeProperties);
+ Either<List<Edge>, JanusGraphOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgesByCriteria(vertex, edgeType, edgeProperties);
if (outgoingEdgeByCriteria.isRight()) {
- TitanOperationStatus status = outgoingEdgeByCriteria.right().value();
+ JanusGraphOperationStatus status = outgoingEdgeByCriteria.right().value();
log.debug("Cannot find outgoing edge from vertex {} with label {} and properties {}", vertexUniqueId, edgeType, edgeProperties);
return Either.right(status);
}
@@ -1731,12 +1732,12 @@
return Either.left(result);
}
- public Either<List<Edge>, TitanOperationStatus> getOutgoingEdgesByCriteria(Vertex vertexFrom, GraphEdgeLabels label, Map<String, Object> props) {
+ public Either<List<Edge>, JanusGraphOperationStatus> getOutgoingEdgesByCriteria(Vertex vertexFrom, GraphEdgeLabels label, Map<String, Object> props) {
List<Edge> edgesResult = new ArrayList<>();
- TitanVertex titanVertex = (TitanVertex) vertexFrom;
- TitanVertexQuery<?> query = titanVertex.query();
+ JanusGraphVertex janusGraphVertex = (JanusGraphVertex) vertexFrom;
+ JanusGraphVertexQuery<?> query = janusGraphVertex.query();
query = query.direction(Direction.OUT).labels(label.getProperty());
@@ -1746,11 +1747,11 @@
}
}
- Iterable<TitanEdge> edges = query.edges();
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterable<JanusGraphEdge> edges = query.edges();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
if (edges == null || !eIter.hasNext()) {
log.debug("No edges found in graph for criteria (label = {} properties={})", label.getProperty(), props);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
while (eIter.hasNext()) {
@@ -1760,7 +1761,7 @@
if (edgesResult.isEmpty()) {
log.debug("No edges found in graph for criteria (label = {} properties={})", label.getProperty(), props);
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(edgesResult);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanOperationStatus.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphOperationStatus.java
similarity index 73%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanOperationStatus.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphOperationStatus.java
index dc9ed02..a4ebcf7 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanOperationStatus.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphOperationStatus.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.dao.titan;
+package org.openecomp.sdc.be.dao.janusgraph;
-public enum TitanOperationStatus {
- OK, NOT_CONNECTED, NOT_CREATED, INDEX_CANNOT_BE_CHANGED, NOT_FOUND, MISSING_UNIQUE_ID, MISSING_NODE_LABEL, MULTIPLE_EDGES_WITH_SAME_LABEL, CANNOT_DELETE_NON_LEAF_NODE, MULTIPLE_NODES_WITH_SAME_ID, GRAPH_IS_NOT_AVAILABLE, TITAN_CONFIGURATION, TITAN_SCHEMA_VIOLATION, INVALID_ELEMENT, INVALID_QUERY, INVALID_ID, RESOURCE_UNAVAILABLE, ILLEGAL_ARGUMENT, ALREADY_LOCKED, ALREADY_EXIST, MULTIPLE_CHILDS_WITH_SAME_EDGE, GENERAL_ERROR, MATCH_NOT_FOUND, INVALID_TYPE, PROPERTY_NAME_ALREADY_EXISTS, INVALID_PROPERTY,
+public enum JanusGraphOperationStatus {
+ OK, NOT_CONNECTED, NOT_CREATED, INDEX_CANNOT_BE_CHANGED, NOT_FOUND, MISSING_UNIQUE_ID, MISSING_NODE_LABEL, MULTIPLE_EDGES_WITH_SAME_LABEL, CANNOT_DELETE_NON_LEAF_NODE, MULTIPLE_NODES_WITH_SAME_ID, GRAPH_IS_NOT_AVAILABLE, JANUSGRAPH_CONFIGURATION, JANUSGRAPH_SCHEMA_VIOLATION, INVALID_ELEMENT, INVALID_QUERY, INVALID_ID, RESOURCE_UNAVAILABLE, ILLEGAL_ARGUMENT, ALREADY_LOCKED, ALREADY_EXIST, MULTIPLE_CHILDS_WITH_SAME_EDGE, GENERAL_ERROR, MATCH_NOT_FOUND, INVALID_TYPE, PROPERTY_NAME_ALREADY_EXISTS, INVALID_PROPERTY,
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtils.java
new file mode 100644
index 0000000..fd9856b
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtils.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.be.dao.janusgraph;
+
+import org.janusgraph.graphdb.query.JanusGraphPredicate;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import static org.janusgraph.core.attribute.Contain.NOT_IN;
+import static java.util.Collections.emptyMap;
+import static org.apache.commons.collections.CollectionUtils.isEmpty;
+
+public class JanusGraphUtils {
+
+ private JanusGraphUtils() {
+ }
+
+ public static <T> Map<String, Entry<JanusGraphPredicate, Object>> buildNotInPredicate(String propKey, Collection<T> notInCollection) {
+ if (isEmpty(notInCollection)) {
+ return emptyMap();
+ }
+ Map<String, Entry<JanusGraphPredicate, Object>> predicateCriteria = new HashMap<>();
+ predicateCriteria.put(propKey, new HashMap.SimpleEntry<>(NOT_IN, notInCollection));
+ return predicateCriteria;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/QueryType.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/QueryType.java
similarity index 95%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/QueryType.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/QueryType.java
index 689ed32..fc2f2d0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/QueryType.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/QueryType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.dao.titan;
+package org.openecomp.sdc.be.dao.janusgraph;
/**
* Created by mlando on 9/21/2016.
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/transactions/SimpleJanusGraphTransactionManager.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/transactions/SimpleJanusGraphTransactionManager.java
new file mode 100644
index 0000000..8c67254
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/transactions/SimpleJanusGraphTransactionManager.java
@@ -0,0 +1,70 @@
+package org.openecomp.sdc.be.dao.janusgraph.transactions;
+
+import org.janusgraph.core.JanusGraphException;
+import org.janusgraph.core.JanusGraph;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.common.log.wrappers.Logger;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.TransactionSystemException;
+import org.springframework.transaction.support.SimpleTransactionStatus;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Simple transaction manager for the janusgraph database.
+ * This manager does not deal with transactions propagation and relies on the fact that transactions are automatically created with the first operation on the graph
+ */
+@Component
+public class SimpleJanusGraphTransactionManager implements PlatformTransactionManager {
+
+ private static final Logger log = Logger.getLogger(SimpleJanusGraphTransactionManager.class.getName());
+ private final JanusGraphClient janusGraphClient;
+ private JanusGraph janusGraph;
+
+ public SimpleJanusGraphTransactionManager(JanusGraphClient janusGraphClient) {
+ this.janusGraphClient = janusGraphClient;
+ }
+
+ @PostConstruct
+ public void onInit() {
+ janusGraph = janusGraphClient.getGraph().left().on(this::onFailingToStartJanusGraph);
+ }
+
+ @Override
+ public TransactionStatus getTransaction(TransactionDefinition transactionDefinition) {
+ log.debug("#getTransaction - returning simple transaction status");
+ return new SimpleTransactionStatus();
+ }
+
+ @Override
+ public void commit(TransactionStatus transactionStatus) {
+ log.debug("#commit - committing transaction");
+ try {
+ janusGraph.tx().commit();
+ } catch (JanusGraphException e) {
+ log.debug("#commit - failed to commit transaction", e);
+ throw new TransactionSystemException("failed to commit transaction", e);
+ }
+ }
+
+ @Override
+ public void rollback(TransactionStatus transactionStatus) {
+ log.debug("#rollback - committing transaction");
+ try {
+ janusGraph.tx().rollback();
+ } catch (JanusGraphException e) {
+ log.debug("#rollback - failed to rollback transaction", e);
+ throw new TransactionSystemException("failed to rollback transaction", e);
+ }
+ }
+
+ private JanusGraph onFailingToStartJanusGraph(JanusGraphOperationStatus err) {
+ log.debug("#onFailingToStartJanusGraph - could not open janusgraph client");
+ throw new IllegalStateException("janusgraph could not be initialized: " + err);
+ }
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java
index 7485294..2db22a7 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.dao.jsongraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
@@ -37,7 +37,7 @@
public class GraphVertex {
private String uniqueId;
- private TitanVertex vertex;
+ private JanusGraphVertex vertex;
private VertexTypeEnum label;
private Map<String, ? extends ToscaDataDefinition> json;
@@ -70,11 +70,11 @@
this.json = json;
}
- public TitanVertex getVertex() {
+ public JanusGraphVertex getVertex() {
return vertex;
}
- public void setVertex(TitanVertex vertex) {
+ public void setVertex(JanusGraphVertex vertex) {
this.vertex = vertex;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingTitanDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
similarity index 74%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingTitanDao.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
index fb6b9d8..c2ef659 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingTitanDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
@@ -21,29 +21,29 @@
import java.util.Optional;
import java.util.stream.Collectors;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-@Component("titan-dao")
-public class HealingTitanDao extends TitanDao {
+@Component("janusgraph-dao")
+public class HealingJanusGraphDao extends JanusGraphDao {
@Autowired
private HealingPipelineDao healingPipelineDao;
- public HealingTitanDao(TitanGraphClient titanClient) {
- super(titanClient);
+ public HealingJanusGraphDao(JanusGraphClient janusGraphClient) {
+ super(janusGraphClient);
}
@Override
- public Either<List<GraphVertex>, TitanOperationStatus> getChildrenVertecies(GraphVertex parentVertex,
- EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
- Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies =
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getChildrenVertecies(GraphVertex parentVertex,
+ EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies =
super.getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
return Either.iif(childrenVertecies.isRight(), () -> childrenVertecies.right().value(),
() -> childrenVertecies.left().value().stream()
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
similarity index 69%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
index a31900a..5917b14 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
@@ -20,19 +20,19 @@
package org.openecomp.sdc.be.dao.jsongraph;
-import com.thinkaurelius.titan.core.*;
+import org.janusgraph.core.*;
import fj.data.Either;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.*;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+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.jsongraph.utils.JsonParserUtils;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@@ -40,7 +40,6 @@
import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.*;
@@ -49,28 +48,28 @@
import static org.apache.commons.collections.CollectionUtils.isEmpty;
-public class TitanDao {
- TitanGraphClient titanClient;
+public class JanusGraphDao {
+ JanusGraphClient janusGraphClient;
- private static Logger logger = Logger.getLogger(TitanDao.class.getName());
+ private static Logger logger = Logger.getLogger(JanusGraphDao.class.getName());
- public TitanDao(@Qualifier("titan-client") TitanGraphClient titanClient) {
- this.titanClient = titanClient;
- logger.info("** TitanDao created");
+ public JanusGraphDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) {
+ this.janusGraphClient = janusGraphClient;
+ logger.info("** JanusGraphDao created");
}
- public TitanOperationStatus commit() {
+ public JanusGraphOperationStatus commit() {
logger.debug("#commit - The operation succeeded. Doing commit...");
- return titanClient.commit();
+ return janusGraphClient.commit();
}
- public TitanOperationStatus rollback() {
+ public JanusGraphOperationStatus rollback() {
logger.debug("#rollback - The operation failed. Doing rollback...");
- return titanClient.rollback();
+ return janusGraphClient.rollback();
}
- public Either<TitanGraph, TitanOperationStatus> getGraph() {
- return titanClient.getGraph();
+ public Either<JanusGraph, JanusGraphOperationStatus> getGraph() {
+ return janusGraphClient.getGraph();
}
/**
@@ -78,14 +77,14 @@
* @param graphVertex
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> createVertex(GraphVertex graphVertex) {
+ public Either<GraphVertex, JanusGraphOperationStatus> createVertex(GraphVertex graphVertex) {
logger.trace("try to create vertex for ID [{}]", graphVertex.getUniqueId());
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanVertex vertex = tGraph.addVertex();
+ JanusGraphVertex vertex = tGraph.addVertex();
setVertexProperties(vertex, graphVertex);
@@ -95,7 +94,7 @@
} catch (Exception e) {
logger.debug("Failed to create Node for ID [{}]", graphVertex.getUniqueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
logger.debug("Failed to create vertex for ID [{}] {}", graphVertex.getUniqueId(), graph.right().value());
@@ -110,23 +109,23 @@
* @param label
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label) {
+ public Either<GraphVertex, JanusGraphOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label) {
return getVertexByPropertyAndLabel(name, value, label, JsonParseFlagEnum.ParseAll);
}
- public Either<GraphVertex, TitanOperationStatus> getVertexByLabel(VertexTypeEnum label) {
- return titanClient.getGraph().left().map(graph -> graph.query().has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices()).left().bind(titanVertices -> getFirstFoundVertex(JsonParseFlagEnum.NoParse, titanVertices));
+ public Either<GraphVertex, JanusGraphOperationStatus> getVertexByLabel(VertexTypeEnum label) {
+ return janusGraphClient.getGraph().left().map(graph -> graph.query().has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices()).left().bind(janusGraphVertices -> getFirstFoundVertex(JsonParseFlagEnum.NoParse, janusGraphVertices));
}
- private Either<GraphVertex, TitanOperationStatus> getFirstFoundVertex(JsonParseFlagEnum parseFlag, Iterable<TitanVertex> vertices) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ private Either<GraphVertex, JanusGraphOperationStatus> getFirstFoundVertex(JsonParseFlagEnum parseFlag, Iterable<JanusGraphVertex> vertices) {
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
if (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
GraphVertex graphVertex = createAndFill(vertex, parseFlag);
return Either.left(graphVertex);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
/**
@@ -137,19 +136,19 @@
* @param parseFlag
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label, JsonParseFlagEnum parseFlag) {
+ public Either<GraphVertex, JanusGraphOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label, JsonParseFlagEnum parseFlag) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertecies = tGraph.query().has(name.getProperty(), value).has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices();
+ Iterable<JanusGraphVertex> vertecies = tGraph.query().has(name.getProperty(), value).has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices();
- java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ java.util.Iterator<JanusGraphVertex> iterator = vertecies.iterator();
if (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
GraphVertex graphVertex = createAndFill(vertex, parseFlag);
return Either.left(graphVertex);
@@ -157,12 +156,12 @@
if (logger.isDebugEnabled()) {
logger.debug("No vertex in graph for key = {} and value = {} label = {}" + name, value, label);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to get vertex in graph for key ={} and value = {} label = {}", name, value, label);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -178,7 +177,7 @@
* @param id
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> getVertexById(String id) {
+ public Either<GraphVertex, JanusGraphOperationStatus> getVertexById(String id) {
return getVertexById(id, JsonParseFlagEnum.ParseAll);
}
@@ -188,38 +187,38 @@
* @param parseFlag
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> getVertexById(String id, JsonParseFlagEnum parseFlag) {
+ public Either<GraphVertex, JanusGraphOperationStatus> getVertexById(String id, JsonParseFlagEnum parseFlag) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (id == null) {
if (logger.isDebugEnabled()) {
logger.debug("No vertex in graph for id = {} ", id);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertecies = tGraph.query().has(GraphPropertyEnum.UNIQUE_ID.getProperty(), id).vertices();
+ Iterable<JanusGraphVertex> vertecies = tGraph.query().has(GraphPropertyEnum.UNIQUE_ID.getProperty(), id).vertices();
- java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ java.util.Iterator<JanusGraphVertex> iterator = vertecies.iterator();
if (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
GraphVertex graphVertex = createAndFill(vertex, parseFlag);
return Either.left(graphVertex);
} else {
if (logger.isDebugEnabled()) {
logger.debug("No vertex in graph for id = {}", id);
}
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to get vertex in graph for id {} ", id);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
if (logger.isDebugEnabled()) {
@@ -229,7 +228,7 @@
}
}
- private void setVertexProperties(TitanVertex vertex, GraphVertex graphVertex) throws IOException {
+ private void setVertexProperties(JanusGraphVertex vertex, GraphVertex graphVertex) throws IOException {
if (graphVertex.getMetadataProperties() != null) {
for (Map.Entry<GraphPropertyEnum, Object> entry : graphVertex.getMetadataProperties().entrySet()) {
@@ -261,7 +260,7 @@
}
}
- private GraphVertex createAndFill(TitanVertex vertex, JsonParseFlagEnum parseFlag) {
+ private GraphVertex createAndFill(JanusGraphVertex vertex, JsonParseFlagEnum parseFlag) {
GraphVertex graphVertex = new GraphVertex();
graphVertex.setVertex(vertex);
parseVertexProperties(graphVertex, parseFlag);
@@ -269,7 +268,7 @@
}
public void parseVertexProperties(GraphVertex graphVertex, JsonParseFlagEnum parseFlag) {
- TitanVertex vertex = graphVertex.getVertex();
+ JanusGraphVertex vertex = graphVertex.getVertex();
Map<GraphPropertyEnum, Object> properties = getVertexProperties(vertex);
VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL)));
for (Map.Entry<GraphPropertyEnum, Object> entry : properties.entrySet()) {
@@ -308,30 +307,30 @@
}
}
- public TitanOperationStatus createEdge(GraphVertex from, GraphVertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
+ public JanusGraphOperationStatus createEdge(GraphVertex from, GraphVertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
return createEdge(from.getVertex(), to.getVertex(), label, properties);
}
- public TitanOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
+ public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
if (logger.isTraceEnabled()) {
logger.trace("Try to connect {} with {} label {} properties {}",
from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), label, properties);
}
if (from == null || to == null) {
- logger.trace("No Titan vertex for id from {} or id to {}",
+ logger.trace("No JanusGraph vertex for id from {} or id to {}",
from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
- return TitanOperationStatus.NOT_FOUND;
+ return JanusGraphOperationStatus.NOT_FOUND;
}
Edge edge = from.addEdge(label.name(), to);
- TitanOperationStatus status;
+ JanusGraphOperationStatus status;
try {
setEdgeProperties(edge, properties);
- status = TitanOperationStatus.OK;
+ status = JanusGraphOperationStatus.OK;
} catch (IOException e) {
logger.debug("Failed to set properties on edge properties [{}]", properties, e);
- status = TitanOperationStatus.GENERAL_ERROR;
+ status = JanusGraphOperationStatus.GENERAL_ERROR;
}
return status;
}
@@ -401,17 +400,17 @@
}
}
- public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props) {
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props) {
return getByCriteria(type, props, JsonParseFlagEnum.ParseAll);
}
- public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, JsonParseFlagEnum parseFlag) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, JsonParseFlagEnum parseFlag) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
if (type != null) {
query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName());
}
@@ -421,16 +420,16 @@
query = query.has(entry.getKey().getProperty(), entry.getValue());
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<GraphVertex> result = new ArrayList<>();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
Map<GraphPropertyEnum, Object> newProp = getVertexProperties(vertex);
GraphVertex graphVertex = createAndFill(vertex, parseFlag);
@@ -441,7 +440,7 @@
logger.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size());
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(result);
@@ -449,7 +448,7 @@
if (logger.isDebugEnabled()) {
logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -460,13 +459,13 @@
}
}
- public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, Map<GraphPropertyEnum, Object> hasNotProps, JsonParseFlagEnum parseFlag) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, Map<GraphPropertyEnum, Object> hasNotProps, JsonParseFlagEnum parseFlag) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = tGraph.query();
if (type != null) {
query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName());
}
@@ -485,16 +484,16 @@
}
}
}
- Iterable<TitanVertex> vertices = query.vertices();
+ Iterable<JanusGraphVertex> vertices = query.vertices();
if (vertices == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
List<GraphVertex> result = new ArrayList<>();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
Map<GraphPropertyEnum, Object> newProp = getVertexProperties(vertex);
GraphVertex graphVertex = createAndFill(vertex, parseFlag);
@@ -505,7 +504,7 @@
logger.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size());
}
if (result.size() == 0) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(result);
@@ -513,7 +512,7 @@
if (logger.isDebugEnabled()) {
logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -524,22 +523,22 @@
}
}
- public Either<Iterator<Vertex>, TitanOperationStatus> getCatalogOrArchiveVerticies(boolean isCatalog) {
- Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ public Either<Iterator<Vertex>, JanusGraphOperationStatus> getCatalogOrArchiveVerticies(boolean isCatalog) {
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphClient.getGraph();
if (graph.isLeft()) {
try {
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
String name = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName();
- Iterable<TitanVertex> vCatalogIter = tGraph.query().has(GraphPropertyEnum.LABEL.getProperty(), name).vertices();
+ Iterable<JanusGraphVertex> vCatalogIter = tGraph.query().has(GraphPropertyEnum.LABEL.getProperty(), name).vertices();
if (vCatalogIter == null) {
logger.debug("Failed to fetch catalog vertex");
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
- TitanVertex catalogV = vCatalogIter.iterator().next();
+ JanusGraphVertex catalogV = vCatalogIter.iterator().next();
if (catalogV == null) {
logger.debug("Failed to fetch catalog vertex");
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
String edgeLabel = isCatalog ? EdgeLabelEnum.CATALOG_ELEMENT.name() : EdgeLabelEnum.ARCHIVE_ELEMENT.name();
Iterator<Vertex> vertices = catalogV.vertices(Direction.OUT, edgeLabel);
@@ -549,7 +548,7 @@
if (logger.isDebugEnabled()) {
logger.debug("Failed get by criteria: ", e);
}
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
} else {
@@ -560,7 +559,7 @@
}
}
- private void buildMultipleNegateQueryFromList(Map.Entry<GraphPropertyEnum, Object> entry, TitanGraphQuery query) {
+ private void buildMultipleNegateQueryFromList(Map.Entry<GraphPropertyEnum, Object> entry, JanusGraphQuery query) {
List<Object> negateList = (List<Object>) entry.getValue();
for (Object listItem : negateList) {
query.hasNot(entry.getKey().getProperty(), listItem);
@@ -574,8 +573,8 @@
* @param parseFlag
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> getChildVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
- Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
+ public Either<GraphVertex, JanusGraphOperationStatus> getChildVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies = getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
if (childrenVertecies.isRight()) {
return Either.right(childrenVertecies.right().value());
}
@@ -589,32 +588,32 @@
* @param parseFlag
* @return
*/
- public Either<Vertex, TitanOperationStatus> getChildVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
- Either<List<Vertex>, TitanOperationStatus> childrenVertecies = getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
+ public Either<Vertex, JanusGraphOperationStatus> getChildVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<Vertex>, JanusGraphOperationStatus> childrenVertecies = getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
if (childrenVertecies.isRight()) {
return Either.right(childrenVertecies.right().value());
}
return Either.left(childrenVertecies.left().value().get(0));
}
- public Either<GraphVertex, TitanOperationStatus> getParentVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
- Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = getParentVertecies(parentVertex, edgeLabel, parseFlag);
+ public Either<GraphVertex, JanusGraphOperationStatus> getParentVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies = getParentVertecies(parentVertex, edgeLabel, parseFlag);
if (childrenVertecies.isRight()) {
return Either.right(childrenVertecies.right().value());
}
if (isEmpty(childrenVertecies.left().value())){
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(childrenVertecies.left().value().get(0));
}
- public Either<Vertex, TitanOperationStatus> getParentVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
- Either<List<Vertex>, TitanOperationStatus> childrenVertecies = getParentVertecies(parentVertex, edgeLabel, parseFlag);
+ public Either<Vertex, JanusGraphOperationStatus> getParentVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<Vertex>, JanusGraphOperationStatus> childrenVertecies = getParentVertecies(parentVertex, edgeLabel, parseFlag);
if (childrenVertecies.isRight() ) {
return Either.right(childrenVertecies.right().value());
}
if (isEmpty(childrenVertecies.left().value())){
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
return Either.left(childrenVertecies.left().value().get(0));
}
@@ -626,22 +625,22 @@
* @param parseFlag
* @return
*/
- public Either<List<GraphVertex>, TitanOperationStatus> getChildrenVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getChildrenVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.OUT);
}
- public Either<List<GraphVertex>, TitanOperationStatus> getParentVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getParentVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.IN);
}
- public Either<List<Vertex>, TitanOperationStatus> getParentVertecies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ public Either<List<Vertex>, JanusGraphOperationStatus> getParentVertecies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.IN);
}
- private Either<List<Vertex>, TitanOperationStatus> getAdjacentVerticies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag, Direction direction) {
+ private Either<List<Vertex>, JanusGraphOperationStatus> getAdjacentVerticies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag, Direction direction) {
List<Vertex> list = new ArrayList<>();
try {
- Either<TitanGraph, TitanOperationStatus> graphRes = titanClient.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphRes = janusGraphClient.getGraph();
if (graphRes.isRight()) {
logger.error("Failed to retrieve graph. status is {}", graphRes);
return Either.right(graphRes.right().value());
@@ -650,11 +649,11 @@
if (edgesCreatorIterator != null) {
while (edgesCreatorIterator.hasNext()) {
Edge edge = edgesCreatorIterator.next();
- TitanVertex vertex;
+ JanusGraphVertex vertex;
if (direction == Direction.IN) {
- vertex = (TitanVertex) edge.outVertex();
+ vertex = (JanusGraphVertex) edge.outVertex();
} else {
- vertex = (TitanVertex) edge.inVertex();
+ vertex = (JanusGraphVertex) edge.inVertex();
}
// GraphVertex graphVertex = createAndFill(vertex, parseFlag);
@@ -662,11 +661,11 @@
}
}
if (list.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} catch (Exception e) {
logger.error("Failed to perform graph operation ", e);
- Either.right(TitanGraphClient.handleTitanException(e));
+ Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return Either.left(list);
@@ -679,19 +678,19 @@
* @param parseFlag
* @return
*/
- public Either<List<Vertex>, TitanOperationStatus> getChildrenVertecies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ public Either<List<Vertex>, JanusGraphOperationStatus> getChildrenVertecies(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.OUT);
}
- private Either<List<GraphVertex>, TitanOperationStatus> getAdjacentVerticies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag, Direction direction) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAdjacentVerticies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag, Direction direction) {
List<GraphVertex> list = new ArrayList<>();
- Either<List<Vertex>, TitanOperationStatus> adjacentVerticies = getAdjacentVerticies(parentVertex.getVertex(), edgeLabel, parseFlag, direction);
+ Either<List<Vertex>, JanusGraphOperationStatus> adjacentVerticies = getAdjacentVerticies(parentVertex.getVertex(), edgeLabel, parseFlag, direction);
if (adjacentVerticies.isRight()) {
return Either.right(adjacentVerticies.right().value());
}
adjacentVerticies.left().value().stream().forEach(vertex -> {
- list.add(createAndFill((TitanVertex) vertex, parseFlag));
+ list.add(createAndFill((JanusGraphVertex) vertex, parseFlag));
});
return Either.left(list);
@@ -703,15 +702,15 @@
* @param vertex
* @param label
* @param properties
- * @return found edge or TitanOperationStatus
+ * @return found edge or JanusGraphOperationStatus
*/
- public Either<Edge, TitanOperationStatus> getBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ public Either<Edge, JanusGraphOperationStatus> getBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
- Either<Edge, TitanOperationStatus> result = null;
+ Either<Edge, JanusGraphOperationStatus> result = null;
Edge matchingEdge = null;
String notFoundMsg = "No edges in graph for criteria";
try {
- TitanVertexQuery<?> query = vertex.getVertex().query().labels(label.name());
+ JanusGraphVertexQuery<?> query = vertex.getVertex().query().labels(label.name());
if (properties != null && !properties.isEmpty()) {
for (Map.Entry<GraphPropertyEnum, Object> entry : properties.entrySet()) {
@@ -719,17 +718,17 @@
}
}
- Iterable<TitanEdge> edges = query.edges();
+ Iterable<JanusGraphEdge> edges = query.edges();
if (edges == null) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg);
- result = Either.right(TitanOperationStatus.NOT_FOUND);
+ result = Either.right(JanusGraphOperationStatus.NOT_FOUND);
} else {
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
if (eIter.hasNext()) {
matchingEdge = eIter.next();
} else {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg);
- result = Either.right(TitanOperationStatus.NOT_FOUND);
+ result = Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
}
if (result == null) {
@@ -737,13 +736,13 @@
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", vertex.getUniqueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return result;
}
- public Either<Edge, TitanOperationStatus> getEdgeByChildrenVertexProperties(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
- Either<Edge, TitanOperationStatus> result = null;
+ public Either<Edge, JanusGraphOperationStatus> getEdgeByChildrenVertexProperties(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ Either<Edge, JanusGraphOperationStatus> result = null;
Edge matchingEdge = null;
String notFoundMsg = "No edges in graph for criteria";
try {
@@ -761,11 +760,11 @@
if (result == null) {
//no match
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg);
- result = Either.right(TitanOperationStatus.NOT_FOUND);
+ result = Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", vertex.getUniqueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return result;
}
@@ -778,8 +777,8 @@
* @param properties
* @return
*/
- public Either<Edge, TitanOperationStatus> deleteBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
- Either<Edge, TitanOperationStatus> result = null;
+ public Either<Edge, JanusGraphOperationStatus> deleteBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ Either<Edge, JanusGraphOperationStatus> result = null;
try {
result = getBelongingEdgeByCriteria(vertex, label, properties);
if (result.isLeft()) {
@@ -792,7 +791,7 @@
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge by criteria for the component with id {}. {}", vertex == null ? "NULL" : vertex.getUniqueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return result;
}
@@ -807,19 +806,19 @@
* @return
*/
- public Either<Edge, TitanOperationStatus> deleteEdge(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) {
+ public Either<Edge, JanusGraphOperationStatus> deleteEdge(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) {
return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), false);
}
- public Either<Edge, TitanOperationStatus> deleteAllEdges(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) {
+ public Either<Edge, JanusGraphOperationStatus> deleteAllEdges(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) {
return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), true);
}
- public Either<Edge, TitanOperationStatus> deleteEdge(TitanVertex fromVertex, TitanVertex toVertex, EdgeLabelEnum label, String uniqueIdFrom, String uniqueIdTo, boolean deleteAll) {
- Either<Edge, TitanOperationStatus> result = null;
+ public Either<Edge, JanusGraphOperationStatus> deleteEdge(JanusGraphVertex fromVertex, JanusGraphVertex toVertex, EdgeLabelEnum label, String uniqueIdFrom, String uniqueIdTo, boolean deleteAll) {
+ Either<Edge, JanusGraphOperationStatus> result = null;
try {
- Iterable<TitanEdge> edges = fromVertex.query().labels(label.name()).edges();
- Iterator<TitanEdge> eIter = edges.iterator();
+ Iterable<JanusGraphEdge> edges = fromVertex.query().labels(label.name()).edges();
+ Iterator<JanusGraphEdge> eIter = edges.iterator();
while (eIter.hasNext()) {
Edge edge = eIter.next();
String currVertexUniqueId = edge.inVertex().value(GraphPropertyEnum.UNIQUE_ID.getProperty());
@@ -834,16 +833,16 @@
}
if (result == null) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to delete an edge with the label {} between vertices {} and {}. ", label.name(), uniqueIdFrom, uniqueIdTo);
- result = Either.right(TitanOperationStatus.NOT_FOUND);
+ result = Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge with the label {} between vertices {} and {}. {}", label.name(), uniqueIdFrom, uniqueIdTo, e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return result;
}
- public TitanOperationStatus deleteEdgeByDirection(GraphVertex fromVertex, Direction direction, EdgeLabelEnum label) {
+ public JanusGraphOperationStatus deleteEdgeByDirection(GraphVertex fromVertex, Direction direction, EdgeLabelEnum label) {
try {
Iterator<Edge> edges = fromVertex.getVertex().edges(direction, label.name());
@@ -853,9 +852,9 @@
}
} catch (Exception e) {
logger.debug("Failed to remove from vertex {} edges {} by direction {} ", fromVertex.getUniqueId(), label, direction, e);
- return TitanGraphClient.handleTitanException(e);
+ return JanusGraphClient.handleJanusGraphException(e);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
/**
@@ -864,7 +863,7 @@
* @param graphVertex
* @return
*/
- public Either<GraphVertex, TitanOperationStatus> updateVertex(GraphVertex graphVertex) {
+ public Either<GraphVertex, JanusGraphOperationStatus> updateVertex(GraphVertex graphVertex) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId());
try {
graphVertex.updateMetadataJsonWithCurrentMetadataProperties();
@@ -872,7 +871,7 @@
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId(), e);
- return Either.right(TitanGraphClient.handleTitanException(e));
+ return Either.right(JanusGraphClient.handleJanusGraphException(e));
}
return Either.left(graphVertex);
}
@@ -883,12 +882,12 @@
* @param verticesToGet
* @return
*/
- public Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesByUniqueIdAndParseFlag(Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet) {
+ public Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesByUniqueIdAndParseFlag(Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet) {
- Either<Map<String, GraphVertex>, TitanOperationStatus> result = null;
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> result = null;
Map<String, GraphVertex> vertices = new HashMap<>();
- TitanOperationStatus titatStatus;
- Either<GraphVertex, TitanOperationStatus> getVertexRes = null;
+ JanusGraphOperationStatus titatStatus;
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexRes = null;
for (Map.Entry<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> entry : verticesToGet.entrySet()) {
if (entry.getValue().getKey() == GraphPropertyEnum.UNIQUE_ID) {
getVertexRes = getVertexById(entry.getKey(), entry.getValue().getValue());
@@ -896,7 +895,7 @@
getVertexRes = getVertexByPropertyAndLabel(entry.getValue().getKey(), entry.getKey(), VertexTypeEnum.USER, entry.getValue().getValue());
}
if (getVertexRes == null) {
- titatStatus = TitanOperationStatus.ILLEGAL_ARGUMENT;
+ titatStatus = JanusGraphOperationStatus.ILLEGAL_ARGUMENT;
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Invalid vertex type label {} has been received. ", entry.getValue().getKey(), titatStatus);
return Either.right(titatStatus);
}
@@ -924,16 +923,16 @@
* @param edgeToCopy
* @return
*/
- public TitanOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Edge edgeToCopy) {
+ public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Edge edgeToCopy) {
return createEdge(from, to, label, getEdgeProperties(edgeToCopy));
}
- public TitanOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, Edge prevEdge, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
+ public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, Edge prevEdge, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, fromVertex!=null ? fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL",
toVertex!=null ? toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL");
- TitanOperationStatus result = createEdge(fromVertex, toVertex, newLabel, prevEdge);
- if (result == TitanOperationStatus.OK) {
+ JanusGraphOperationStatus result = createEdge(fromVertex, toVertex, newLabel, prevEdge);
+ if (result == JanusGraphOperationStatus.OK) {
prevEdge.remove();
}
return result;
@@ -948,14 +947,14 @@
* @param newLabel
* @return
*/
- public TitanOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
+ public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
- TitanOperationStatus result = null;
+ JanusGraphOperationStatus result = null;
Iterator<Edge> prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name());
if (prevEdgeIter == null || !prevEdgeIter.hasNext()) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
- result = TitanOperationStatus.NOT_FOUND;
+ result = JanusGraphOperationStatus.NOT_FOUND;
}
if (result == null) {
result = replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
@@ -971,7 +970,7 @@
* @param properties
* @return
*/
- public TitanOperationStatus updateVertexMetadataPropertiesWithJson(Vertex vertex, Map<GraphPropertyEnum, Object> properties) {
+ public JanusGraphOperationStatus updateVertexMetadataPropertiesWithJson(Vertex vertex, Map<GraphPropertyEnum, Object> properties) {
try {
if (!MapUtils.isEmpty(properties)) {
String jsonMetadataStr = (String) vertex.property(GraphPropertyEnum.METADATA.getProperty()).value();
@@ -984,12 +983,12 @@
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occurred during update vertex metadata properties with json{}. {}", vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), e.getMessage());
- return TitanGraphClient.handleTitanException(e);
+ return JanusGraphClient.handleJanusGraphException(e);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- public TitanOperationStatus disassociateAndDeleteLast(GraphVertex vertex, Direction direction, EdgeLabelEnum label) {
+ public JanusGraphOperationStatus disassociateAndDeleteLast(GraphVertex vertex, Direction direction, EdgeLabelEnum label) {
try {
Iterator<Edge> edges = vertex.getVertex().edges(direction, label.name());
@@ -1015,13 +1014,13 @@
}
} catch (Exception e) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge with the label {} direction {} from vertex {}. {}", label.name(), direction, vertex.getUniqueId(), e);
- return TitanGraphClient.handleTitanException(e);
+ return JanusGraphClient.handleJanusGraphException(e);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- public Object getProperty(TitanVertex vertex, String key) {
- PropertyKey propertyKey = titanClient.getGraph().left().value().getPropertyKey(key);
+ public Object getProperty(JanusGraphVertex vertex, String key) {
+ PropertyKey propertyKey = janusGraphClient.getGraph().left().value().getPropertyKey(key);
return vertex.valueOrNull(propertyKey);
}
@@ -1050,26 +1049,26 @@
* @param direction
* @return
*/
- public TitanOperationStatus moveEdge(GraphVertex vertexA, GraphVertex vertexB, EdgeLabelEnum label, Direction direction) {
- TitanOperationStatus result = deleteEdgeByDirection(vertexA, direction, label);
- if (result != TitanOperationStatus.OK) {
+ public JanusGraphOperationStatus moveEdge(GraphVertex vertexA, GraphVertex vertexB, EdgeLabelEnum label, Direction direction) {
+ JanusGraphOperationStatus result = deleteEdgeByDirection(vertexA, direction, label);
+ if (result != JanusGraphOperationStatus.OK) {
logger.error("Failed to diassociate {} from element {}. error {} ", label, vertexA.getUniqueId(), result);
return result;
}
- TitanOperationStatus createRelation;
+ JanusGraphOperationStatus createRelation;
if (direction == Direction.IN) {
createRelation = createEdge(vertexB, vertexA, label, null);
} else {
createRelation = createEdge(vertexA, vertexB, label, null);
}
- if (createRelation != TitanOperationStatus.OK) {
+ if (createRelation != JanusGraphOperationStatus.OK) {
return createRelation;
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- public Either<Edge, TitanOperationStatus> getBelongingEdgeByCriteria(String parentId, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
- Either<GraphVertex, TitanOperationStatus> getVertexRes = getVertexById(parentId, JsonParseFlagEnum.NoParse);
+ public Either<Edge, JanusGraphOperationStatus> getBelongingEdgeByCriteria(String parentId, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexRes = getVertexById(parentId, JsonParseFlagEnum.NoParse);
if (getVertexRes.isRight()) {
return Either.right(getVertexRes.right().value());
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractJanusGraphVertexHeal.java
similarity index 89%
rename from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java
rename to catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractJanusGraphVertexHeal.java
index e01ddab..f60a063 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractJanusGraphVertexHeal.java
@@ -17,6 +17,6 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
-public abstract class AbstractTitanVertexHeal implements Heal<GraphNode> {
+public abstract class AbstractJanusGraphVertexHeal implements Heal<GraphNode> {
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanUtils.java
deleted file mode 100644
index 163ef80..0000000
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanUtils.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.openecomp.sdc.be.dao.titan;
-
-import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import static com.thinkaurelius.titan.core.attribute.Contain.NOT_IN;
-import static java.util.Collections.emptyMap;
-import static org.apache.commons.collections.CollectionUtils.isEmpty;
-
-public class TitanUtils {
-
- private TitanUtils() {
- }
-
- public static <T> Map<String, Entry<TitanPredicate, Object>> buildNotInPredicate(String propKey, Collection<T> notInCollection) {
- if (isEmpty(notInCollection)) {
- return emptyMap();
- }
- Map<String, Entry<TitanPredicate, Object>> predicateCriteria = new HashMap<>();
- predicateCriteria.put(propKey, new HashMap.SimpleEntry<>(NOT_IN, notInCollection));
- return predicateCriteria;
- }
-}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/transactions/SimpleTitanTransactionManager.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/transactions/SimpleTitanTransactionManager.java
deleted file mode 100644
index 2e5b7ea..0000000
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/transactions/SimpleTitanTransactionManager.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.openecomp.sdc.be.dao.titan.transactions;
-
-import com.thinkaurelius.titan.core.TitanException;
-import com.thinkaurelius.titan.core.TitanGraph;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
-import org.openecomp.sdc.common.log.wrappers.Logger;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.TransactionDefinition;
-import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.TransactionSystemException;
-import org.springframework.transaction.support.SimpleTransactionStatus;
-
-import javax.annotation.PostConstruct;
-
-/**
- * Simple transaction manager for the titan database.
- * This manager does not deal with transactions propagation and relies on the fact that transactions are automatically created with the first operation on the graph
- */
-@Component
-public class SimpleTitanTransactionManager implements PlatformTransactionManager {
-
- private static final Logger log = Logger.getLogger(SimpleTitanTransactionManager.class.getName());
- private final TitanGraphClient titanClient;
- private TitanGraph titanGraph;
-
- public SimpleTitanTransactionManager(TitanGraphClient titanClient) {
- this.titanClient = titanClient;
- }
-
- @PostConstruct
- public void onInit() {
- titanGraph = titanClient.getGraph().left().on(this::onFailingToStartTitan);
- }
-
- @Override
- public TransactionStatus getTransaction(TransactionDefinition transactionDefinition) {
- log.debug("#getTransaction - returning simple transaction status");
- return new SimpleTransactionStatus();
- }
-
- @Override
- public void commit(TransactionStatus transactionStatus) {
- log.debug("#commit - committing transaction");
- try {
- titanGraph.tx().commit();
- } catch (TitanException e) {
- log.debug("#commit - failed to commit transaction", e);
- throw new TransactionSystemException("failed to commit transaction", e);
- }
- }
-
- @Override
- public void rollback(TransactionStatus transactionStatus) {
- log.debug("#rollback - committing transaction");
- try {
- titanGraph.tx().rollback();
- } catch (TitanException e) {
- log.debug("#rollback - failed to rollback transaction", e);
- throw new TransactionSystemException("failed to rollback transaction", e);
- }
- }
-
- private TitanGraph onFailingToStartTitan(TitanOperationStatus err) {
- log.debug("#onFailingToStartTitan - could not open titan client");
- throw new IllegalStateException("titan could not be initialized: " + err);
- }
-
-}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java
index b7ca476..c6c609b 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java
@@ -26,7 +26,7 @@
String REPO_KEYSPACE = "sdcrepository";
String AUDIT_KEYSPACE = "sdcaudit";
String COMPONENT_KEYSPACE = "sdccomponent";
- String TITAN_KEYSPACE = "titan";
+ String janusGraph_KEYSPACE = "janusgraph";
String USER_ADMIN_EVENT_TYPE = "useradminevent";
String USER_ACCESS_EVENT_TYPE = "useraccessevent";
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 83b6892..c0d9e46 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 @@
}
@Test
- public void testPipelineFilter3AttributesTitanVertex() {
+ public void testPipelineFilter3AttributesJanusGraphVertex() {
// init data
HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
healingPipelineDao.setHealVersion(7);
@@ -95,16 +95,16 @@
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 @@
}
@Test
- public void testPipelineFilterGenericTitanDao() {
+ public void testPipelineFilterGenericJanusGraphDao() {
// init data
HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
healingPipelineDao.setHealVersion(7);
@@ -140,7 +140,7 @@
}
@Test
- public void testPipelineFilterTitanGraph1Attributes() {
+ public void testPipelineFilterJanusGraph1Attributes() {
// init data
HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
healingPipelineDao.setHealVersion(7);
@@ -217,9 +217,9 @@
.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 @@
}
- private class GraphNodeHealTestMock extends AbstractTitanVertexHeal {
+ private class GraphNodeHealTestMock extends AbstractJanusGraphVertexHeal {
private HealVersion healVersion;
public GraphNodeHealTestMock(int i) {
@@ -266,10 +266,10 @@
}
- 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 @@
}
@Override
- public void healData(TitanVertex parentV) {
+ public void healData(JanusGraphVertex parentV) {
}
}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtilsTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtilsTest.java
new file mode 100644
index 0000000..b3fd59e
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphUtilsTest.java
@@ -0,0 +1,21 @@
+package org.openecomp.sdc.be.dao.janusgraph;
+
+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 JanusGraphUtilsTest {
+
+ @Test
+ public void testBuildNotInPredicate() throws Exception {
+ String propKey = "";
+ Collection<T> notInCollection = null;
+ Map<String, Entry<JanusGraphPredicate, Object>> result;
+
+ // default test
+ 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 b336bc6..8ce2019 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 @@
@Test
public void testGetVertex() throws Exception {
GraphVertex testSubject;
- TitanVertex result;
+ JanusGraphVertex result;
// default test
testSubject = createTestSubject();
@@ -81,7 +81,7 @@
@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
similarity index 70%
rename from catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoMockTest.java
rename to catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java
index 5703e53..72a9d54 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.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.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 @@
@Test
public void testCommit() throws Exception {
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
result = testSubject.commit();
@@ -51,7 +51,7 @@
@Test
public void testRollback() throws Exception {
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
result = testSubject.rollback();
@@ -60,7 +60,7 @@
@Test
public void testGetGraph() throws Exception {
- Either<TitanGraph, TitanOperationStatus> result;
+ Either<JanusGraph, JanusGraphOperationStatus> result;
// default test
@@ -72,14 +72,14 @@
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 @@
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 @@
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 @@
@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 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 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 @@
@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 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 @@
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 @@
@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 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 @@
@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 @@
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 @@
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 @@
Vertex parentVertex = null;
EdgeLabelEnum edgeLabel = null;
JsonParseFlagEnum parseFlag = null;
- Either<Vertex, TitanOperationStatus> result;
+ Either<Vertex, JanusGraphOperationStatus> result;
// default test
@@ -348,7 +348,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
@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 @@
@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 void testUpdateVertex() throws Exception {
GraphVertex graphVertex = new GraphVertex();
- Either<GraphVertex, TitanOperationStatus> result;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
// default test
@@ -454,7 +454,7 @@
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 @@
Vertex to = null;
EdgeLabelEnum label = null;
Edge edgeToCopy = null;
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
@@ -491,7 +491,7 @@
Edge prevEdge = null;
EdgeLabelEnum prevLabel = null;
EdgeLabelEnum newLabel = null;
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
@@ -504,7 +504,7 @@
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 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 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 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 @@
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
similarity index 80%
rename from catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java
rename to catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java
index 2c4b868..9019de9 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.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.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 @@
@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 @@
@Test
public void testCommit() throws Exception {
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
@@ -75,7 +75,7 @@
@Test
public void testRollback() throws Exception {
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
@@ -85,7 +85,7 @@
@Test
public void testGetGraph() throws Exception {
- Either<TitanGraph, TitanOperationStatus> result;
+ Either<JanusGraph, JanusGraphOperationStatus> result;
// default test
@@ -98,7 +98,7 @@
GraphPropertyEnum name = null;
Object value = null;
VertexTypeEnum label = null;
- Either<GraphVertex, TitanOperationStatus> result;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
// default test
@@ -114,7 +114,7 @@
Object value = null;
VertexTypeEnum label = null;
JsonParseFlagEnum parseFlag = null;
- Either<GraphVertex, TitanOperationStatus> result;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
// default test
@@ -126,7 +126,7 @@
public void testGetVertexById() throws Exception {
String id = "";
- Either<GraphVertex, TitanOperationStatus> result;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
// default test
@@ -138,7 +138,7 @@
String id = "";
JsonParseFlagEnum parseFlag = null;
- Either<GraphVertex, TitanOperationStatus> result;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
// test 1
@@ -181,7 +181,7 @@
VertexTypeEnum type = null;
Map<GraphPropertyEnum, Object> props = null;
- Either<List<GraphVertex>, TitanOperationStatus> result;
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
// default test
@@ -194,7 +194,7 @@
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 @@
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 @@
@Test
public void testGetCatalogVerticies() throws Exception {
- Either<Iterator<Vertex>, TitanOperationStatus> result;
+ Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
// default test
@@ -232,7 +232,7 @@
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 @@
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 @@
Vertex vertex = null;
Map<GraphPropertyEnum, Object> properties = null;
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
@@ -303,7 +303,7 @@
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/dao/titan/TitanUtilsTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java
deleted file mode 100644
index 641eec5..0000000
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.openecomp.sdc.be.dao.titan;
-
-import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
-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 {
-
- @Test
- public void testBuildNotInPredicate() throws Exception {
- String propKey = "";
- Collection<T> notInCollection = null;
- Map<String, Entry<TitanPredicate, Object>> result;
-
- // default test
- result = TitanUtils.buildNotInPredicate(propKey, notInCollection);
- }
-}
\ No newline at end of file
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
similarity index 62%
rename from catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java
rename to catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java
index e8c6b3c..09ab6a1 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.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 @@
@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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
((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 24980df..c07512f 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 67c0ec7..92cf2a3 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 @@
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:
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java
index 7f5ea06..d8b3295 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java
@@ -282,7 +282,7 @@
healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_FE, UP,
getAppVersion(), "OK"));
healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_BE, DOWN, null, null));
- healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, UNKNOWN, null, null));
+ healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, UNKNOWN, null, null));
healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_CASSANDRA, UNKNOWN, null, null));
healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_DISTRIBUTION_ENGINE, UNKNOWN, null, null));
healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_ON_BOARDING, UNKNOWN, null, null));
diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml
index c5db734..a28a040 100644
--- a/catalog-model/pom.xml
+++ b/catalog-model/pom.xml
@@ -105,11 +105,10 @@
<scope>provided</scope>
</dependency>
- <!-- TITAN -->
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-core</artifactId>
+ <version>${janusgraph.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -132,9 +131,9 @@
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-cassandra</artifactId>
+ <version>${janusgraph.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -143,7 +142,6 @@
</exclusion>
</exclusions>
</dependency>
- <!-- TITAN END -->
<dependency>
<groupId>org.apache.commons</groupId>
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java b/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
index 6ba7a35..5b9cf67 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
@@ -8,8 +8,8 @@
@Configuration
@ComponentScan({"org.openecomp.sdc.be.model.operations.impl",
"org.openecomp.sdc.be.model.cache",
- "org.openecomp.sdc.be.model.jsontitan.utils",
- "org.openecomp.sdc.be.model.jsontitan.operations",
+ "org.openecomp.sdc.be.model.jsonjanusgraph.utils",
+ "org.openecomp.sdc.be.model.jsonjanusgraph.operations",
"org.openecomp.sdc.be.dao.cassandra"
})
public class CatalogModelSpringConfig {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
index b65997c..0a77ecd 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
@@ -48,7 +48,7 @@
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import static java.util.stream.Collectors.toMap;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
index 5104a17..5a67089 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
@@ -21,13 +21,13 @@
package org.openecomp.sdc.be.model;
import fj.data.Either;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import java.util.List;
public interface DerivedNodeTypeResolver {
- Either<List<GraphVertex>, TitanOperationStatus> findDerivedResources(String parentResource);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
index 3c1ca26..4920d4f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
@@ -23,17 +23,13 @@
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.InstantiationTypes;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-
-import java.util.HashMap;
-import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
public class Service extends Component {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationCache.java
index e9b7f7a..e70ab0e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationCache.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationCache.java
@@ -21,14 +21,14 @@
package org.openecomp.sdc.be.model.cache;
import fj.data.Either;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import java.util.Map;
public interface ApplicationCache<T> {
- public abstract Either<Map<String, T>, TitanOperationStatus> getAll();
+ public abstract Either<Map<String, T>, JanusGraphOperationStatus> getAll();
- public abstract Either<T, TitanOperationStatus> get(String uniqueId);
+ public abstract Either<T, JanusGraphOperationStatus> get(String uniqueId);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
index 9499211..fb49762 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
@@ -28,7 +28,7 @@
import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig;
import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheInfo;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
@@ -146,7 +146,7 @@
}
}
- private Either<Map<String, DataTypeDefinition>, TitanOperationStatus> getAllDataTypesFromGraph() {
+ private Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> getAllDataTypesFromGraph() {
return propertyOperation
.getAllDataTypes();
@@ -154,7 +154,7 @@
}
@Override
- public Either<Map<String, DataTypeDefinition>, TitanOperationStatus> getAll() {
+ public Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> getAll() {
try {
@@ -171,7 +171,7 @@
}
@Override
- public Either<DataTypeDefinition, TitanOperationStatus> get(String uniqueId) {
+ public Either<DataTypeDefinition, JanusGraphOperationStatus> get(String uniqueId) {
try {
r.lock();
@@ -202,12 +202,12 @@
Long start = System.currentTimeMillis();
log.trace("Start fetching all data types from db");
- Either<List<DataTypeData>, TitanOperationStatus> allDataTypeNodes = propertyOperation.getAllDataTypeNodes();
+ Either<List<DataTypeData>, JanusGraphOperationStatus> allDataTypeNodes = propertyOperation.getAllDataTypeNodes();
Long end = System.currentTimeMillis();
log.trace("Finish fetching all data types from db. Took {} Milliseconds", (end - start));
if (allDataTypeNodes.isRight()) {
- TitanOperationStatus status = allDataTypeNodes.right().value();
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = allDataTypeNodes.right().value();
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("ApplicationDataTypesCache - Failed to fetch all data types nodes");
BeEcompErrorManager.getInstance().logInternalConnectionError("FetchDataTypes",
"Failed to fetch data types from graph(cache)", ErrorSeverity.INFO);
@@ -251,7 +251,7 @@
"Failed to run refresh data types job", ErrorSeverity.INFO);
} finally {
try {
- propertyOperation.getTitanGenericDao().commit();
+ propertyOperation.getJanusGraphGenericDao().commit();
} catch (Exception e) {
log.trace("Failed to commit ApplicationDataTypeCache", e);
}
@@ -301,11 +301,11 @@
private void replaceAllData() {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = propertyOperation
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = propertyOperation
.getAllDataTypes();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
log.debug("Failed to fetch all data types from db. Status is {}", status);
} else {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
index b17a664..0fea33e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
@@ -37,7 +37,7 @@
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.resources.data.ComponentCacheData;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.SerializationUtils;
@@ -54,10 +54,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.function.Function;
-import java.util.stream.Collectors;
@org.springframework.stereotype.Component("component-cache")
public class ComponentCache {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/DaoInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/DaoInfo.java
index 4880afe..85a7f2e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/DaoInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/DaoInfo.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.model.cache;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class DaoInfo {
private ToscaOperationFacade toscaOperationFacade;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/workers/SyncWorker.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/workers/SyncWorker.java
index 7af806f..cd78063 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/workers/SyncWorker.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/workers/SyncWorker.java
@@ -22,7 +22,7 @@
import fj.data.Either;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.operations.impl.CacheMangerOperation;
@@ -85,7 +85,7 @@
log.debug("sync worker:{} encounered an exception", workerName);
log.debug("exception", e);
} finally {
- this.cacheMangerOperation.getTitanGenericDao().commit();
+ this.cacheMangerOperation.getJanusGraphGenericDao().commit();
}
}
@@ -97,11 +97,11 @@
private void clearCacheRecords() {
cacheIdAndTimeMap.forEach((k, v) -> {
try {
- Either<ComponentMetadataData, TitanOperationStatus> componentFromGraphRes = getComponentMetaData(k,
+ Either<ComponentMetadataData, JanusGraphOperationStatus> componentFromGraphRes = getComponentMetaData(k,
NodeTypeEnum.getByName(v.getType()));
if (componentFromGraphRes.isRight()) {
- TitanOperationStatus error = componentFromGraphRes.right().value();
- if (TitanOperationStatus.NOT_FOUND.equals(error)) {
+ JanusGraphOperationStatus error = componentFromGraphRes.right().value();
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(error)) {
long delay = System.currentTimeMillis() - v.getModificationTime().getTime();
if (delay > updateDelayInMilliseconds) {
this.cacheMangerOperation.deleteComponentInCache(k, v.getModificationTime().getTime(),
@@ -148,11 +148,11 @@
private void syncCacheByComponentType(NodeTypeEnum nodeTypeEnum) {
if (!this.shutdown) {
log.trace("syncCache records of type:{} .", nodeTypeEnum);
- Either<List<ComponentMetadataData>, TitanOperationStatus> getAllResult = getAllComponentsMetaData(
+ Either<List<ComponentMetadataData>, JanusGraphOperationStatus> getAllResult = getAllComponentsMetaData(
nodeTypeEnum);
List<ComponentMetadataData> componentList = new ArrayList<>();
- if (getAllResult.isRight() && !TitanOperationStatus.NOT_FOUND.equals(getAllResult.right().value())) {
- log.debug("error while trying to get all components of type:{} TitanOperationStatus:{}.", nodeTypeEnum,
+ if (getAllResult.isRight() && !JanusGraphOperationStatus.NOT_FOUND.equals(getAllResult.right().value())) {
+ log.debug("error while trying to get all components of type:{} JanusGraphOperationStatus:{}.", nodeTypeEnum,
getAllResult.right().value());
return;
}
@@ -243,9 +243,9 @@
* @return a list of retrieved nodes matching the given type or not found in
* case no nodes were found or error in case of failure
*/
- private Either<List<ComponentMetadataData>, TitanOperationStatus> getAllComponentsMetaData(
+ private Either<List<ComponentMetadataData>, JanusGraphOperationStatus> getAllComponentsMetaData(
NodeTypeEnum nodeTypeEnum) {
- return this.cacheMangerOperation.getTitanGenericDao().getByCriteria(nodeTypeEnum, null,
+ return this.cacheMangerOperation.getJanusGraphGenericDao().getByCriteria(nodeTypeEnum, null,
ComponentMetadataData.class);
}
@@ -259,9 +259,9 @@
* @return the meta dat of the component or the error encountered during the
* get
*/
- private Either<ComponentMetadataData, TitanOperationStatus> getComponentMetaData(String uid,
- NodeTypeEnum nodeTypeEnum) {
- return this.cacheMangerOperation.getTitanGenericDao().getNode(UniqueIdBuilder.getKeyByNodeType(nodeTypeEnum),
+ private Either<ComponentMetadataData, JanusGraphOperationStatus> getComponentMetaData(String uid,
+ NodeTypeEnum nodeTypeEnum) {
+ return this.cacheMangerOperation.getJanusGraphGenericDao().getNode(UniqueIdBuilder.getKeyByNodeType(nodeTypeEnum),
uid, ComponentMetadataData.class);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeType.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
similarity index 97%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeType.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
index 4babd5d..9c3b76d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeType.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import org.openecomp.sdc.be.datatypes.elements.*;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplate.java
similarity index 98%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplate.java
index 8c0253a..a02b07d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplate.java
@@ -18,16 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.MapInterfaceInstanceDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import java.util.HashMap;
import java.util.Map;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElement.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
similarity index 98%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElement.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
index a18c75b..7685d1c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElement.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
@@ -31,7 +31,7 @@
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
import org.slf4j.MDC;
import java.util.HashMap;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnum.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnum.java
similarity index 96%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnum.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnum.java
index 3ee492b..1e3620b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnum.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnum.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnum.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnum.java
similarity index 95%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnum.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnum.java
index 2a4496e..308f2db 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnum.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnum.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.enums;
+package org.openecomp.sdc.be.model.jsonjanusgraph.enums;
public enum JsonConstantKeysEnum {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java
similarity index 76%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java
index f4033a2..3f2b41e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java
@@ -1,19 +1,19 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -23,8 +23,8 @@
import java.util.*;
import java.util.stream.Collectors;
-import static org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation.Action.ARCHIVE;
-import static org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation.Action.RESTORE;
+import static org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation.Action.ARCHIVE;
+import static org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation.Action.RESTORE;
/**
* Created by yavivi on 25/03/2018.
@@ -41,13 +41,13 @@
ARCHIVE, RESTORE;
}
- public ArchiveOperation(TitanDao titanDao, IGraphLockOperation graphLockOperation){
- this.titanDao = titanDao;
+ public ArchiveOperation(JanusGraphDao janusGraphDao, IGraphLockOperation graphLockOperation){
+ this.janusGraphDao = janusGraphDao;
this.graphLockOperation = graphLockOperation;
}
public Either<List<String>, ActionStatus> archiveComponent(String componentId) {
- final Either<GraphVertex, TitanOperationStatus> vertexResult = this.titanDao.getVertexById(componentId);
+ final Either<GraphVertex, JanusGraphOperationStatus> vertexResult = this.janusGraphDao.getVertexById(componentId);
if (vertexResult.isLeft()){
return doAction(ARCHIVE, vertexResult.left().value());
} else {
@@ -56,7 +56,7 @@
}
public Either<List<String>, ActionStatus> restoreComponent(String componentId) {
- final Either<GraphVertex, TitanOperationStatus> vertexResult = this.titanDao.getVertexById(componentId);
+ final Either<GraphVertex, JanusGraphOperationStatus> vertexResult = this.janusGraphDao.getVertexById(componentId);
if (vertexResult.isLeft()){
return doAction(RESTORE, vertexResult.left().value());
} else {
@@ -75,7 +75,8 @@
private ActionStatus onVspStateChanged(Action action, String csarId) {
Map<GraphPropertyEnum, Object> props = new HashMap<>();
props.put(GraphPropertyEnum.CSAR_UUID, csarId);
- Either<List<GraphVertex>, TitanOperationStatus> vfsE = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vfsE = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
return vfsE.either(vList -> setVspArchived(action, vList), s -> onError("VSP_"+action.name(), csarId, s));
}
@@ -85,7 +86,7 @@
GraphVertex highestVersion = this.getHighestVersionFrom(vList.get(0));
StorageOperationStatus lockStatus = this.graphLockOperation.lockComponent(highestVersion.getUniqueId(), highestVersion.getType().getNodeType());
if (lockStatus != StorageOperationStatus.OK){
- return onError(action.name(), highestVersion.getUniqueId(), TitanOperationStatus.ALREADY_LOCKED);
+ return onError(action.name(), highestVersion.getUniqueId(), JanusGraphOperationStatus.ALREADY_LOCKED);
}
try {
@@ -94,7 +95,7 @@
boolean val = action == ARCHIVE ? true : false;
v.setJsonMetadataField(JsonPresentationFields.IS_VSP_ARCHIVED, val);
v.addMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED, val);
- titanDao.updateVertex(v);
+ janusGraphDao.updateVertex(v);
}
return commitAndCheck("VSP_"+action.name(), vList.toString());
} finally {
@@ -107,8 +108,10 @@
public List<String> setArchivedOriginsFlagInComponentInstances(GraphVertex compositionService) {
List<String> ciUidsWithArchivedOrigins = new LinkedList();
- Either<List<GraphVertex>, TitanOperationStatus> instanceOfVerticesE = titanDao.getChildrenVertecies(compositionService, EdgeLabelEnum.INSTANCE_OF, JsonParseFlagEnum.NoParse);
- Either<List<GraphVertex>, TitanOperationStatus> proxyOfVerticesE = titanDao.getChildrenVertecies(compositionService, EdgeLabelEnum.PROXY_OF, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> instanceOfVerticesE = janusGraphDao
+ .getChildrenVertecies(compositionService, EdgeLabelEnum.INSTANCE_OF, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> proxyOfVerticesE = janusGraphDao
+ .getChildrenVertecies(compositionService, EdgeLabelEnum.PROXY_OF, JsonParseFlagEnum.NoParse);
List<GraphVertex> all = new LinkedList<>();
if (instanceOfVerticesE.isLeft()){
@@ -162,16 +165,17 @@
//Lock the Highest Version
StorageOperationStatus lockStatus = this.graphLockOperation.lockComponent(highestVersion.getUniqueId(), highestVersion.getType().getNodeType());
if (lockStatus != StorageOperationStatus.OK){
- return Either.right(onError(action.name(), componentVertex.getUniqueId(), TitanOperationStatus.ALREADY_LOCKED));
+ return Either.right(onError(action.name(), componentVertex.getUniqueId(), JanusGraphOperationStatus.ALREADY_LOCKED));
}
//Refetch latest version with full parsing
- highestVersion = this.titanDao.getVertexById(highestVersion.getUniqueId(), JsonParseFlagEnum.ParseAll).left().value();
+ highestVersion = this.janusGraphDao
+ .getVertexById(highestVersion.getUniqueId(), JsonParseFlagEnum.ParseAll).left().value();
try {
//Get Catalog and Archive Roots
- GraphVertex catalogRoot = titanDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT).left().value();
- GraphVertex archiveRoot = titanDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT).left().value();
+ GraphVertex catalogRoot = janusGraphDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT).left().value();
+ GraphVertex archiveRoot = janusGraphDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT).left().value();
if (action == ARCHIVE) {
archiveEdges(catalogRoot, archiveRoot, highestVersion);
@@ -179,7 +183,7 @@
restoreEdges(catalogRoot, archiveRoot, highestVersion);
}
setPropertiesByAction(highestVersion, action);
- titanDao.updateVertex(highestVersion);
+ janusGraphDao.updateVertex(highestVersion);
List<String> affectedComponentIds = handleParents(highestVersion, catalogRoot, archiveRoot, action);
ActionStatus sc = commitAndCheck(action.name(), highestVersion.getUniqueId());
@@ -190,8 +194,8 @@
}
private ActionStatus commitAndCheck(String action, String componentId) {
- TitanOperationStatus status = titanDao.commit();
- if (!status.equals(TitanOperationStatus.OK)){
+ JanusGraphOperationStatus status = janusGraphDao.commit();
+ if (!status.equals(JanusGraphOperationStatus.OK)){
return onError(action, componentId, status);
}
return ActionStatus.OK;
@@ -210,12 +214,14 @@
* @return
*/
private GraphVertex getHighestVersionFrom(GraphVertex v) {
- Either<GraphVertex, TitanOperationStatus> childVertexE = titanDao.getChildVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertexE = janusGraphDao
+ .getChildVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
GraphVertex highestVersionVertex = v;
while (childVertexE.isLeft()) {
highestVersionVertex = childVertexE.left().value();
- childVertexE = titanDao.getChildVertex(highestVersionVertex, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ childVertexE = janusGraphDao
+ .getChildVertex(highestVersionVertex, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
}
return highestVersionVertex;
}
@@ -226,7 +232,8 @@
}
private List<String> handleParents(GraphVertex v, GraphVertex catalogRoot, GraphVertex archiveRoot, Action action) {
- Either<GraphVertex, TitanOperationStatus> parentVertexE = titanDao.getParentVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertexE = janusGraphDao
+ .getParentVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
List<String> affectedCompIds = new ArrayList();
affectedCompIds.add(v.getUniqueId());
@@ -242,21 +249,22 @@
}
}
setPropertiesByAction(cv, action);
- titanDao.updateVertex(cv);
- parentVertexE = titanDao.getParentVertex(cv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
+ janusGraphDao.updateVertex(cv);
+ parentVertexE = janusGraphDao
+ .getParentVertex(cv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
}
return affectedCompIds;
}
private void archiveEdges(GraphVertex catalogRoot, GraphVertex archiveRoot, GraphVertex v) {
- titanDao.deleteAllEdges(catalogRoot, v, EdgeLabelEnum.CATALOG_ELEMENT);
- titanDao.createEdge(archiveRoot, v, EdgeLabelEnum.ARCHIVE_ELEMENT, null);
+ janusGraphDao.deleteAllEdges(catalogRoot, v, EdgeLabelEnum.CATALOG_ELEMENT);
+ janusGraphDao.createEdge(archiveRoot, v, EdgeLabelEnum.ARCHIVE_ELEMENT, null);
setPropertiesByAction(v, ARCHIVE);
}
private void restoreEdges(GraphVertex catalogRoot, GraphVertex archiveRoot, GraphVertex v) {
- titanDao.deleteAllEdges(archiveRoot, v, EdgeLabelEnum.ARCHIVE_ELEMENT);
- titanDao.createEdge(catalogRoot, v, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao.deleteAllEdges(archiveRoot, v, EdgeLabelEnum.ARCHIVE_ELEMENT);
+ janusGraphDao.createEdge(catalogRoot, v, EdgeLabelEnum.CATALOG_ELEMENT, null);
setPropertiesByAction(v, RESTORE);
}
@@ -270,11 +278,11 @@
v.setJsonMetadataField(JsonPresentationFields.ARCHIVE_TIME, now);
}
- private ActionStatus onError(String action, String componentId, TitanOperationStatus s) {
+ private ActionStatus onError(String action, String componentId, JanusGraphOperationStatus s) {
ActionStatus ret = ActionStatus.GENERAL_ERROR;
- if (s == TitanOperationStatus.NOT_FOUND){
+ if (s == JanusGraphOperationStatus.NOT_FOUND){
ret = ActionStatus.RESOURCE_NOT_FOUND;
- } else if (s == TitanOperationStatus.ALREADY_LOCKED) {
+ } else if (s == JanusGraphOperationStatus.ALREADY_LOCKED) {
ret = ActionStatus.COMPONENT_IN_USE;
}
String retCodeVal = ret.name();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
similarity index 90%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
index 3eb6a52..46617a5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.collections.MapUtils;
@@ -26,11 +26,11 @@
import org.apache.commons.lang3.tuple.Triple;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
@@ -153,7 +153,7 @@
}
private ArtifactDataDefinition findInterfaceArtifact(String parentId, String id) {
- Either<Map<String, InterfaceDefinition>, TitanOperationStatus> dataFromGraph = getDataFromGraph(parentId, EdgeLabelEnum.INTERFACE);
+ Either<Map<String, InterfaceDefinition>, JanusGraphOperationStatus> dataFromGraph = getDataFromGraph(parentId, EdgeLabelEnum.INTERFACE);
if (dataFromGraph.isRight()){
log.debug("failed to fetch interfaces {} for tosca element with id {}, error {}", id, parentId ,dataFromGraph.right().value());
return null;
@@ -214,12 +214,12 @@
Triple<EdgeLabelEnum, Boolean, VertexTypeEnum> triple = getEdgeLabelEnumFromArtifactGroupType(groupType, parentType);
EdgeLabelEnum edgeLabelEnum = triple.getLeft();
- Either<Map<String, ArtifactDefinition>, TitanOperationStatus> foundArtifact = null;
+ Either<Map<String, ArtifactDefinition>, JanusGraphOperationStatus> foundArtifact = null;
Map<String, ArtifactDefinition> resMap = new HashMap<>();
foundArtifact = getArtifactByLabel(parentId, instanceId, edgeLabelEnum);
if (foundArtifact.isRight()) {
log.debug("Failed to find artifact in component {} with label {} ", parentId, edgeLabelEnum);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(foundArtifact.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(foundArtifact.right().value()));
}
resMap.putAll(foundArtifact.left().value());
@@ -234,13 +234,13 @@
*/
public Either<Map<String, ArtifactDefinition>, StorageOperationStatus> getAllInstanceArtifacts(String parentId, String instanceId) {
Map<String, ArtifactDataDefinition> resMap = new HashMap<>();
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> instArtifacts = getInstanceArtifactsByLabel(parentId, instanceId, EdgeLabelEnum.INSTANCE_ARTIFACTS);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> instArtifacts = getInstanceArtifactsByLabel(parentId, instanceId, EdgeLabelEnum.INSTANCE_ARTIFACTS);
if (instArtifacts.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(instArtifacts.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(instArtifacts.right().value()));
}
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> deployInstArtifacts = getInstanceArtifactsByLabel(parentId, instanceId, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> deployInstArtifacts = getInstanceArtifactsByLabel(parentId, instanceId, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
if (deployInstArtifacts.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(deployInstArtifacts.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deployInstArtifacts.right().value()));
}
resMap.putAll(instArtifacts.left().value());
resMap.putAll(deployInstArtifacts.left().value());
@@ -249,7 +249,7 @@
public Either<Map<String, ArtifactDefinition>, StorageOperationStatus> getArtifacts(String parentId) {
- Either<Map<String, ArtifactDefinition>, TitanOperationStatus> foundArtifact = null;
+ Either<Map<String, ArtifactDefinition>, JanusGraphOperationStatus> foundArtifact = null;
Map<String, ArtifactDefinition> resMap = new HashMap<>();
foundArtifact = getArtifactByLabel(parentId, null, EdgeLabelEnum.ARTIFACTS);
if (foundArtifact.isLeft()) {
@@ -367,10 +367,10 @@
public Either<ArtifactDefinition, StorageOperationStatus> updateHeatEnvArtifact(String id, ArtifactDefinition artifactEnvInfo, String artifactId, String newArtifactId, NodeTypeEnum type, String instanceId) {
- Either<Map<String, ArtifactDefinition>, TitanOperationStatus> artifactsEither = getArtifactByLabel(id, instanceId, EdgeLabelEnum.DEPLOYMENT_ARTIFACTS);
+ Either<Map<String, ArtifactDefinition>, JanusGraphOperationStatus> artifactsEither = getArtifactByLabel(id, instanceId, EdgeLabelEnum.DEPLOYMENT_ARTIFACTS);
if (artifactsEither.isRight()) {
log.debug("Failed to find artifacts in component {} with id {} ", id, artifactsEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(artifactsEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(artifactsEither.right().value()));
}
Map<String, ArtifactDefinition> artifacts = artifactsEither.left().value();
@@ -410,7 +410,7 @@
private ArtifactDataDefinition getInstanceArtifactByLabelAndId(String parentId, String id, String containerId, EdgeLabelEnum edgeLabelEnum) {
ArtifactDataDefinition foundArtifact = null;
- Either<Map<String, MapArtifactDataDefinition>, TitanOperationStatus> artifactsEither = getDataFromGraph(containerId, edgeLabelEnum);
+ Either<Map<String, MapArtifactDataDefinition>, JanusGraphOperationStatus> artifactsEither = getDataFromGraph(containerId, edgeLabelEnum);
if (artifactsEither.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, edgeLabelEnum, containerId, artifactsEither.right().value());
return null;
@@ -432,7 +432,7 @@
private ArtifactDataDefinition getArtifactByLabelAndId(String parentId, String id, EdgeLabelEnum edgeLabelEnum) {
ArtifactDataDefinition foundArtifact = null;
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> artifactsEither = getDataFromGraph(parentId, edgeLabelEnum);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> artifactsEither = getDataFromGraph(parentId, edgeLabelEnum);
if (artifactsEither.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, edgeLabelEnum, parentId, artifactsEither.right().value());
return null;
@@ -446,8 +446,8 @@
return foundArtifact;
}
- private Either<Map<String, ArtifactDefinition>, TitanOperationStatus> getArtifactByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> artifactsEither = getArtifactsDataByLabel(parentId, instanceId, edgeLabelEnum);
+ private Either<Map<String, ArtifactDefinition>, JanusGraphOperationStatus> getArtifactByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> artifactsEither = getArtifactsDataByLabel(parentId, instanceId, edgeLabelEnum);
if (artifactsEither.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, edgeLabelEnum, parentId, artifactsEither.right().value());
return Either.right(artifactsEither.right().value());
@@ -456,7 +456,7 @@
return Either.left(convertArtifactMapToArtifactDefinitionMap(artifactDataMap));
}
- private Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> getArtifactsDataByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
+ private Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> getArtifactsDataByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
return edgeLabelEnum.isInstanceArtifactsLabel() ? getInstanceArtifactsByLabel(parentId, instanceId, edgeLabelEnum) : getDataFromGraph(parentId, edgeLabelEnum);
}
@@ -468,8 +468,8 @@
return artMap;
}
- private Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> getInstanceArtifactsByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
- Either<Map<String, MapArtifactDataDefinition>, TitanOperationStatus> resultEither = getDataFromGraph(parentId, edgeLabelEnum);
+ private Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> getInstanceArtifactsByLabel(String parentId, String instanceId, EdgeLabelEnum edgeLabelEnum) {
+ Either<Map<String, MapArtifactDataDefinition>, JanusGraphOperationStatus> resultEither = getDataFromGraph(parentId, edgeLabelEnum);
if (resultEither.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, edgeLabelEnum, parentId, resultEither.right().value());
return Either.right(resultEither.right().value());
@@ -555,7 +555,7 @@
Map<String, MapArtifactDataDefinition> artifactInst = null;
if (edgeLabelEnum != EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS && edgeLabelEnum != EdgeLabelEnum.INSTANCE_ARTIFACTS) {
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> artifactsEither = this.getDataFromGraph(componentId, edgeLabelEnum);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> artifactsEither = this.getDataFromGraph(componentId, edgeLabelEnum);
if (artifactsEither.isLeft() && artifactsEither.left().value() != null && !artifactsEither.left().value().isEmpty()) {
artifacts = artifactsEither.left().value();
@@ -565,7 +565,7 @@
}
} else {
- Either<Map<String, MapArtifactDataDefinition>, TitanOperationStatus> artifactsEither = this.getDataFromGraph(componentId, edgeLabelEnum);
+ Either<Map<String, MapArtifactDataDefinition>, JanusGraphOperationStatus> artifactsEither = this.getDataFromGraph(componentId, edgeLabelEnum);
if (artifactsEither.isLeft()) {
artifactInst = artifactsEither.left().value();
if (isNeedToClone && artifactInst != null) {
@@ -708,18 +708,19 @@
Boolean deleteElement = deleteMandatoryArtifact || !(artifactToDelete.getMandatory() || artifactToDelete.getServiceApi());
Map<String, ToscaDataDefinition> artifacts = null;
GraphVertex parentVertex = null;
- Either<Map<String, ToscaDataDefinition>, TitanOperationStatus> getArtifactsRes = null;
+ Either<Map<String, ToscaDataDefinition>, JanusGraphOperationStatus> getArtifactsRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get tosca element {} upon getting tosca data from graph. Status is {}. ", componentId, getToscaElementRes.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getToscaElementRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getToscaElementRes.right().value()));
}
if (result == null) {
parentVertex = getToscaElementRes.left().value();
getArtifactsRes = this.getDataFromGraph(parentVertex, edgeLabel);
if (getArtifactsRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getArtifactsRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getArtifactsRes.right().value()));
}
}
if (result == null) {
@@ -739,9 +740,10 @@
artifactToDelete.setDuplicated(Boolean.TRUE);
}
if (artifacts != null) {
- TitanOperationStatus status = titanDao.deleteEdgeByDirection(parentVertex, Direction.OUT, edgeLabel);
- if (status != TitanOperationStatus.OK) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus
+ status = janusGraphDao.deleteEdgeByDirection(parentVertex, Direction.OUT, edgeLabel);
+ if (status != JanusGraphOperationStatus.OK) {
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
} else if (MapUtils.isNotEmpty(artifacts)) {
Either<GraphVertex, StorageOperationStatus> associateResult = associateElementToData(parentVertex, vertexLabel, edgeLabel, artifacts);
if (associateResult.isRight()) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
similarity index 80%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
index d44865c..a4fe67e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
@@ -18,38 +18,40 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import com.thinkaurelius.titan.core.TitanVertex;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.janusgraph.core.JanusGraphVertex;
+import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
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.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
-import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -59,10 +61,14 @@
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
-import java.util.*;
-import java.util.EnumMap;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import java.util.stream.Collectors;
/**
@@ -78,7 +84,7 @@
public static final String VF_MODULE = "org.openecomp.groups.VfModule";
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Autowired
protected NodeTypeOperation nodeTypeOperation;
@@ -89,8 +95,8 @@
// @Autowired
protected HealingPipelineDao healingPipelineDao;
- public void setTitanDao(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public void setJanusGraphDao(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
/**
* Returns reference to appropriate toscaTemplateOperation
@@ -191,8 +197,8 @@
return owner;
}
- protected <T extends ToscaDataDefinition> Either<Map<String, T>, TitanOperationStatus> getDataFromGraph(GraphVertex componentV, EdgeLabelEnum edgelabel) {
- Either<Pair<GraphVertex, Map<String, T>>, TitanOperationStatus> dataVertex = getDataAndVertexFromGraph(componentV, edgelabel);
+ protected <T extends ToscaDataDefinition> Either<Map<String, T>, JanusGraphOperationStatus> getDataFromGraph(GraphVertex componentV, EdgeLabelEnum edgelabel) {
+ Either<Pair<GraphVertex, Map<String, T>>, JanusGraphOperationStatus> dataVertex = getDataAndVertexFromGraph(componentV, edgelabel);
if (dataVertex.isRight()) {
return Either.right(dataVertex.right().value());
}
@@ -201,8 +207,8 @@
}
@SuppressWarnings("unchecked")
- protected <T extends ToscaDataDefinition> Either<Pair<GraphVertex, Map<String, T>>, TitanOperationStatus> getDataAndVertexFromGraph(GraphVertex componentV, EdgeLabelEnum edgelabel) {
- Either<GraphVertex, TitanOperationStatus> dataVertex = getDataVertex(componentV, edgelabel);
+ protected <T extends ToscaDataDefinition> Either<Pair<GraphVertex, Map<String, T>>, JanusGraphOperationStatus> getDataAndVertexFromGraph(GraphVertex componentV, EdgeLabelEnum edgelabel) {
+ Either<GraphVertex, JanusGraphOperationStatus> dataVertex = getDataVertex(componentV, edgelabel);
if (dataVertex.isRight()) {
return Either.right(dataVertex.right().value());
}
@@ -212,10 +218,11 @@
return Either.left(pair);
}
- protected <T extends ToscaDataDefinition> Either<GraphVertex, TitanOperationStatus> getDataVertex(GraphVertex componentV, EdgeLabelEnum edgelabel) {
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(componentV, edgelabel, JsonParseFlagEnum.ParseJson);
+ protected <T extends ToscaDataDefinition> Either<GraphVertex, JanusGraphOperationStatus> getDataVertex(GraphVertex componentV, EdgeLabelEnum edgelabel) {
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(componentV, edgelabel, JsonParseFlagEnum.ParseJson);
if (childVertex.isRight()) {
- if (childVertex.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (childVertex.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to fetch {} for tosca element with id {}, error {}", edgelabel, componentV.getUniqueId(), childVertex.right().value());
}
return Either.right(childVertex.right().value());
@@ -231,14 +238,14 @@
* @param edgelabel
* @return
*/
- public <T extends ToscaDataDefinition> Either<Map<String, T>, TitanOperationStatus> getDataFromGraph(String toscaElementUid, EdgeLabelEnum edgelabel) {
+ public <T extends ToscaDataDefinition> Either<Map<String, T>, JanusGraphOperationStatus> getDataFromGraph(String toscaElementUid, EdgeLabelEnum edgelabel) {
- Either<Map<String, T>, TitanOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<Map<String, T>, JanusGraphOperationStatus> result = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get tosca element {} upon getting tosca data from graph. Status is {}. ", toscaElementUid, status);
result = Either.right(status);
}
@@ -248,8 +255,9 @@
return result;
}
- public Either<GraphVertex, TitanOperationStatus> findUserVertex(String userId) {
- return titanDao.getVertexByPropertyAndLabel(GraphPropertyEnum.USERID, userId, VertexTypeEnum.USER, JsonParseFlagEnum.NoParse);
+ public Either<GraphVertex, JanusGraphOperationStatus> findUserVertex(String userId) {
+ return janusGraphDao
+ .getVertexByPropertyAndLabel(GraphPropertyEnum.USERID, userId, VertexTypeEnum.USER, JsonParseFlagEnum.NoParse);
}
/**
@@ -259,17 +267,18 @@
* @return
*/
public Either<Boolean, StorageOperationStatus> isCloneNeeded(String elemementId, EdgeLabelEnum label) {
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(elemementId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(elemementId);
if (vertexById.isRight()) {
log.debug("Failed to fetch element by id {} error {}", elemementId, vertexById.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexById.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexById.right().value()));
}
GraphVertex toscaElementVertex = vertexById.left().value();
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(toscaElementVertex, label, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(toscaElementVertex, label, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
- if (childVertex.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (childVertex.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to fetch {} for tosca element with id {}, error {}", label, toscaElementVertex.getUniqueId(), childVertex.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childVertex.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childVertex.right().value()));
}
return Either.left(Boolean.FALSE);
}
@@ -287,7 +296,7 @@
}
}
- protected Either<GraphVertex, TitanOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex, EdgeLabelEnum label) {
+ protected Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex, EdgeLabelEnum label) {
// healingPipelineDao.setHealingVersion(dataVertex);
Iterator<Edge> edges = dataVertex.getVertex().edges(Direction.IN, label.name());
int edgeCount = 0;
@@ -296,24 +305,25 @@
Edge edge = edges.next();
++edgeCount;
Vertex outVertex = edge.outVertex();
- String outId = (String) titanDao.getProperty((TitanVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String outId = (String) janusGraphDao
+ .getProperty((JanusGraphVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
if (toscaElementVertex.getUniqueId().equals(outId)) {
edgeToRemove = edge;
}
}
if (edgeToRemove == null) {
log.debug("No edges {} from vertex {} to vertex {}", label, toscaElementVertex.getUniqueId(), dataVertex.getUniqueId());
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
switch (edgeCount) {
case 0:
// error
log.debug("No edges {} to vertex {}", label, dataVertex.getUniqueId());
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
case 1:
// update
log.trace("Only one edge {} to vertex {}. Update vertex", label, dataVertex.getUniqueId());
- return titanDao.updateVertex(dataVertex);
+ return janusGraphDao.updateVertex(dataVertex);
default:
// copy on update
log.trace("More than one edge {} to vertex {}. Need to clone vertex", label, dataVertex.getUniqueId());
@@ -321,20 +331,22 @@
}
}
- private Either<GraphVertex, TitanOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, EdgeLabelEnum label, Edge edgeToRemove) {
+ private Either<GraphVertex, JanusGraphOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, EdgeLabelEnum label, Edge edgeToRemove) {
GraphVertex newDataVertex = new GraphVertex(dataVertex.getLabel());
String id = IdBuilderUtils.generateChildId(toscaElementVertex.getUniqueId(), dataVertex.getLabel());
newDataVertex.cloneData(dataVertex);
newDataVertex.setUniqueId(id);
- Either<GraphVertex, TitanOperationStatus> createVertex = titanDao.createVertex(newDataVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(newDataVertex);
if (createVertex.isRight()) {
log.debug("Failed to clone data vertex for {} error {}", dataVertex.getUniqueId(), createVertex.right().value());
return createVertex;
}
newDataVertex = createVertex.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(toscaElementVertex, newDataVertex, label, titanDao.getEdgeProperties(edgeToRemove));
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(toscaElementVertex, newDataVertex, label, janusGraphDao.getEdgeProperties(edgeToRemove));
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.debug("Failed to associate vertex {} to vertex {}, error {}", toscaElementVertex.getUniqueId(), newDataVertex.getUniqueId(), createEdge);
return Either.right(createEdge);
}
@@ -347,16 +359,18 @@
String id = IdBuilderUtils.generateChildId(element.getUniqueId(), vertexLabel);
dataV.setUniqueId(id);
dataV.setJson(data);
- Either<GraphVertex, TitanOperationStatus> createVertex = titanDao.createVertex(dataV);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(dataV);
if (createVertex.isRight()) {
log.trace("Failed to create {} vertex for type node {}", vertexLabel, element.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createVertex.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createVertex.right().value()));
}
dataV = createVertex.left().value();
- TitanOperationStatus createEdgeStatus = titanDao.createEdge(element.getVertex(), dataV.getVertex(), edgeLabel, new HashMap<>());
- if (createEdgeStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdgeStatus = janusGraphDao
+ .createEdge(element.getVertex(), dataV.getVertex(), edgeLabel, new HashMap<>());
+ if (createEdgeStatus != JanusGraphOperationStatus.OK) {
log.trace("Failed to create {} vertex for type node {}", vertexLabel, element.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdgeStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdgeStatus));
}
return Either.left(dataV);
}
@@ -533,13 +547,13 @@
JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null && CollectionUtils.isNotEmpty(toscaDataList)) {
statusRes = updateToscaDataDeepElementsOfToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, toscaDataList, pathKeys, mapKeyField);
@@ -551,22 +565,22 @@
}
StorageOperationStatus overrideToscaDataOfToscaElement(String toscaElementUid, EdgeLabelEnum edgeLabel, Map<String, ? extends ToscaDataDefinition> toscaData) {
- return titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse)
.left()
.bind(graphVertex -> overrideToscaElementData(graphVertex, toscaData, edgeLabel))
.either(graphVertex -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
- private Either<GraphVertex, TitanOperationStatus> overrideToscaElementData(GraphVertex toscaElement, Map<String, ? extends ToscaDataDefinition> toscaData, EdgeLabelEnum edgeLabelEnum) {
- return titanDao.getChildVertex(toscaElement, edgeLabelEnum, JsonParseFlagEnum.ParseJson)
+ private Either<GraphVertex, JanusGraphOperationStatus> overrideToscaElementData(GraphVertex toscaElement, Map<String, ? extends ToscaDataDefinition> toscaData, EdgeLabelEnum edgeLabelEnum) {
+ return janusGraphDao.getChildVertex(toscaElement, edgeLabelEnum, JsonParseFlagEnum.ParseJson)
.left()
.bind(dataVertex -> overrideToscaElementData(dataVertex, toscaElement, toscaData, edgeLabelEnum))
.right()
.map(err -> logAndReturn(err, "failed to override tosca data for element {} of type {}. status: {}", toscaElement.getUniqueId(), edgeLabelEnum, err));
}
- private Either<GraphVertex, TitanOperationStatus> overrideToscaElementData(GraphVertex dataElement, GraphVertex toscaElement, Map<String, ? extends ToscaDataDefinition> toscaData, EdgeLabelEnum edgeLabelEnum) {
+ private Either<GraphVertex, JanusGraphOperationStatus> overrideToscaElementData(GraphVertex dataElement, GraphVertex toscaElement, Map<String, ? extends ToscaDataDefinition> toscaData, EdgeLabelEnum edgeLabelEnum) {
dataElement.setJson(toscaData);
return updateOrCopyOnUpdate(dataElement, toscaElement, edgeLabelEnum);
}
@@ -586,13 +600,13 @@
JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null && CollectionUtils.isNotEmpty(toscaDataList)) {
statusRes = addToscaDataDeepElementsToToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, toscaDataList, pathKeys, mapKeyField);
@@ -606,13 +620,13 @@
public <T extends ToscaDataDefinition> StorageOperationStatus deleteToscaDataDeepElementsBlockOfToscaElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, String key) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null) {
statusRes = deleteToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, key);
@@ -627,22 +641,23 @@
StorageOperationStatus result = null;
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
if (toscaDataVertexRes.isRight()) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
toscaDataVertex = toscaDataVertexRes.left().value();
result = deleteDeepElementsBlock(toscaDataVertex, key);
}
if (result == null) {
- Either<GraphVertex, TitanOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
+ Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
if (updateOrCopyRes.isRight()) {
- TitanOperationStatus status = updateOrCopyRes.right().value();
+ JanusGraphOperationStatus status = updateOrCopyRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete tosca data block {} from the tosca element {}. Status is {}. ", edgeLabel, toscaElement.getUniqueId(), status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
if (result == null) {
@@ -655,13 +670,13 @@
public <T extends ToscaDataDefinition> StorageOperationStatus addToscaDataDeepElementsBlockToToscaElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, MapDataDefinition toscaDataMap, String key) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null && toscaDataMap != null) {
statusRes = addToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, toscaDataMap, key);
@@ -677,11 +692,12 @@
StorageOperationStatus result = null;
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
- if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null && toscaDataVertexRes.isLeft()) {
toscaDataVertex = toscaDataVertexRes.left().value();
@@ -690,11 +706,11 @@
}
if (result == null) {
if (toscaDataVertex != null) {
- Either<GraphVertex, TitanOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
+ Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
if (updateOrCopyRes.isRight()) {
- TitanOperationStatus status = updateOrCopyRes.right().value();
+ JanusGraphOperationStatus status = updateOrCopyRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add tosca data {} to the tosca element {}. Status is {}. ", edgeLabel, toscaElement.getUniqueId(), status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
} else {
Map<String, MapDataDefinition> data = new HashMap<>();
@@ -722,20 +738,20 @@
* @return the status of the update operation
*/
public <T extends ToscaDataDefinition> StorageOperationStatus updateToscaDataDeepElementsBlockToToscaElement(String toscaElementId, EdgeLabelEnum edgeLabel, MapDataDefinition<T> toscaDataMap, String key) {
- return titanDao.getVertexById(toscaElementId, JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(toscaElementId, JsonParseFlagEnum.NoParse)
.either(toscaElement -> updateToscaDataDeepElementsBlockToToscaElement(toscaElement, edgeLabel, toscaDataMap, key),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private <T extends ToscaDataDefinition> StorageOperationStatus updateToscaDataDeepElementsBlockToToscaElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, MapDataDefinition<T> toscaDataMap, String key) {
- return titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson)
+ return janusGraphDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson)
.left()
.bind(dataVertex -> updateToscaDataDeepElementsBlockToToscaElement(toscaElement, dataVertex, edgeLabel, toscaDataMap, key))
.either(updatedVertex -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
- private <T extends ToscaDataDefinition> Either<GraphVertex, TitanOperationStatus> updateToscaDataDeepElementsBlockToToscaElement(GraphVertex toscaElement, GraphVertex dataElement, EdgeLabelEnum edgeLabel, MapDataDefinition<T> toscaDataMap, String key) {
+ private <T extends ToscaDataDefinition> Either<GraphVertex, JanusGraphOperationStatus> updateToscaDataDeepElementsBlockToToscaElement(GraphVertex toscaElement, GraphVertex dataElement, EdgeLabelEnum edgeLabel, MapDataDefinition<T> toscaDataMap, String key) {
Map<String, T> mapToscaDataDefinition = toscaDataMap.getMapToscaDataDefinition();
updateDeepElements(dataElement, mapToscaDataDefinition, Collections.singletonList(key));
return updateOrCopyOnUpdate(dataElement, toscaElement, edgeLabel)
@@ -773,13 +789,13 @@
public <T extends ToscaDataDefinition> StorageOperationStatus updateToscaDataOfToscaElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, List<T> toscaDataList, JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null && CollectionUtils.isNotEmpty(toscaDataList)) {
statusRes = updateToscaDataOfToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, toscaDataList, mapKeyField);
@@ -803,13 +819,13 @@
public <T extends ToscaDataDefinition> StorageOperationStatus addToscaDataToToscaElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, List<T> toscaDataList, JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null && CollectionUtils.isNotEmpty(toscaDataList)) {
statusRes = addToscaDataToToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, toscaDataList, mapKeyField);
@@ -866,7 +882,8 @@
}
public boolean hasEdgeOfType(GraphVertex toscaElement, EdgeLabelEnum edgeLabel) {
- Either<GraphVertex, TitanOperationStatus> vertex = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> vertex = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
return vertex.isLeft();
}
@@ -877,11 +894,12 @@
Map<String, T> existingToscaDataMap = null;
Either<Map<String, T>, StorageOperationStatus> validateRes = null;
Map<String, T> mergedToscaDataMap;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
- if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
if (toscaDataVertexRes.isLeft()) {
@@ -912,11 +930,12 @@
GraphVertex toscaDataVertex = null;
Map<String, T> existingToscaDataMap = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
- if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
if (toscaDataVertexRes.isLeft()) {
@@ -945,11 +964,12 @@
GraphVertex toscaDataVertex = null;
Map<String, K> existingDeepElementsMap = null;
Either<Map<String, K>, StorageOperationStatus> validateRes = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
- if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ if (toscaDataVertexRes.isRight() && toscaDataVertexRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
if (toscaDataVertexRes.isLeft()) {
@@ -1064,13 +1084,13 @@
public StorageOperationStatus removeToscaData(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
statusRes = removeToscaDataVertex(getToscaElementRes.left().value(), edgeLabel, vertexLabel);
@@ -1093,11 +1113,12 @@
int edgeCounter = 0;
Edge edge = null;
Edge edgeToDelete = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
if (toscaDataVertexRes.isRight()) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_REMOVE_TOSCA_DATA_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
toscaDataVertex = toscaDataVertexRes.left().value();
@@ -1147,13 +1168,13 @@
public StorageOperationStatus deleteToscaDataElements(String toscaElementUid, EdgeLabelEnum edgeLabel, List<String> uniqueKeys) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
statusRes = deleteToscaDataElements(getToscaElementRes.left().value(), edgeLabel, uniqueKeys);
@@ -1174,13 +1195,13 @@
public StorageOperationStatus deleteToscaDataElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, String uniqueKey, JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
statusRes = deleteToscaDataElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, uniqueKey, mapKeyField);
@@ -1203,13 +1224,13 @@
public StorageOperationStatus deleteToscaDataDeepElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, String uniqueKey, List<String> pathKeys, JsonPresentationFields mapKeyField) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_TOSCA_ELEMENT_UPON_ADDING_THE_PROPERTIES_STATUS_IS, toscaElementUid, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
statusRes = deleteToscaDataDeepElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, uniqueKey, pathKeys, mapKeyField);
@@ -1241,11 +1262,12 @@
StorageOperationStatus result = null;
GraphVertex toscaDataVertex;
Map<String, ToscaDataDefinition> existingToscaDataMap = null;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
if (toscaDataVertexRes.isRight()) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
toscaDataVertex = toscaDataVertexRes.left().value();
@@ -1300,11 +1322,12 @@
StorageOperationStatus result = null;
GraphVertex toscaDataVertex;
Map<String, ToscaDataDefinition> existingToscaDataMap;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = titanDao.getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = janusGraphDao
+ .getChildVertex(toscaElement, edgeLabel, JsonParseFlagEnum.ParseJson);
if (toscaDataVertexRes.isRight()) {
- TitanOperationStatus status = toscaDataVertexRes.right().value();
+ JanusGraphOperationStatus status = toscaDataVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_CHILD_VERTEX_OF_THE_TOSCA_ELEMENT_BY_LABEL_STATUS_IS, toscaElement.getUniqueId(), edgeLabel, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(toscaDataVertexRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toscaDataVertexRes.right().value());
}
if (result == null) {
toscaDataVertex = toscaDataVertexRes.left().value();
@@ -1334,9 +1357,9 @@
private <T extends ToscaDataDefinition> StorageOperationStatus updateToscaDataElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, GraphVertex toscaDataVertex) {
StorageOperationStatus result = StorageOperationStatus.OK;
- Either<GraphVertex, TitanOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
+ Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
if (updateOrCopyRes.isRight()) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(updateOrCopyRes.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateOrCopyRes.right().value());
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update tosca data {} of the tosca element {}. Status is {}. ", edgeLabel, toscaElement.getUniqueId(), result);
}
return result;
@@ -1363,11 +1386,11 @@
}
} else {
toscaDataVertex.setJson(mergedToscaDataMap);
- Either<GraphVertex, TitanOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
+ Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyRes = updateOrCopyOnUpdate(toscaDataVertex, toscaElement, edgeLabel);
if (updateOrCopyRes.isRight()) {
- TitanOperationStatus status = updateOrCopyRes.right().value();
+ JanusGraphOperationStatus status = updateOrCopyRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add tosca data {} to the tosca element {}. Status is {}. ", edgeLabel, toscaElement.getUniqueId(), status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
return result;
@@ -1417,9 +1440,9 @@
}
// public StorageOperationStatus updateDataOnGraph(GraphVertex dataVertex) {
-// Either<GraphVertex, TitanOperationStatus> updateVertex = titanDao.updateVertex(dataVertex);
+// Either<GraphVertex, JanusGraphOperationStatus> updateVertex = janusGraphDao.updateVertex(dataVertex);
// if (updateVertex.isRight()) {
-// return DaoStatusConverter.convertTitanStatusToStorageStatus(updateVertex.right().value());
+// return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateVertex.right().value());
// }
// return StorageOperationStatus.OK;
// }
@@ -1480,12 +1503,12 @@
properties.forEach(PropertyDataDefinition::convertPropertyDataToInstancePropertyData);
}
- private TitanOperationStatus logAndReturn(TitanOperationStatus titanOperationStatus, String logMsg, Object ... logParams) {
+ private JanusGraphOperationStatus logAndReturn(JanusGraphOperationStatus janusGraphOperationStatus, String logMsg, Object ... logParams) {
log.debug(logMsg, logParams);
- return titanOperationStatus;
+ return janusGraphOperationStatus;
}
- protected GraphVertex throwStorageException(TitanOperationStatus status) {
+ protected GraphVertex throwStorageException(JanusGraphOperationStatus status) {
throw new StorageException(status);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ByToscaNameDerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
similarity index 81%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ByToscaNameDerivedNodeTypeResolver.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
index 5748629..a34dd7e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ByToscaNameDerivedNodeTypeResolver.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
@@ -40,16 +40,17 @@
public class ByToscaNameDerivedNodeTypeResolver implements DerivedNodeTypeResolver {
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Override
- public Either<List<GraphVertex>, TitanOperationStatus> findDerivedResources(String parentResource) {
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new HashMap<>();
propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource);
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.NoParse);
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.NoParse);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperation.java
similarity index 95%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperation.java
index 9d7f64c..3b544aa 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.collections.MapUtils;
@@ -31,8 +31,8 @@
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.slf4j.Logger;
@@ -98,7 +98,8 @@
private StorageOperationStatus createOrUpdateCapabilityProperties(String componentId, TopologyTemplate toscaElement,
Map<String, MapPropertiesDataDefinition> propertiesMap) {
- GraphVertex toscaElementV = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ GraphVertex toscaElementV = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum
+ .NoParse)
.left().on(this::throwStorageException);
Map<String, MapPropertiesDataDefinition> capabilitiesProperties = toscaElement.getCapabilitiesProperties();
if(MapUtils.isNotEmpty(capabilitiesProperties)) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CategoryOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CategoryOperation.java
similarity index 80%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CategoryOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CategoryOperation.java
index 88f0ea3..7603657 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/CategoryOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CategoryOperation.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -53,12 +53,14 @@
String categoryUid = UniqueIdBuilder.buildComponentCategoryUid(name, type);
Map<GraphPropertyEnum, Object> props = new HashMap<>();
props.put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(name));
- Either<List<GraphVertex>, TitanOperationStatus> either = titanDao.getByCriteria(type, props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> either = janusGraphDao
+ .getByCriteria(type, props);
if (either.isRight()) {
- TitanOperationStatus titanOperationStatus = either.right().value();
- log.debug("Problem while geting category with id {}. reason - {}", categoryUid, titanOperationStatus.name());
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = either.right().value();
+ log.debug("Problem while geting category with id {}. reason - {}", categoryUid, janusGraphOperationStatus
+ .name());
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND);
} else {
return Either.right(StorageOperationStatus.GENERAL_ERROR);
@@ -76,10 +78,11 @@
* @return
*/
public Either<GraphVertex, StorageOperationStatus> getSubCategoryForCategory(GraphVertex categoryV, String name ) {
- Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = titanDao.getChildrenVertecies(categoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies = janusGraphDao
+ .getChildrenVertecies(categoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
if ( childrenVertecies.isRight() ){
log.debug("Failed to fetch children verticies for category {} error {}", categoryV.getUniqueId(), childrenVertecies.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenVertecies.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenVertecies.right().value()));
}
for ( GraphVertex childV : childrenVertecies.left().value() ){
if ( childV.getMetadataProperty(GraphPropertyEnum.NAME).equals(name) ){
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java
similarity index 85%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java
index 70cfc5d..6079c5e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java
@@ -1,15 +1,15 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs;
-import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.impl.OperationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -34,8 +34,8 @@
/**
* Constructor
*/
- public ExternalReferencesOperation(TitanDao titanDao, NodeTypeOperation nto, TopologyTemplateOperation tto, IdMapper idMapper){
- this.titanDao = titanDao;
+ public ExternalReferencesOperation(JanusGraphDao janusGraphDao, NodeTypeOperation nto, TopologyTemplateOperation tto, IdMapper idMapper){
+ this.janusGraphDao = janusGraphDao;
this.topologyTemplateOperation = tto;
this.nodeTypeOperation = nto;
this.idMapper = idMapper;
@@ -43,26 +43,26 @@
public Either<String, ActionStatus> addExternalReferenceWithCommit(String serviceUuid, String componentInstanceName, String objectType, String reference) {
Either<String, ActionStatus> addResult = addExternalReference(serviceUuid, componentInstanceName, objectType, reference);
- titanDao.commit();
+ janusGraphDao.commit();
return addResult;
}
public Either<String, ActionStatus> deleteExternalReferenceWithCommit(String serviceUuid, String componentInstanceName, String objectType, String reference) {
Either<String, ActionStatus> result = deleteExternalReference(serviceUuid, componentInstanceName, objectType, reference);
- titanDao.commit();
+ janusGraphDao.commit();
return result;
}
public Either<String, ActionStatus> updateExternalReferenceWithCommit(String serviceVertexUuid, String componentInstanceName, String objectType, String oldRef, String newRef) {
Either<String, ActionStatus> updateResult = updateExternalReference(serviceVertexUuid, componentInstanceName, objectType, oldRef, newRef);
- titanDao.commit();
+ janusGraphDao.commit();
return updateResult;
}
public Either<String, ActionStatus> addExternalReference(String assetUuid, String componentInstanceName, String objectType, String reference) {
//Get Container vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
@@ -75,7 +75,7 @@
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
@@ -99,7 +99,7 @@
public Either<String, ActionStatus> deleteExternalReference(String assetUuid, String componentInstanceName, String objectType, String reference){
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
@@ -111,7 +111,7 @@
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
@@ -133,7 +133,7 @@
public Either<String, ActionStatus> updateExternalReference(String assetUuid, String componentInstanceName, String objectType, String oldRef, String newRef) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
@@ -147,7 +147,7 @@
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
@@ -168,7 +168,7 @@
public Either<Map<String, List<String>>, ActionStatus> getExternalReferences(String assetUuid, String objectType) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
@@ -178,7 +178,7 @@
Map<String, List<String>> result = new HashMap();
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
if (externalRefsVertex != null) {
@@ -203,10 +203,10 @@
String compInstanceUniqueId,
Map<String, List<String>> instanceExternalReferences) {
- GraphVertex serviceVertex = titanDao.getVertexById(containerUniqueId)
+ GraphVertex serviceVertex = janusGraphDao.getVertexById(containerUniqueId)
.left()
- .on(operationUtils::onTitanOperationFailure);
- Either<GraphVertex, TitanOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ .on(operationUtils::onJanusGraphOperationFailure);
+ Either<GraphVertex, JanusGraphOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
Map<String, MapComponentInstanceExternalRefs> externalReferencesFullData;
if (dataVertex.isLeft()) {
externalReferencesFullData = (Map<String, MapComponentInstanceExternalRefs>) dataVertex.left().value().getJson();
@@ -219,11 +219,11 @@
public Map<String, List<String>> getAllExternalReferences(String containerUniqueId,
String compInstanceUniqueId) {
- GraphVertex serviceVertex = titanDao.getVertexById(containerUniqueId)
+ GraphVertex serviceVertex = janusGraphDao.getVertexById(containerUniqueId)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
- Either<GraphVertex, TitanOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ Either<GraphVertex, JanusGraphOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
if (dataVertex.isRight()) {
return new HashMap<>();
}
@@ -239,7 +239,7 @@
public Either<List<String>, ActionStatus> getExternalReferences(String assetUuid, String componentInstanceName, String objectType) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
@@ -251,7 +251,7 @@
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ForwardingPathOperation.java
similarity index 86%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ForwardingPathOperation.java
index 0d82b0f..f7372a6 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ForwardingPathOperation.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.Service;
@@ -43,13 +43,14 @@
public Either<Set<String>, StorageOperationStatus> deleteForwardingPath(Service service, Set<String> forwardingPathsToDelete) {
Either<Set<String>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex;
StorageOperationStatus status = null;
if (result == null) {
- getComponentVertex = titanDao.getVertexById(service.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao
+ .getVertexById(service.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
}
if (result == null) {
@@ -78,13 +79,13 @@
private Either<ForwardingPathDataDefinition, StorageOperationStatus> addOrUpdateForwardingPath(boolean isUpdateAction, String serviceId, ForwardingPathDataDefinition currentPath) {
StorageOperationStatus statusRes;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(serviceId, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(serviceId, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(log, CommonUtility.LogLevelEnum.DEBUG, "Failed to get tosca element {} upon adding the properties. Status is {}. ", serviceId, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
return Either.right(statusRes);
}
GraphVertex serviceVertex = getToscaElementRes.left().value();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
similarity index 86%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
index b417f83..03bab3b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
@@ -18,21 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.collections.MapUtils;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -126,12 +126,12 @@
public Either<List<GroupDefinition>, StorageOperationStatus> createGroups(Component component, Map<String, GroupDataDefinition> groups) {
Either<List<GroupDefinition>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = null;
StorageOperationStatus status = null;
- getComponentVertex = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
status = topologyTemplateOperation.associateGroupsToComponent(getComponentVertex.left().value(), groups);
@@ -147,12 +147,12 @@
public <T extends GroupDataDefinition> Either<List<GroupDefinition>, StorageOperationStatus> addGroups(Component component, List<T> groups) {
Either<List<GroupDefinition>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex;
StorageOperationStatus status;
- getComponentVertex = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
status = addToscaDataToToscaElement(component.getUniqueId(), EdgeLabelEnum.GROUPS, VertexTypeEnum.GROUPS, groups, JsonPresentationFields.NAME);
@@ -171,12 +171,12 @@
public Either<List<GroupDefinition>, StorageOperationStatus> deleteGroups(Component component, List<GroupDataDefinition> groups) {
Either<List<GroupDefinition>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = null;
StorageOperationStatus status = null;
- getComponentVertex = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
List<String> groupName = groups.stream().map(GroupDataDefinition::getName).collect(Collectors.toList());
@@ -196,12 +196,12 @@
public <T extends GroupDataDefinition> Either<List<GroupDefinition>, StorageOperationStatus> updateGroups(Component component, List<T> groups, boolean promoteVersion) {
Either<List<GroupDefinition>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = null;
StorageOperationStatus status = null;
- getComponentVertex = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
groups.forEach(gr -> {
@@ -233,9 +233,9 @@
}
public void updateGroupOnComponent(String componentId, GroupDefinition groupDefinition) {
- GraphVertex componentVertex = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
+ GraphVertex componentVertex = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
.left()
- .on(this::onTitanError);
+ .on(this::onJanusGraphError);
StorageOperationStatus updateToscaResult = updateToscaDataOfToscaElement(componentVertex, EdgeLabelEnum.GROUPS, VertexTypeEnum.GROUPS, groupDefinition,
JsonPresentationFields.NAME);
@@ -249,26 +249,26 @@
private void updateLastUpdateDate(GraphVertex componentVertex) {
componentVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
- titanDao.updateVertex(componentVertex)
+ janusGraphDao.updateVertex(componentVertex)
.left()
- .on(this::onTitanError);
+ .on(this::onJanusGraphError);
}
- GraphVertex onTitanError(TitanOperationStatus titanOperationStatus) {
+ GraphVertex onJanusGraphError(JanusGraphOperationStatus janusGraphOperationStatus) {
throw new StorageException(
- DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(janusGraphOperationStatus));
}
public Either<List<GroupProperty>, StorageOperationStatus> updateGroupPropertiesOnComponent(String componentId, GroupDefinition group, List<GroupProperty> newGroupProperties) {
Either<List<GroupProperty>, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = null;
GraphVertex componentVertex = null;
- getComponentVertex = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ getComponentVertex = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getComponentVertex.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch component {}. Status is {} ", componentId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
componentVertex = getComponentVertex.left().value();
@@ -289,10 +289,10 @@
}
if (result == null) {
componentVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
- Either<GraphVertex, TitanOperationStatus> updateRes = titanDao.updateVertex(componentVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateRes = janusGraphDao.updateVertex(componentVertex);
if (updateRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the component {}. Status is {} ", componentId, updateRes.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateRes.right().value()));
}
}
if (result == null) {
@@ -323,9 +323,10 @@
Either<List<GroupInstance>, StorageOperationStatus> result = null;
StorageOperationStatus status = null;
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = janusGraphDao
+ .getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
if (result == null) {
List<String> pathKeys = new ArrayList<>();
@@ -369,10 +370,11 @@
public Either<GroupInstance, StorageOperationStatus> updateGroupInstancePropertyValuesOnGraph(String componentId, String instanceId, GroupInstance oldGroupInstance, List<GroupInstanceProperty> newProperties) {
- Either<GraphVertex, TitanOperationStatus> getComponentVertex = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getComponentVertex.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch component {}. Status is {} ", componentId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
List<PropertyDataDefinition> propertiesOld = oldGroupInstance.getProperties();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InstancesOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InstancesOperation.java
similarity index 94%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InstancesOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InstancesOperation.java
index 84814e4..3378e03 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InstancesOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InstancesOperation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
public class InstancesOperation extends BaseOperation {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
similarity index 92%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
index b4433d1..0b6f48f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import java.util.Collections;
@@ -22,9 +22,9 @@
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
+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.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@@ -78,10 +78,10 @@
return Either.right(statusRes);
}
- Either<Map<String, InterfaceDataDefinition>, TitanOperationStatus> componentEither =
+ Either<Map<String, InterfaceDataDefinition>, JanusGraphOperationStatus> componentEither =
getDataFromGraph(componentId, EdgeLabelEnum.INTERFACE);
if (componentEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(componentEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(componentEither.right().value()));
}
Map<String, InterfaceDataDefinition> interfaceDataDefinitionMap = componentEither.left().value();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java
similarity index 88%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java
index 7b3076a..13ad534 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -26,11 +26,12 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition;
@@ -48,18 +49,18 @@
public Either<Set<String>, StorageOperationStatus> deleteNodeFilters(Service service,
Set<String> componentInstanceIds) {
- Either<GraphVertex, TitanOperationStatus> getComponentVertex;
- Either<GraphVertex, TitanOperationStatus> getNodeFilterVertex;
+ Either<GraphVertex, JanusGraphOperationStatus> getComponentVertex;
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeFilterVertex;
StorageOperationStatus status;
- getComponentVertex = titanDao.getVertexById(service.getUniqueId(), JsonParseFlagEnum.NoParse);
+ getComponentVertex = janusGraphDao.getVertexById(service.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getComponentVertex.isRight()) {
return Either.right(
- DaoStatusConverter.convertTitanStatusToStorageStatus(getComponentVertex.right().value()));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value()));
}
getNodeFilterVertex =
- titanDao.getChildVertex(getComponentVertex.left().value(), EdgeLabelEnum.NODE_FILTER_TEMPLATE,
+ janusGraphDao.getChildVertex(getComponentVertex.left().value(), EdgeLabelEnum.NODE_FILTER_TEMPLATE,
JsonParseFlagEnum.NoParse);
if (getNodeFilterVertex.isLeft()) {
status = deleteToscaDataElements(service.getUniqueId(), EdgeLabelEnum.NODE_FILTER_TEMPLATE,
@@ -132,27 +133,27 @@
String serviceId, String componentInstanceId, CINodeFilterDataDefinition ciNodeFilterDataDefinition) {
StorageOperationStatus statusRes;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
- getToscaElementRes = titanDao.getVertexById(serviceId, JsonParseFlagEnum.NoParse);
+ getToscaElementRes = janusGraphDao.getVertexById(serviceId, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- TitanOperationStatus status = getToscaElementRes.right().value();
+ JanusGraphOperationStatus status = getToscaElementRes.right().value();
CommonUtility.addRecordToLog(logger, CommonUtility.LogLevelEnum.DEBUG,
"Failed to get tosca element {} upon adding the properties. Status is {}. ", serviceId, status);
- statusRes = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
return Either.right(statusRes);
}
GraphVertex serviceVertex = getToscaElementRes.left().value();
ciNodeFilterDataDefinition.setID(componentInstanceId);
statusRes = performUpdateToscaAction(isUpdateAction, serviceVertex, ImmutableList.of(ciNodeFilterDataDefinition));
if (!statusRes.equals(StorageOperationStatus.OK)) {
- titanDao.rollback();
+ janusGraphDao.rollback();
logger.error(
" Failed to perform tosca update for node filter in service {} , component instance {}. status is {}",
serviceId, componentInstanceId, statusRes);
return Either.right(statusRes);
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(ciNodeFilterDataDefinition);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
similarity index 92%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index de396b4..2861337 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@@ -31,13 +31,13 @@
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
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.jsongraph.utils.JsonParserUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
@@ -80,12 +80,12 @@
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -138,13 +138,14 @@
ComponentInstanceDataDefinition componentInstanceData = null;
Either<String, StorageOperationStatus> newInstanceNameRes = null;
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseJson);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
@@ -335,7 +336,8 @@
Map<String, MapPropertiesDataDefinition> instPropertiesMap = new HashMap<>();
instPropertiesMap.put(componentInstance.getUniqueId(), instProperties);
updatedContainer.setInstProperties(instPropertiesMap);
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes = titanDao.getVertexById(updatedContainer.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes = janusGraphDao
+ .getVertexById(updatedContainer.getUniqueId(), JsonParseFlagEnum.NoParse);
if(getToscaElementRes.isLeft()){
deleteToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), EdgeLabelEnum.INST_PROPERTIES,
VertexTypeEnum.INST_PROPERTIES, componentInstance.getUniqueId());
@@ -410,7 +412,7 @@
String containerComponentId = container.getUniqueId();
CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to create component instance {} in component {}", componentInstance, containerComponentId);
String instOriginComponentId = componentInstance.getComponentUid();
- Either<GraphVertex, TitanOperationStatus> updateElement = null;
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = null;
Boolean isDeleted = (Boolean) originToscaElement.getMetadataValue(JsonPresentationFields.IS_DELETED);
@@ -428,10 +430,10 @@
container.addComponentInstance(componentInstance);
metadataVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
topologyTemplateOperation.fillToscaElementVertexData(metadataVertex, container, JsonParseFlagEnum.ParseAll);
- updateElement = titanDao.updateVertex(metadataVertex);
+ updateElement = janusGraphDao.updateVertex(metadataVertex);
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_UPDATE_TOPOLOGY_TEMPLATE_WITH_NEW_COMPONENT_INSTANCE, container.getName(), componentInstance.getName());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value()));
}
}
if (result == null) {
@@ -467,23 +469,25 @@
CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update component instance metadata {} of container component {}", componentInstance, containerComponentId);
ComponentInstanceDataDefinition componentInstanceData = null;
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
componentInstanceData = buildComponentInstanceDataDefinition(componentInstance, container.getUniqueId(), componentInstance.getName(), false, originToscaElement);
container.addComponentInstance(componentInstanceData);
metadataVertex.left().value().setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
topologyTemplateOperation.fillToscaElementVertexData(metadataVertex.left().value(), container, JsonParseFlagEnum.ParseAll);
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(metadataVertex.left().value());
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao
+ .updateVertex(metadataVertex.left().value());
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_UPDATE_TOPOLOGY_TEMPLATE_WITH_NEW_COMPONENT_INSTANCE, container.getName(), componentInstance.getName());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value()));
}
}
if (result == null) {
@@ -507,21 +511,23 @@
String containerComponentId = container.getUniqueId();
CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update component instance metadata of container component {}", containerComponentId);
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
metadataVertex.left().value().setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
topologyTemplateOperation.fillToscaElementVertexData(metadataVertex.left().value(), container, JsonParseFlagEnum.ParseAll);
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(metadataVertex.left().value());
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao
+ .updateVertex(metadataVertex.left().value());
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update topology template {}. ", container.getName());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value()));
}
}
if (result == null) {
@@ -545,13 +551,14 @@
String containerComponentId = container.getUniqueId();
CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update component instance metadata {} of container component {}", componentInstanceId, containerComponentId);
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
GraphVertex containerV = null;
ComponentInstanceDataDefinition removedComponentInstance = null;
@@ -566,10 +573,10 @@
containerV.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
topologyTemplateOperation.fillToscaElementVertexData(containerV, container, JsonParseFlagEnum.ParseAll);
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(containerV);
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao.updateVertex(containerV);
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_UPDATE_TOPOLOGY_TEMPLATE_WITH_NEW_COMPONENT_INSTANCE, container.getName(), componentInstanceId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value()));
}
}
if (result == null) {
@@ -1248,11 +1255,12 @@
@SuppressWarnings({ "unchecked" })
public <T extends ToscaDataDefinition> Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances(String componentId, List<RequirementCapabilityRelDef> relations) {
- Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> containerVEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (containerVEither.isRight()) {
- TitanOperationStatus error = containerVEither.right().value();
+ JanusGraphOperationStatus error = containerVEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR, componentId, error);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
GraphVertex containerV = containerVEither.left().value();
Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
@@ -1294,7 +1302,8 @@
if (relationships == null || relationships.isEmpty()) {
BeEcompErrorManager.getInstance().logBeFailedAddingResourceInstanceError("AssociateResourceInstances - missing relationship", fromNode, componentId);
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "No requirement definition sent in order to set the relation between {} to {}", fromNode, toNode);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ILLEGAL_ARGUMENT));
}
for (CapabilityRequirementRelationship immutablePair : relationships) {
@@ -1353,43 +1362,43 @@
Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult, Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult,
Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult) {
containerV.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(containerV);
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao.updateVertex(containerV);
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update topology template {} with new relations error {}. ", componentId, updateElement.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value());
}
// update cap/req jsons, fulfilled cap/req jsons!!!!!
- Either<GraphVertex, TitanOperationStatus> status;
+ Either<GraphVertex, JanusGraphOperationStatus> status;
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Update calculated capabilty for container {}", containerV.getUniqueId());
status = updateOrCopyOnUpdate(capResult.left().value().getLeft(), containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (status.isRight()) {
- TitanOperationStatus error = status.right().value();
+ JanusGraphOperationStatus error = status.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update calculated capabilty for container {} error {}", containerV.getUniqueId(), error);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(error);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error);
}
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Update calculated requirement for container {}", containerV.getUniqueId());
status = updateOrCopyOnUpdate(reqResult.left().value().getLeft(), containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
if (status.isRight()) {
- TitanOperationStatus error = status.right().value();
+ JanusGraphOperationStatus error = status.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update calculated requiremnt for container {} error {}", containerV.getUniqueId(), error);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(error);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error);
}
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Update fullfilled capabilty for container {}", containerV.getUniqueId());
status = updateOrCopyOnUpdate(capFullResult.left().value().getLeft(), containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
if (status.isRight()) {
- TitanOperationStatus error = status.right().value();
+ JanusGraphOperationStatus error = status.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update fullfilled capabilty for container {} error {}", containerV.getUniqueId(), error);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(error);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error);
}
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Update fullfilled requirement for container {}", containerV.getUniqueId());
status = updateOrCopyOnUpdate(reqFullResult.left().value().getLeft(), containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
if (status.isRight()) {
- TitanOperationStatus error = status.right().value();
+ JanusGraphOperationStatus error = status.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update fullfilled requirement for container {} error {}", containerV.getUniqueId(), error);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(error);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error);
}
return StorageOperationStatus.OK;
}
@@ -1404,11 +1413,12 @@
String fromResInstanceUid = requirementDef.getFromNode();
String toResInstanceUid = requirementDef.getToNode();
- Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> containerVEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (containerVEither.isRight()) {
- TitanOperationStatus error = containerVEither.right().value();
+ JanusGraphOperationStatus error = containerVEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR, componentId, error);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
GraphVertex containerV = containerVEither.left().value();
@@ -1523,11 +1533,12 @@
MapListRequirementDataDefinition reqMapOfLists = null;
Optional<RequirementDataDefinition> foundRequirement;
RelationshipInfo relationshipInfo = foundRelation.resolveSingleRelationship().getRelation();
- Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> containerVEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (containerVEither.isRight()) {
- TitanOperationStatus error = containerVEither.right().value();
+ JanusGraphOperationStatus error = containerVEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR, componentId, error);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
if (result == null) {
GraphVertex containerV = containerVEither.left().value();
@@ -1572,11 +1583,12 @@
Optional<CapabilityDataDefinition> foundRequirement;
RelationshipInfo relationshipInfo = foundRelation.resolveSingleRelationship().getRelation();
- Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> containerVEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (containerVEither.isRight()) {
- TitanOperationStatus error = containerVEither.right().value();
+ JanusGraphOperationStatus error = containerVEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR, componentId, error);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
if (result == null) {
GraphVertex containerV = containerVEither.left().value();
@@ -1821,22 +1833,22 @@
private Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> fetchContainerCalculatedCapability(GraphVertex containerV, EdgeLabelEnum capLabel) {
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, TitanOperationStatus> calculatedCapabiltyEither = getDataAndVertexFromGraph(containerV, capLabel);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, JanusGraphOperationStatus> calculatedCapabiltyEither = getDataAndVertexFromGraph(containerV, capLabel);
if (calculatedCapabiltyEither.isRight()) {
- TitanOperationStatus error = calculatedCapabiltyEither.right().value();
+ JanusGraphOperationStatus error = calculatedCapabiltyEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch calculated capabilties for container {}.", containerV.getUniqueId(), error);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>> calculatedCapabilty = calculatedCapabiltyEither.left().value();
return Either.left(calculatedCapabilty);
}
private Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> fetchContainerCalculatedRequirement(GraphVertex containerV, EdgeLabelEnum reqLabel) {
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, TitanOperationStatus> calculatedRequirementEither = getDataAndVertexFromGraph(containerV, reqLabel);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, JanusGraphOperationStatus> calculatedRequirementEither = getDataAndVertexFromGraph(containerV, reqLabel);
if (calculatedRequirementEither.isRight()) {
- TitanOperationStatus error = calculatedRequirementEither.right().value();
+ JanusGraphOperationStatus error = calculatedRequirementEither.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch calculated requirements for container {}.", containerV.getUniqueId(), error);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>> calculatedRequirement = calculatedRequirementEither.left().value();
return Either.left(calculatedRequirement);
@@ -2000,7 +2012,7 @@
StorageOperationStatus result = null;
String containerId = containerComponent.getUniqueId();
Map<String, ComponentInstanceDataDefinition> instancesJsonData = null;
- Either<GraphVertex, TitanOperationStatus> updateElement = null;
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = null;
if (!validateInstanceNames(componentInstanceTMap)) {
result = StorageOperationStatus.INCONSISTENCY;
}
@@ -2020,10 +2032,10 @@
composition.setComponentInstances(instancesJsonData);
compositions.put(JsonConstantKeysEnum.COMPOSITION.getValue(), composition);
containerVertex.setJson(compositions);
- updateElement = titanDao.updateVertex(containerVertex);
+ updateElement = janusGraphDao.updateVertex(containerVertex);
if (updateElement.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update topology template {} with new component instances. ", containerComponent.getName());
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value());
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value());
}
}
if (result == null && updateElement != null) {
@@ -2084,13 +2096,14 @@
}
public StorageOperationStatus addArtifactsToInstance(String toscaElementId, String instanceId, Map<String, ArtifactDataDefinition> instDeplArtifacts, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexType) {
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(toscaElementId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(toscaElementId, JsonParseFlagEnum.NoParse);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
MapArtifactDataDefinition instArtifacts = new MapArtifactDataDefinition(instDeplArtifacts);
return addToscaDataDeepElementsBlockToToscaElement(metadataVertex.left().value(), edgeLabel, vertexType, instArtifacts, instanceId);
@@ -2099,13 +2112,14 @@
@SuppressWarnings({ "unchecked" })
public StorageOperationStatus generateCustomizationUUIDOnInstance(String componentId, String instanceId) {
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
GraphVertex metaVertex = metadataVertex.left().value();
Map<String, CompositionDataDefinition> json = (Map<String, CompositionDataDefinition>) metaVertex.getJson();
@@ -2115,19 +2129,19 @@
log.debug("Failed to update customization UUID for instance {} in component {} error {}", instanceId, componentId, status);
return status;
}
- Either<GraphVertex, TitanOperationStatus> updateVertex = titanDao.updateVertex(metaVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateVertex = janusGraphDao.updateVertex(metaVertex);
if (updateVertex.isRight()) {
log.debug("Failed to update vertex of component {} error {}", componentId, updateVertex.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateVertex.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateVertex.right().value());
}
return StorageOperationStatus.OK;
}
public StorageOperationStatus generateCustomizationUUIDOnInstanceGroup(String componentId, String instanceId, List<String> groupInstances) {
if (groupInstances != null) {
- Either<Map<String, MapGroupsDataDefinition>, TitanOperationStatus> dataFromGraph = getDataFromGraph(componentId, EdgeLabelEnum.INST_GROUPS);
+ Either<Map<String, MapGroupsDataDefinition>, JanusGraphOperationStatus> dataFromGraph = getDataFromGraph(componentId, EdgeLabelEnum.INST_GROUPS);
if (dataFromGraph.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(dataFromGraph.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(dataFromGraph.right().value());
}
MapGroupsDataDefinition grInstPerInstance = dataFromGraph.left().value().get(instanceId);
if (grInstPerInstance == null) {
@@ -2226,21 +2240,21 @@
// create edge between container and origin ( in case of proxy this edge will be to ProxyService node type)
StorageOperationStatus result = createOrUpdateInstanceEdge(metadataVertex, EdgeLabelEnum.INSTANCE_OF, componentInstance.getComponentUid(), instUniqueId).either(v -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (result == StorageOperationStatus.OK && componentInstance.getIsProxy()) {
// create edge between container and service origin
result = createOrUpdateInstanceEdge(metadataVertex, EdgeLabelEnum.PROXY_OF, componentInstance.getSourceModelUid(), instUniqueId)
- .either(v -> StorageOperationStatus.OK, DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .either(v -> StorageOperationStatus.OK, DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
return result;
}
public StorageOperationStatus createAllottedOfEdge(String componentId, String instanceId, String serviceUUID) {
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if ( vertexById.isRight() ){
log.debug("Failed to fetch component metadata vertex for id {} error {}", componentId, vertexById.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(vertexById.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexById.right().value());
}
GraphVertex metadataVertex = vertexById.left().value();
@@ -2251,10 +2265,11 @@
EnumMap<GraphPropertyEnum, Object> hasNot = new EnumMap<>(GraphPropertyEnum.class);
hasNot.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> byCriteria = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props,hasNot, JsonParseFlagEnum.ParseMetadata );
+ Either<List<GraphVertex>, JanusGraphOperationStatus> byCriteria = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props,hasNot, JsonParseFlagEnum.ParseMetadata );
if ( byCriteria.isRight() ){
log.debug("Failed to fetch vertex by criteria {} error {}", props, byCriteria.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(byCriteria.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(byCriteria.right().value());
}
List<GraphVertex> vertecies = byCriteria.left().value();
StorageOperationStatus result = StorageOperationStatus.OK;
@@ -2265,7 +2280,7 @@
log.debug("Try to create or update edge between resource {} and service {} ", metadataVertex, serviceVertex.getUniqueId());
// create edge between container and service reference
result = createOrUpdateInstanceEdge(metadataVertex, EdgeLabelEnum.ALLOTTED_OF, serviceVertex.getUniqueId(), instanceId).either(v -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
return result;
}
@@ -2277,38 +2292,38 @@
// create edge between container and origin ( in case of proxy this edge will be to ProxyService node type)
StorageOperationStatus result = removeOrUpdateInstanceEdge(metadataVertex, EdgeLabelEnum.INSTANCE_OF, componentInstance.getComponentUid(), instUniqueId)
.either(v -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (componentInstance.getIsProxy()) {
// create edge between container and service origin
result = removeOrUpdateInstanceEdge(metadataVertex, EdgeLabelEnum.PROXY_OF, componentInstance.getSourceModelUid(), instUniqueId)
- .either(v -> StorageOperationStatus.OK, DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .either(v -> StorageOperationStatus.OK, DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
return result;
}
- private Either<GraphVertex, TitanOperationStatus> createOrUpdateInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId) {
+ private Either<GraphVertex, JanusGraphOperationStatus> createOrUpdateInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId) {
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.UNIQUE_ID, componentUid);
- return titanDao.getEdgeByChildrenVertexProperties(metadataVertex, edgeLabel, properties)
+ return janusGraphDao.getEdgeByChildrenVertexProperties(metadataVertex, edgeLabel, properties)
.left()
.bind(v -> addInstanceToPropertyOnEdge(instUniqueId, v, metadataVertex))
.right()
.bind(s -> createInstanceEdge(metadataVertex, edgeLabel, componentUid, instUniqueId, s));
}
- private Either<GraphVertex, TitanOperationStatus> removeOrUpdateInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId) {
+ private Either<GraphVertex, JanusGraphOperationStatus> removeOrUpdateInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId) {
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.UNIQUE_ID, componentUid);
- return titanDao.getEdgeByChildrenVertexProperties(metadataVertex, edgeLabel, properties).left().bind(v -> removeInstanceFromPropertyOnEdge(instUniqueId, v, metadataVertex)).right()
+ return janusGraphDao.getEdgeByChildrenVertexProperties(metadataVertex, edgeLabel, properties).left().bind(v -> removeInstanceFromPropertyOnEdge(instUniqueId, v, metadataVertex)).right()
.map(err -> removeInstanceEdgeLogError(metadataVertex, edgeLabel, componentUid, err));
}
- private Either<GraphVertex, TitanOperationStatus> addInstanceToPropertyOnEdge(String instUniqueId, Edge edge, GraphVertex metadataVertex) {
+ private Either<GraphVertex, JanusGraphOperationStatus> addInstanceToPropertyOnEdge(String instUniqueId, Edge edge, GraphVertex metadataVertex) {
// edge exist need to add instance id to list on edge's property
- List<String> property = (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
+ List<String> property = (List<String>) janusGraphDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
if (property == null) {
property = new ArrayList<>();
}
@@ -2323,14 +2338,14 @@
edge.property(EdgePropertyEnum.INSTANCES.getProperty(), jsonArr);
} catch (IOException e) {
log.debug("Failed to convert INSTANCES edge property to json for container {}", metadataVertex.getUniqueId(), e );
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
return Either.left(metadataVertex);
}
- private Either<GraphVertex, TitanOperationStatus> removeInstanceFromPropertyOnEdge(String instUniqueId, Edge edge, GraphVertex metadataVertex) {
+ private Either<GraphVertex, JanusGraphOperationStatus> removeInstanceFromPropertyOnEdge(String instUniqueId, Edge edge, GraphVertex metadataVertex) {
// edge exist need to add instance id to list on edge's property
- List<String> property = (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
+ List<String> property = (List<String>) janusGraphDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
if (property == null) {
property = new ArrayList<>();
}
@@ -2347,16 +2362,16 @@
edge.property(EdgePropertyEnum.INSTANCES.getProperty(), jsonArr);
} catch (IOException e) {
log.debug("Failed to convert INSTANCES edge property to json for container {}", metadataVertex.getUniqueId(), e );
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
}
return Either.left(metadataVertex);
}
- private Either<GraphVertex, TitanOperationStatus> createInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId, TitanOperationStatus retrieveEdgeStatus) {
- if (retrieveEdgeStatus == TitanOperationStatus.NOT_FOUND) {
+ private Either<GraphVertex, JanusGraphOperationStatus> createInstanceEdge(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, String instUniqueId, JanusGraphOperationStatus retrieveEdgeStatus) {
+ if (retrieveEdgeStatus == JanusGraphOperationStatus.NOT_FOUND) {
// create new edge
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentUid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentUid);
if (vertexById.isRight()) {
return vertexById;
}
@@ -2367,16 +2382,18 @@
edgeProps.put(EdgePropertyEnum.INSTANCES, instList);
log.debug("Create new edge {} between {} and {} and properties {} ", edgeLabel, metadataVertex.getUniqueId(), originVertex.getUniqueId(), edgeProps);
- TitanOperationStatus edgeResult = titanDao.createEdge(metadataVertex, originVertex, edgeLabel, edgeProps);
- return edgeResult == TitanOperationStatus.OK ? Either.left(metadataVertex) : Either.right(edgeResult);
+ JanusGraphOperationStatus
+ edgeResult = janusGraphDao
+ .createEdge(metadataVertex, originVertex, edgeLabel, edgeProps);
+ return edgeResult == JanusGraphOperationStatus.OK ? Either.left(metadataVertex) : Either.right(edgeResult);
}
// error
log.debug("Failed to fetch edge with label {} and to vertex with id {} error {} ", edgeLabel, componentUid, retrieveEdgeStatus);
return Either.right(retrieveEdgeStatus);
}
- private TitanOperationStatus removeInstanceEdgeLogError(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, TitanOperationStatus retrieveEdgeStatus) {
- if (retrieveEdgeStatus == TitanOperationStatus.NOT_FOUND) {
+ private JanusGraphOperationStatus removeInstanceEdgeLogError(GraphVertex metadataVertex, EdgeLabelEnum edgeLabel, String componentUid, JanusGraphOperationStatus retrieveEdgeStatus) {
+ if (retrieveEdgeStatus == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("No edge {} to remove between container {} and origin {}", edgeLabel, metadataVertex.getUniqueId(), componentUid);
} else {
// error
@@ -2386,10 +2403,10 @@
}
public void removeAllAllotedEdges(String uniqueId) {
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(uniqueId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(uniqueId);
if (vertexById.isLeft()) {
GraphVertex originVertex = vertexById.left().value();
- TitanVertex vertex = originVertex.getVertex();
+ JanusGraphVertex vertex = originVertex.getVertex();
Iterator<Edge> edges = vertex.edges(Direction.OUT, EdgeLabelEnum.ALLOTTED_OF.name());
while ( edges != null && edges.hasNext() ){
Edge edge = edges.next();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
similarity index 77%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
index 967fc16..eb8b903 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -35,9 +35,9 @@
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -93,11 +93,11 @@
fillToscaElementVertexData(nodeTypeVertex, nodeType, JsonParseFlagEnum.ParseAll);
//Create Node Type in Graph
- Either<GraphVertex, TitanOperationStatus> createdVertex = titanDao.createVertex(nodeTypeVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createdVertex = janusGraphDao.createVertex(nodeTypeVertex);
if (createdVertex.isRight()) {
- TitanOperationStatus status = createdVertex.right().value();
+ JanusGraphOperationStatus status = createdVertex.right().value();
log.error("Error returned after creating resource data node {}. status returned is ", nodeTypeVertex, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
nodeTypeVertex = createdVertex.left().value();
@@ -197,140 +197,141 @@
public Either<ToscaElement, StorageOperationStatus> getToscaElement(GraphVertex componentV, ComponentParametersView componentParametersView) {
NodeType toscaElement;
toscaElement = convertToComponent(componentV);
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
if (!componentParametersView.isIgnoreUsers()) {
status = setCreatorFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
status = setLastModifierFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreProperties()) {
status = setResourcePropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK && status != TitanOperationStatus.NOT_FOUND) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK && status != JanusGraphOperationStatus.NOT_FOUND) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreAttributesFrom()) {
status = setResourceAttributesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreDerivedFrom()) {
status = setResourceDerivedFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCategories()) {
status = setResourceCategoryFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreRequirements()) {
status = setResourceRequirementsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
+ if (status != JanusGraphOperationStatus.OK) {
log.error("Failed to set requirement of resource {}. status is {}", componentV.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCapabilities()) {
status = setResourceCapabilitiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreArtifacts()) {
status = setArtifactsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreAdditionalInformation()) {
status = setAdditionalInformationFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreInterfaces()) {
status = setInterfacesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreAllVersions()) {
status = setAllVersions(componentV, toscaElement);
- if (status != TitanOperationStatus.OK && status != TitanOperationStatus.NOT_FOUND) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK && status != JanusGraphOperationStatus.NOT_FOUND) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCapabiltyProperties()) {
status = setComponentCapPropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
return Either.left(toscaElement);
}
- private TitanOperationStatus setComponentCapPropertiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, MapPropertiesDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
+ private JanusGraphOperationStatus setComponentCapPropertiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, MapPropertiesDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
if (result.isLeft()) {
toscaElement.setCapabilitiesProperties(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setInterfacesFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, InterfaceDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INTERFACE_ARTIFACTS);
+ private JanusGraphOperationStatus setInterfacesFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, InterfaceDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INTERFACE_ARTIFACTS);
if (result.isLeft()) {
toscaElement.setInterfaceArtifacts(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected <T extends ToscaElement> TitanOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
return setResourceCapabilitiesFromGraph(componentV, (NodeType) toscaElement);
}
- private TitanOperationStatus setResourceCapabilitiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, ListCapabilityDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES);
+ private JanusGraphOperationStatus setResourceCapabilitiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, ListCapabilityDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES);
if (result.isLeft()) {
toscaElement.setCapabilities(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setResourceDerivedFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ private JanusGraphOperationStatus setResourceDerivedFromGraph(GraphVertex componentV, NodeType toscaElement) {
List<String> derivedFromList = new ArrayList<>();
- TitanOperationStatus listFromGraphStatus = findResourcesPathRecursively(componentV, derivedFromList);
- if (TitanOperationStatus.OK != listFromGraphStatus) {
+ JanusGraphOperationStatus
+ listFromGraphStatus = findResourcesPathRecursively(componentV, derivedFromList);
+ if (JanusGraphOperationStatus.OK != listFromGraphStatus) {
return listFromGraphStatus;
}
@@ -346,74 +347,78 @@
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected TitanOperationStatus findResourcesPathRecursively(GraphVertex nodeTypeV, List<String> resourcesPathList) {
- Either<GraphVertex, TitanOperationStatus> parentResourceRes = titanDao.getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ protected JanusGraphOperationStatus findResourcesPathRecursively(GraphVertex nodeTypeV, List<String> resourcesPathList) {
+ Either<GraphVertex, JanusGraphOperationStatus> parentResourceRes = janusGraphDao
+ .getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
resourcesPathList.add((String) nodeTypeV.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
while (parentResourceRes.isLeft()) {
GraphVertex parent = parentResourceRes.left().value();
resourcesPathList.add((String) parent.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
- parentResourceRes = titanDao.getChildVertex(parent, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ parentResourceRes = janusGraphDao
+ .getChildVertex(parent, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
}
- TitanOperationStatus operationStatus = parentResourceRes.right().value();
+ JanusGraphOperationStatus operationStatus = parentResourceRes.right().value();
- if (operationStatus != TitanOperationStatus.NOT_FOUND) {
+ if (operationStatus != JanusGraphOperationStatus.NOT_FOUND) {
return operationStatus;
} else {
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
}
- protected <T extends ToscaElement> TitanOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
return setResourceRequirementsFromGraph(componentV, (NodeType) toscaElement);
}
- private TitanOperationStatus setResourceRequirementsFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, ListRequirementDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.REQUIREMENTS);
+ private JanusGraphOperationStatus setResourceRequirementsFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, ListRequirementDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.REQUIREMENTS);
if (result.isLeft()) {
toscaElement.setRequirements(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setResourceAttributesFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, PropertyDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ATTRIBUTES);
+ private JanusGraphOperationStatus setResourceAttributesFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, PropertyDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ATTRIBUTES);
if (result.isLeft()) {
toscaElement.setAttributes(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setResourcePropertiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
- Either<Map<String, PropertyDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.PROPERTIES);
+ private JanusGraphOperationStatus setResourcePropertiesFromGraph(GraphVertex componentV, NodeType toscaElement) {
+ Either<Map<String, PropertyDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.PROPERTIES);
if (result.isLeft()) {
toscaElement.setProperties(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private StorageOperationStatus assosiateToDerived(GraphVertex nodeTypeVertex, List<GraphVertex> derivedResources) {
for (GraphVertex derivedV : derivedResources) {
- TitanOperationStatus createEdge = titanDao.createEdge(nodeTypeVertex, derivedV, EdgeLabelEnum.DERIVED_FROM, null);
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(nodeTypeVertex, derivedV, EdgeLabelEnum.DERIVED_FROM, null);
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.trace("Failed to associate resource {} to derived with id {}", nodeTypeVertex.getUniqueId(), derivedV.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge);
}
}
return StorageOperationStatus.OK;
@@ -585,7 +590,7 @@
if (derivedFromResources != null && !derivedFromResources.isEmpty()) {
for (String parentResource : derivedFromResources) {
- Either<List<GraphVertex>, TitanOperationStatus> getParentResources = derivedResourceResolver.findDerivedResources(parentResource);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getParentResources = derivedResourceResolver.findDerivedResources(parentResource);
List<GraphVertex> resources = null;
if (getParentResources.isRight()) {
log.error("Cannot find parent resource by tosca resource name {} in the graph.", parentResource);
@@ -639,11 +644,11 @@
StorageOperationStatus result = StorageOperationStatus.OK;
for (GraphVertex fetchedDerivedResource : fetchedDerivedResources) {
fetchedDerivedResource.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, false);
- Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(fetchedDerivedResource);
+ Either<GraphVertex, JanusGraphOperationStatus> updateVertexRes = janusGraphDao.updateVertex(fetchedDerivedResource);
if (updateVertexRes.isRight()) {
- TitanOperationStatus titatStatus = updateVertexRes.right().value();
+ JanusGraphOperationStatus titatStatus = updateVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to set highest version of node type {} to false. Status is {}", fetchedDerivedResource.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME), titatStatus);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(titatStatus);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(titatStatus);
break;
}
}
@@ -665,34 +670,39 @@
log.debug("Failed to fetch tosca element {} error {}", toscaElementVertex.getUniqueId(), nodeType.right().value());
return nodeType;
}
- TitanOperationStatus status = disassociateAndDeleteCommonElements(toscaElementVertex);
- if (status != TitanOperationStatus.OK) {
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus status = disassociateAndDeleteCommonElements(toscaElementVertex);
+ if (status != JanusGraphOperationStatus.OK) {
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate capabilties for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate capabilties properties for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.REQUIREMENTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.REQUIREMENTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate requirements for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ATTRIBUTES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ATTRIBUTES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate attributes for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INTERFACE_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INTERFACE_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate interface artifacts for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
toscaElementVertex.getVertex().remove();
log.trace("Tosca element vertex for {} was removed", toscaElementVertex.getUniqueId());
@@ -707,7 +717,7 @@
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
return setResourceCategoryFromGraph(vertexComponent, toscaElement);
}
@@ -727,11 +737,12 @@
if (derivedFromResources != null && !derivedFromResources.isEmpty() && derivedFromResources.get(0) != null) {
String firstDerived = derivedFromResources.get(0);
boolean derivedFromGenericType = null != nodeType.getDerivedFromGenericType();
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
- TitanOperationStatus getchieldError = childVertex.right().value();
+ JanusGraphOperationStatus getchieldError = childVertex.right().value();
log.debug("Failed to fetch derived resource for element {} error {}", nodeTypeV.getUniqueId(), getchieldError);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getchieldError);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getchieldError);
}
GraphVertex firstDerivedInChain = childVertex.left().value();
@@ -744,12 +755,13 @@
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, firstDerived);
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- Either<List<GraphVertex>, TitanOperationStatus> getParentResources = titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getParentResources = janusGraphDao
+ .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.NoParse);
if (getParentResources.isRight()) {
- TitanOperationStatus error = getParentResources.right().value();
+ JanusGraphOperationStatus error = getParentResources.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch derived by criteria {}. error {} ", propertiesToMatch, error);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(error);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error);
}
// must be only one
GraphVertex newDerivedV = getParentResources.left().value().get(0);
@@ -771,11 +783,13 @@
protected <T extends ToscaElement> StorageOperationStatus updateDerived(T toscaElementToUpdate, GraphVertex nodeTypeV, GraphVertex preDerivedV, GraphVertex newDerivedV, boolean mergeValues) {
Set<String> preDerivedChainIdList = new HashSet();
preDerivedChainIdList.add(preDerivedV.getUniqueId());
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(preDerivedV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(preDerivedV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
while (childVertex.isLeft()) {
GraphVertex currentChield = childVertex.left().value();
preDerivedChainIdList.add(currentChield.getUniqueId());
- childVertex = titanDao.getChildVertex(currentChield, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ childVertex = janusGraphDao
+ .getChildVertex(currentChield, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
}
List<GraphVertex> derivedResources = new ArrayList<>();
@@ -786,14 +800,15 @@
return updateStatus;
}
- Either<Edge, TitanOperationStatus> deleteEdge = titanDao.deleteEdge(nodeTypeV, preDerivedV, EdgeLabelEnum.DERIVED_FROM);
+ Either<Edge, JanusGraphOperationStatus> deleteEdge = janusGraphDao
+ .deleteEdge(nodeTypeV, preDerivedV, EdgeLabelEnum.DERIVED_FROM);
if (deleteEdge.isRight()) {
- TitanOperationStatus deleteError = deleteEdge.right().value();
+ JanusGraphOperationStatus deleteError = deleteEdge.right().value();
log.debug("Failed to disassociate element {} from derived {} , error {}", nodeTypeV.getUniqueId(), preDerivedV.getUniqueId(), deleteError);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(deleteError);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteError);
}
- titanDao.createEdge(nodeTypeV, newDerivedV, EdgeLabelEnum.DERIVED_FROM, new HashMap<>());
+ janusGraphDao.createEdge(nodeTypeV, newDerivedV, EdgeLabelEnum.DERIVED_FROM, new HashMap<>());
return StorageOperationStatus.OK;
}
@@ -834,11 +849,11 @@
private <T extends ToscaDataDefinition> StorageOperationStatus updateDataByType(List<GraphVertex> newDerivedList, GraphVertex nodeTypeV, EdgeLabelEnum label, NodeType nodeElement, boolean mergeValues, Set<String> preDerivedChainIdList) {
log.debug("Update data from derived for element {} type {}", nodeTypeV.getUniqueId(), label);
- Either<GraphVertex, TitanOperationStatus> dataFromGraph = getDataVertex(nodeTypeV, label);
+ Either<GraphVertex, JanusGraphOperationStatus> dataFromGraph = getDataVertex(nodeTypeV, label);
if (dataFromGraph.isRight()) {
- if (TitanOperationStatus.NOT_FOUND == dataFromGraph.right().value())
+ if (JanusGraphOperationStatus.NOT_FOUND == dataFromGraph.right().value())
return associateDerivedDataByType(label, nodeTypeV, nodeElement, newDerivedList);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(dataFromGraph.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(dataFromGraph.right().value());
}
GraphVertex dataV = dataFromGraph.left().value();
@@ -884,9 +899,9 @@
});
}
dataV.setJson(dataFromDerivedAll);
- Either<GraphVertex, TitanOperationStatus> updateDataV = updateOrCopyOnUpdate(dataV, nodeTypeV, label);
+ Either<GraphVertex, JanusGraphOperationStatus> updateDataV = updateOrCopyOnUpdate(dataV, nodeTypeV, label);
if (updateDataV.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateDataV.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateDataV.right().value());
}
return StorageOperationStatus.OK;
}
@@ -913,16 +928,17 @@
public Either<ToscaElement, StorageOperationStatus> shouldUpdateDerivedVersion(ToscaElement toscaElementToUpdate, GraphVertex nodeTypeV) {
NodeType nodeType = (NodeType) toscaElementToUpdate;
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
- TitanOperationStatus getchildError = childVertex.right().value();
- if (getchildError == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus getchildError = childVertex.right().value();
+ if (getchildError == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("derived resource for element {} not found", nodeTypeV.getUniqueId());
return Either.right(StorageOperationStatus.OK);
}
log.debug("Failed to fetch derived resource for element {} error {}", nodeTypeV.getUniqueId(), getchildError);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getchildError));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getchildError));
}
GraphVertex firstDerivedInChain = childVertex.left().value();
@@ -935,10 +951,11 @@
Map<GraphPropertyEnum, Object> propsHasNot = new HashMap<>();
propsHasNot.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> byCriteria = titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, props, propsHasNot, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> byCriteria = janusGraphDao
+ .getByCriteria(VertexTypeEnum.NODE_TYPE, props, propsHasNot, JsonParseFlagEnum.NoParse);
if (byCriteria.isRight()) {
log.debug("Failed to fetch derived by props {} error {}", props, byCriteria.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(byCriteria.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(byCriteria.right().value()));
}
List<GraphVertex> lastDerived = byCriteria.left().value();
// now supported only one derived!!! Change in future!(Evg)
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java
similarity index 87%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java
index efbac33..349ea80 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java
@@ -1,7 +1,7 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -20,11 +20,11 @@
private static final Logger log = Logger.getLogger(PolicyOperation.class.getName());
private TopologyTemplateOperation topologyTemplateOperation;
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public PolicyOperation(TopologyTemplateOperation topologyTemplateOperation, TitanDao titanDao) {
+ public PolicyOperation(TopologyTemplateOperation topologyTemplateOperation, JanusGraphDao janusGraphDao) {
this.topologyTemplateOperation = topologyTemplateOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
}
/**
@@ -37,9 +37,9 @@
public StorageOperationStatus updatePolicyProperties(Component containerComponent, String policyId, List<PropertyDataDefinition> propertiesToUpdate) {
log.debug("#updatePolicyProperties - updating the properties of policy {} in component {}", policyId, containerComponent.getUniqueId());
PolicyDefinition policy = containerComponent.getPolicyById(policyId);
- return titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.NoParse)
.either(containerVertex -> updatePolicyProperties(containerVertex, policy, propertiesToUpdate),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private StorageOperationStatus updatePolicyProperties(GraphVertex container, PolicyDefinition policy, List<PropertyDataDefinition> propertiesToUpdate) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/RequirementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/RequirementOperation.java
similarity index 96%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/RequirementOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/RequirementOperation.java
index 1fd3750..9c1d1ee 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/RequirementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/RequirementOperation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
@@ -57,12 +57,12 @@
componentId, Collections
.singletonList(convertToListRequirementDataDefinition(requirementDefinitions)));
if (!statusRes.equals(StorageOperationStatus.OK)) {
- titanDao.rollback();
+ janusGraphDao.rollback();
LOGGER.error("Failed to find the parent capability of capability type {}."
+ " status is {}", componentId, statusRes);
return Either.right(statusRes);
}
- titanDao.commit();
+ janusGraphDao.commit();
return Either.left(requirementDefinitions);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
similarity index 76%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index 5ddc528..a429033 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -18,19 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import com.google.gson.reflect.TypeToken;
import fj.data.Either;
import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
@@ -65,11 +64,11 @@
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.utils.CapabilityRequirementNameResolver;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.CapabilityRequirementNameResolver;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -118,11 +117,11 @@
GraphVertex topologyTemplateVertex = new GraphVertex();
topologyTemplateVertex = fillMetadata(topologyTemplateVertex, topologyTemplate, JsonParseFlagEnum.ParseAll);
- Either<GraphVertex, TitanOperationStatus> createdVertex = titanDao.createVertex(topologyTemplateVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createdVertex = janusGraphDao.createVertex(topologyTemplateVertex);
if (createdVertex.isRight()) {
- TitanOperationStatus status = createdVertex.right().value();
+ JanusGraphOperationStatus status = createdVertex.right().value();
log.debug("Error returned after creating topology template data node {}. status returned is ", topologyTemplateVertex, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
@@ -506,16 +505,16 @@
}
private <T extends MapDataDefinition> Either<GraphVertex, StorageOperationStatus> associateOrAddElementToData(GraphVertex nodeTypeVertex, VertexTypeEnum vertexTypeEnum, EdgeLabelEnum edgeLabelEnum, Map<String, T> dataMap) {
- return titanDao.getChildVertex(nodeTypeVertex, edgeLabelEnum, JsonParseFlagEnum.ParseJson)
+ return janusGraphDao.getChildVertex(nodeTypeVertex, edgeLabelEnum, JsonParseFlagEnum.ParseJson)
.either(dataVertex -> addElementsToComponent(nodeTypeVertex, dataVertex, vertexTypeEnum, edgeLabelEnum, dataMap),
status -> associateElementToDataIfNotFound(status, nodeTypeVertex, vertexTypeEnum, edgeLabelEnum, dataMap));
}
- private Either<GraphVertex, StorageOperationStatus> associateElementToDataIfNotFound(TitanOperationStatus status, GraphVertex nodeTypeVertex, VertexTypeEnum vertexTypeEnum, EdgeLabelEnum edgeLabelEnum, Map<String, ? extends ToscaDataDefinition> dataMap) {
- if (status == TitanOperationStatus.NOT_FOUND) {
+ private Either<GraphVertex, StorageOperationStatus> associateElementToDataIfNotFound(JanusGraphOperationStatus status, GraphVertex nodeTypeVertex, VertexTypeEnum vertexTypeEnum, EdgeLabelEnum edgeLabelEnum, Map<String, ? extends ToscaDataDefinition> dataMap) {
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return associateElementToData(nodeTypeVertex, vertexTypeEnum, edgeLabelEnum, dataMap);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
private <T extends MapDataDefinition> Either<GraphVertex, StorageOperationStatus> addElementsToComponent(GraphVertex nodeTypeVertex, GraphVertex dataVertex, VertexTypeEnum vertexTypeEnum, EdgeLabelEnum edgeLabelEnum, Map<String, T> dataMap) {
@@ -622,10 +621,10 @@
return StorageOperationStatus.CATEGORY_NOT_FOUND;
}
GraphVertex categoryV = category.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(nodeTypeVertex, categoryV, EdgeLabelEnum.CATEGORY, new HashMap<>());
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus createEdge = janusGraphDao.createEdge(nodeTypeVertex, categoryV, EdgeLabelEnum.CATEGORY, new HashMap<>());
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.trace("Failed to associate resource {} to category {} with id {}", topologyTemplate.getUniqueId(), categoryName, categoryV.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge);
}
return StorageOperationStatus.OK;
}
@@ -649,73 +648,73 @@
TopologyTemplate toscaElement;
toscaElement = convertToTopologyTemplate(componentV);
- TitanOperationStatus status;
+ JanusGraphOperationStatus status;
if (!componentParametersView.isIgnoreUsers()) {
status = setCreatorFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
status = setLastModifierFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCategories()) {
status = setTopologyTempalteCategoriesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreArtifacts()) {
- TitanOperationStatus storageStatus = setAllArtifactsFromGraph(componentV, toscaElement);
- if (storageStatus != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ JanusGraphOperationStatus storageStatus = setAllArtifactsFromGraph(componentV, toscaElement);
+ if (storageStatus != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(storageStatus));
}
}
if (!componentParametersView.isIgnoreComponentInstancesProperties()) {
status = setComponentInstancesPropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCapabilities()) {
status = setCapabilitiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreRequirements()) {
status = setRequirementsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreAllVersions()) {
status = setAllVersions(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreAdditionalInformation()) {
status = setAdditionalInformationFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreGroups()) {
status = setGroupsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnorePolicies()) {
status = setPoliciesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
@@ -725,134 +724,134 @@
//Mark all CIs that has archived origins
archiveOperation.setArchivedOriginsFlagInComponentInstances(componentV);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreInputs()) {
status = setInputsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreProperties()) {
status = setPropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreComponentInstancesInputs()) {
status = setComponentInstancesInputsFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreCapabiltyProperties()) {
status = setComponentInstancesCapPropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreForwardingPath()) {
status = setForwardingGraphPropertiesFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreNodeFilter()) {
status = setNodeFilterComponentFromGraph(componentV, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!componentParametersView.isIgnoreInterfaces()) {
- TitanOperationStatus storageStatus = setInterfacesFromGraph(componentV, toscaElement);
- if (storageStatus != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ JanusGraphOperationStatus storageStatus = setInterfacesFromGraph(componentV, toscaElement);
+ if (storageStatus != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(storageStatus));
}
}
if (!componentParametersView.isIgnoreComponentInstancesInterfaces()) {
- TitanOperationStatus storageStatus =
+ JanusGraphOperationStatus storageStatus =
setComponentInstancesInterfacesFromGraph(componentV, toscaElement);
- if (storageStatus != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ if (storageStatus != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(storageStatus));
}
}
if (!componentParametersView.isIgnoreDataType()) {
- TitanOperationStatus storageStatus = setDataTypesFromGraph(componentV, toscaElement);
- if (storageStatus != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ JanusGraphOperationStatus storageStatus = setDataTypesFromGraph(componentV, toscaElement);
+ if (storageStatus != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(storageStatus));
}
}
return Either.left(toscaElement);
}
- private TitanOperationStatus setDataTypesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- Either<Map<String, DataTypeDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.DATA_TYPES);
+ private JanusGraphOperationStatus setDataTypesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ Either<Map<String, DataTypeDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.DATA_TYPES);
if (result.isLeft()) {
toscaElement.setDataTypes(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setPoliciesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- Either<Map<String, PolicyDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.POLICIES);
+ private JanusGraphOperationStatus setPoliciesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ Either<Map<String, PolicyDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.POLICIES);
if (result.isLeft()) {
toscaElement.setPolicies(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setInterfacesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, InterfaceDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INTERFACE);
+ private JanusGraphOperationStatus setInterfacesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, InterfaceDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INTERFACE);
if (result.isLeft()) {
topologyTemplate.setInterfaces(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setComponentInstancesInterfacesFromGraph(GraphVertex componentV,
+ private JanusGraphOperationStatus setComponentInstancesInterfacesFromGraph(GraphVertex componentV,
TopologyTemplate topologyTemplate) {
- Either<Map<String, MapInterfaceDataDefinition>, TitanOperationStatus> result =
+ Either<Map<String, MapInterfaceDataDefinition>, JanusGraphOperationStatus> result =
getDataFromGraph(componentV, EdgeLabelEnum.INST_INTERFACES);
if (result.isLeft()) {
result.left().value().entrySet().forEach(entry -> topologyTemplate
.addComponentInstanceInterfaceMap(entry.getKey(), entry.getValue()));
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private StorageOperationStatus associateInterfacesToComponent(GraphVertex topologyTemplateVertex, TopologyTemplate topologyTemplate) {
@@ -879,111 +878,111 @@
return StorageOperationStatus.OK;
}
- private TitanOperationStatus setForwardingGraphPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, ForwardingPathDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.FORWARDING_PATH);
+ private JanusGraphOperationStatus setForwardingGraphPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, ForwardingPathDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.FORWARDING_PATH);
if (result.isLeft()) {
topologyTemplate.setForwardingPaths(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setComponentInstancesCapPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, MapCapabilityProperty>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
+ private JanusGraphOperationStatus setComponentInstancesCapPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, MapCapabilityProperty>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
if (result.isLeft()) {
topologyTemplate.setCalculatedCapabilitiesProperties(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- Either<Map<String, MapPropertiesDataDefinition>, TitanOperationStatus> capPropResult =
+ Either<Map<String, MapPropertiesDataDefinition>, JanusGraphOperationStatus> capPropResult =
getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
if (capPropResult.isLeft()) {
topologyTemplate.setCapabilitiesProperties(capPropResult.left().value());
} else {
- if (capPropResult.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (capPropResult.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return capPropResult.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setPropertiesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- Either<Map<String, PropertyDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.PROPERTIES);
+ private JanusGraphOperationStatus setPropertiesFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ Either<Map<String, PropertyDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.PROPERTIES);
if (result.isLeft()) {
toscaElement.setProperties(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setInstGroupsFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, MapGroupsDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_GROUPS);
+ private JanusGraphOperationStatus setInstGroupsFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, MapGroupsDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_GROUPS);
if (result.isLeft()) {
topologyTemplate.setInstGroups(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setComponentInstancesPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, MapPropertiesDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_PROPERTIES);
+ private JanusGraphOperationStatus setComponentInstancesPropertiesFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, MapPropertiesDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_PROPERTIES);
if (result.isLeft()) {
topologyTemplate.setInstProperties(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setComponentInstancesInputsFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
- Either<Map<String, MapPropertiesDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_INPUTS);
+ private JanusGraphOperationStatus setComponentInstancesInputsFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
+ Either<Map<String, MapPropertiesDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_INPUTS);
if (result.isLeft()) {
topologyTemplate.setInstInputs(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setNodeFilterComponentFromGraph(GraphVertex componentV,
+ private JanusGraphOperationStatus setNodeFilterComponentFromGraph(GraphVertex componentV,
TopologyTemplate topologyTemplate) {
- Either<Map<String, CINodeFilterDataDefinition>, TitanOperationStatus> result =
+ Either<Map<String, CINodeFilterDataDefinition>, JanusGraphOperationStatus> result =
getDataFromGraph(componentV,
EdgeLabelEnum.NODE_FILTER_TEMPLATE);
if (result.isLeft()) {
topologyTemplate.setNodeFilterComponents(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
- Either<Map<String, MapListRequirementDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
+ protected <T extends ToscaElement> JanusGraphOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
+ Either<Map<String, MapListRequirementDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
if (result.isLeft()) {
((TopologyTemplate) toscaElement).setCalculatedRequirements(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
@@ -991,29 +990,29 @@
if (result.isLeft()) {
((TopologyTemplate) toscaElement).setFullfilledRequirements(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- Either<Map<String, ListRequirementDataDefinition>, TitanOperationStatus> requirementResult =
+ Either<Map<String, ListRequirementDataDefinition>, JanusGraphOperationStatus> requirementResult =
getDataFromGraph(componentV, EdgeLabelEnum.REQUIREMENTS);
if (requirementResult.isLeft()) {
toscaElement.setRequirements(requirementResult.left().value());
} else {
- if (requirementResult.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (requirementResult.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return requirementResult.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected <T extends ToscaElement> TitanOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
- Either<Map<String, MapListCapabilityDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
+ Either<Map<String, MapListCapabilityDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (result.isLeft()) {
((TopologyTemplate) toscaElement).setCalculatedCapabilities(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
@@ -1021,79 +1020,79 @@
if (result.isLeft()) {
((TopologyTemplate) toscaElement).setFullfilledCapabilities(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- Either<Map<String, ListCapabilityDataDefinition>, TitanOperationStatus> capabilitiesResult =
+ Either<Map<String, ListCapabilityDataDefinition>, JanusGraphOperationStatus> capabilitiesResult =
getDataFromGraph(componentV, EdgeLabelEnum.CAPABILITIES);
if (capabilitiesResult.isLeft()) {
toscaElement.setCapabilities(capabilitiesResult.left().value());
} else {
- if (capabilitiesResult.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (capabilitiesResult.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return capabilitiesResult.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setAllArtifactsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- TitanOperationStatus storageStatus = setArtifactsFromGraph(componentV, toscaElement);
- if (storageStatus != TitanOperationStatus.OK) {
+ private JanusGraphOperationStatus setAllArtifactsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ JanusGraphOperationStatus storageStatus = setArtifactsFromGraph(componentV, toscaElement);
+ if (storageStatus != JanusGraphOperationStatus.OK) {
return storageStatus;
}
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.SERVICE_API_ARTIFACTS);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.SERVICE_API_ARTIFACTS);
if (result.isLeft()) {
toscaElement.setServiceApiArtifacts(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- Either<Map<String, MapArtifactDataDefinition>, TitanOperationStatus> resultInstArt = getDataFromGraph(componentV, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
+ Either<Map<String, MapArtifactDataDefinition>, JanusGraphOperationStatus> resultInstArt = getDataFromGraph(componentV, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
if (resultInstArt.isLeft()) {
toscaElement.setInstDeploymentArtifacts(resultInstArt.left().value());
} else {
- if (resultInstArt.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (resultInstArt.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return resultInstArt.right().value();
}
}
- Either<Map<String, MapArtifactDataDefinition>, TitanOperationStatus> instanceArt = getDataFromGraph(componentV, EdgeLabelEnum.INSTANCE_ARTIFACTS);
+ Either<Map<String, MapArtifactDataDefinition>, JanusGraphOperationStatus> instanceArt = getDataFromGraph(componentV, EdgeLabelEnum.INSTANCE_ARTIFACTS);
if (instanceArt.isLeft()) {
toscaElement.setInstanceArtifacts(instanceArt.left().value());
} else {
- if (instanceArt.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (instanceArt.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return instanceArt.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setInputsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- Either<Map<String, PropertyDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INPUTS);
+ private JanusGraphOperationStatus setInputsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ Either<Map<String, PropertyDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INPUTS);
if (result.isLeft()) {
toscaElement.setInputs(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setGroupsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
- Either<Map<String, GroupDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.GROUPS);
+ private JanusGraphOperationStatus setGroupsFromGraph(GraphVertex componentV, TopologyTemplate toscaElement) {
+ Either<Map<String, GroupDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.GROUPS);
if (result.isLeft()) {
toscaElement.setGroups(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setTopologyTempalteCategoriesFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
+ private JanusGraphOperationStatus setTopologyTempalteCategoriesFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
List<CategoryDefinition> categories = new ArrayList<>();
switch (componentV.getType()) {
@@ -1106,11 +1105,11 @@
log.debug("Not supported component type {} ", componentV.getType());
break;
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setServiceCategoryFromGraph(GraphVertex componentV, ToscaElement toscaElement, List<CategoryDefinition> categories) {
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(componentV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ private JanusGraphOperationStatus setServiceCategoryFromGraph(GraphVertex componentV, ToscaElement toscaElement, List<CategoryDefinition> categories) {
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao.getChildVertex(componentV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug("failed to fetch {} for tosca element with id {}, error {}", EdgeLabelEnum.CATEGORY, componentV.getUniqueId(), childVertex.right().value());
return childVertex.right().value();
@@ -1129,7 +1128,7 @@
categories.add(category);
toscaElement.setCategories(categories);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@SuppressWarnings("unchecked")
@@ -1150,126 +1149,126 @@
log.debug("Failed to fetch tosca element {} error {}", toscaElementVertex.getUniqueId(), nodeType.right().value());
return nodeType;
}
- TitanOperationStatus status = disassociateAndDeleteCommonElements(toscaElementVertex);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus status = disassociateAndDeleteCommonElements(toscaElementVertex);
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_ATTRIBUTES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_ATTRIBUTES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instances attributes for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_PROPERTIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_PROPERTIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instances properties for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INPUTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INPUTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instances inputs for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.GROUPS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.GROUPS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate groups for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.POLICIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.POLICIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate policies for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_GROUPS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_GROUPS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instance groups for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INPUTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INPUTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate inputs for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INPUTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INPUTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instance inputs for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES_PROPERTIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate capabilities properties for {} error {}", toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_CAPABILITIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_CAPABILITIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate calculated capabiliites for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate fullfilled capabilities for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate calculated capabiliites properties for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate calculated requirements for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate full filled requirements for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instance artifacts for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.SERVICE_API_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.SERVICE_API_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate service api artifacts for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FORWARDING_PATH);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FORWARDING_PATH);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate service api artifacts for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INTERFACE);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INTERFACE);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate interfaces for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INSTANCE_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INSTANCE_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instance artifact for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT,
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT,
EdgeLabelEnum.REQUIREMENTS);
- if (status != TitanOperationStatus.OK) {
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate requirements for {} error {}",
toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT,
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT,
EdgeLabelEnum.CAPABILITIES);
- if (status != TitanOperationStatus.OK) {
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate capabilities for {} error {}",
toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INTERFACES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INTERFACES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disassociate instances interfaces for {} error {}", toscaElementVertex.getUniqueId(), status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
toscaElementVertex.getVertex().remove();
log.trace("Tosca element vertex for {} was removed", toscaElementVertex.getUniqueId());
@@ -1284,7 +1283,7 @@
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
return setTopologyTempalteCategoriesFromGraph(vertexComponent, toscaElement);
}
@@ -1316,10 +1315,10 @@
List<CategoryDefinition> newCategoryList = toscaElementToUpdate.getCategories();
CategoryDefinition newCategory = newCategoryList.get(0);
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(elementV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao.getChildVertex(elementV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug("failed to fetch {} for tosca element with id {}, error {}", EdgeLabelEnum.CATEGORY, elementV.getUniqueId(), childVertex.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(childVertex.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childVertex.right().value());
}
GraphVertex categoryV = childVertex.left().value();
@@ -1345,21 +1344,21 @@
Either<GraphVertex, StorageOperationStatus> result = null;
String userId = user.getUserId();
- Either<GraphVertex, TitanOperationStatus> getRes = findUserVertex(userId);
+ Either<GraphVertex, JanusGraphOperationStatus> getRes = findUserVertex(userId);
GraphVertex userVertex = null;
GraphVertex serviceVertex = null;
if (getRes.isRight()) {
- TitanOperationStatus status = getRes.right().value();
+ JanusGraphOperationStatus status = getRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Cannot find user {} in the graph. status is {}", userId, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
userVertex = getRes.left().value();
- getRes = titanDao.getVertexById(uniqueId, JsonParseFlagEnum.ParseMetadata);
+ getRes = janusGraphDao.getVertexById(uniqueId, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- TitanOperationStatus status = getRes.right().value();
+ JanusGraphOperationStatus status = getRes.right().value();
log.debug("Cannot find service {} in the graph. status is {}", uniqueId, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
@@ -1371,19 +1370,19 @@
}
}
if (result == null) {
- TitanOperationStatus status = titanDao.createEdge(userVertex, serviceVertex, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER, null);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = janusGraphDao.createEdge(userVertex, serviceVertex, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER, null);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to associate user {} to component {}. Edge type is {}", userId, uniqueId, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
serviceVertex.addMetadataProperty(GraphPropertyEnum.DISTRIBUTION_STATUS, distributionStatus.name());
long lastUpdateDate = System.currentTimeMillis();
serviceVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
- Either<GraphVertex, TitanOperationStatus> updateRes = titanDao.updateVertex(serviceVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateRes = janusGraphDao.updateVertex(serviceVertex);
if (updateRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateRes.right().value()));
}
}
if (result == null) {
@@ -1411,9 +1410,9 @@
result = Either.right(componentByLabelAndId.right().value());
}
if (componentByLabelAndId.isLeft()) {
- Either<Map<String, MapCapabilityProperty>, TitanOperationStatus> getDataRes = getDataFromGraph(componentByLabelAndId.left().value(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
+ Either<Map<String, MapCapabilityProperty>, JanusGraphOperationStatus> getDataRes = getDataFromGraph(componentByLabelAndId.left().value(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
if (getDataRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getDataRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getDataRes.right().value()));
} else {
mapPropertiesDataDefinition = getDataRes.left().value();
}
@@ -1517,7 +1516,7 @@
void revertNamesOfCalculatedCapabilitiesRequirements(String componentId, TopologyTemplate toscaElement) {
if (MapUtils.isNotEmpty(toscaElement.getComponentInstances()) || MapUtils.isNotEmpty(toscaElement.getGroups())) {
- GraphVertex toscaElementV = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ GraphVertex toscaElementV = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
.left()
.on(this::throwStorageException);
if (MapUtils.isNotEmpty(toscaElement.getComponentInstances())) {
@@ -1534,7 +1533,7 @@
public void updateNamesOfCalculatedCapabilitiesRequirements(String componentId, TopologyTemplate toscaElement) {
if (MapUtils.isNotEmpty(toscaElement.getComponentInstances()) || MapUtils.isNotEmpty(toscaElement.getGroups())) {
- GraphVertex toscaElementV = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ GraphVertex toscaElementV = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
.left()
.on(this::throwStorageException);
if (MapUtils.isNotEmpty(toscaElement.getComponentInstances())) {
@@ -1583,7 +1582,7 @@
return filter;
}
public void updateCapReqPropertiesOwnerId(String componentId, TopologyTemplate toscaElement) {
- GraphVertex toscaElementV = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ GraphVertex toscaElementV = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
.left().on(this::throwStorageException);
updateCapOwnerId(toscaElement, componentId);
updateReqOwnerId(toscaElement, componentId);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaDataOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaDataOperation.java
similarity index 94%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaDataOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaDataOperation.java
index 0abc011..1501b79 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaDataOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaDataOperation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
@org.springframework.stereotype.Component("tosca-data-operation")
public class ToscaDataOperation extends BaseOperation {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
similarity index 83%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
index afad869..771620d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@@ -30,6 +30,7 @@
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
@@ -38,21 +39,19 @@
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -92,10 +91,11 @@
Map<String, GraphVertex> vertices = null;
ToscaElementOperation operation;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForCheckin(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForCheckin(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- updateResult = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ updateResult = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
} else {
vertices = getVerticesRes.left().value();
updateResult = checkinToscaELement(currState, vertices.get(toscaElementId), vertices.get(ownerId), vertices.get(modifierId), LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
@@ -124,9 +124,10 @@
public Either<User, StorageOperationStatus> getToscaElementOwner(String toscaElementId) {
Either<User, StorageOperationStatus> result = null;
GraphVertex toscaElement = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes = titanDao.getVertexById(toscaElementId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes = janusGraphDao
+ .getVertexById(toscaElementId, JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getToscaElementRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getToscaElementRes.right().value()));
}
if (result == null) {
toscaElement = getToscaElementRes.left().value();
@@ -169,10 +170,11 @@
Either<ToscaElement, StorageOperationStatus> result = null;
Map<String, GraphVertex> vertices = null;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForCheckout(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForCheckout(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
vertices = getVerticesRes.left().value();
@@ -204,15 +206,15 @@
*/
public Either<ToscaElement, StorageOperationStatus> undoCheckout(String toscaElementId) {
Either<ToscaElement, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getToscaElementRes = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes = null;
Iterator<Edge> nextVersionComponentIter = null;
ToscaElementOperation operation;
Vertex preVersionVertex = null;
try {
- getToscaElementRes = titanDao.getVertexById(toscaElementId, JsonParseFlagEnum.ParseMetadata);
+ getToscaElementRes = janusGraphDao.getVertexById(toscaElementId, JsonParseFlagEnum.ParseMetadata);
if (getToscaElementRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getToscaElementRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getToscaElementRes.right().value()));
}
GraphVertex currVersionV = getToscaElementRes.left().value();
if (result == null && hasPreviousVersion(currVersionV)) {
@@ -231,7 +233,7 @@
}
}
if (result == null) {
- StorageOperationStatus updateCatalogRes = updateEdgeToCatalogRootByUndoCheckout((TitanVertex) preVersionVertex, currVersionV);
+ StorageOperationStatus updateCatalogRes = updateEdgeToCatalogRootByUndoCheckout((JanusGraphVertex) preVersionVertex, currVersionV);
if (updateCatalogRes != StorageOperationStatus.OK) {
return Either.right(updateCatalogRes);
}
@@ -267,10 +269,11 @@
GraphVertex modifier = null;
GraphVertex owner;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
toscaElement = getVerticesRes.left().value().get(toscaElementId);
@@ -321,10 +324,11 @@
GraphVertex modifier = null;
GraphVertex owner;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
toscaElement = getVerticesRes.left().value().get(toscaElementId);
@@ -368,10 +372,11 @@
StorageOperationStatus status;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
toscaElement = getVerticesRes.left().value().get(toscaElementId);
@@ -423,9 +428,10 @@
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.UUID, uuid);
properties.put(GraphPropertyEnum.NAME, componentName);
- Either<List<GraphVertex>, TitanOperationStatus> getToscaElementsRes = titanDao.getByCriteria(vertexType, properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getToscaElementsRes = janusGraphDao
+ .getByCriteria(vertexType, properties, JsonParseFlagEnum.ParseMetadata);
if (getToscaElementsRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getToscaElementsRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getToscaElementsRes.right().value()));
}
if (result == null) {
result = markToscaElementsAsDeleted(operation, getToscaElementsRes.left().value());
@@ -455,10 +461,11 @@
GraphVertex toscaElement = null;
GraphVertex modifier = null;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
toscaElement = getVerticesRes.left().value().get(toscaElementId);
@@ -468,10 +475,10 @@
toscaElement.setJsonMetadataField(JsonPresentationFields.USER_ID_LAST_UPDATER, modifier.getUniqueId());
toscaElement.addMetadataProperty(GraphPropertyEnum.STATE, nextState.name());
- Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(toscaElement);
+ Either<GraphVertex, JanusGraphOperationStatus> updateVertexRes = janusGraphDao.updateVertex(toscaElement);
if (updateVertexRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update vertex {} . Status is {}. ", toscaElementId, updateVertexRes.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateVertexRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateVertexRes.right().value()));
}
}
if (result == null) {
@@ -497,7 +504,7 @@
return result;
}
- public Either<GraphVertex, TitanOperationStatus> findUser(String userId) {
+ public Either<GraphVertex, JanusGraphOperationStatus> findUser(String userId) {
return findUserVertex(userId);
}
@@ -528,18 +535,20 @@
result = StorageOperationStatus.NOT_FOUND;
}
if (result == null) {
- TitanOperationStatus createVersionEdgeStatus = titanDao.createEdge(toscaElement, certifiedToscaElement, EdgeLabelEnum.VERSION, new HashMap<>());
- if (createVersionEdgeStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createVersionEdgeStatus = janusGraphDao
+ .createEdge(toscaElement, certifiedToscaElement, EdgeLabelEnum.VERSION, new HashMap<>());
+ if (createVersionEdgeStatus != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create version edge from last element {} to new certified element {}. status=", toscaElement.getUniqueId(), certifiedToscaElement.getUniqueId(),
createVersionEdgeStatus);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(createVersionEdgeStatus);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createVersionEdgeStatus);
}
}
if (result == null) {
if (certReqUserEdgeIter!=null) {
while (certReqUserEdgeIter.hasNext()) {
Edge edge = certReqUserEdgeIter.next();
- if (((String) titanDao.getProperty(edge, EdgePropertyEnum.STATE)).equals(LifecycleStateEnum.READY_FOR_CERTIFICATION.name())) {
+ if (((String) janusGraphDao.getProperty(edge, EdgePropertyEnum.STATE)).equals(LifecycleStateEnum.READY_FOR_CERTIFICATION.name())) {
foundEdge = edge;
break;
}
@@ -552,10 +561,12 @@
}
}
if (result == null) {
- TitanOperationStatus createEdgeRes = titanDao.createEdge(foundEdge.outVertex(), certifiedToscaElement.getVertex(), EdgeLabelEnum.LAST_STATE, foundEdge);
- if (createEdgeRes != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdgeRes = janusGraphDao
+ .createEdge(foundEdge.outVertex(), certifiedToscaElement.getVertex(), EdgeLabelEnum.LAST_STATE, foundEdge);
+ if (createEdgeRes != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create rfc relation for component {}. status=", certifiedToscaElement.getUniqueId(), createEdgeRes);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(createEdgeRes);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdgeRes);
}
}
if (result == null) {
@@ -566,7 +577,7 @@
private StorageOperationStatus handleRelationsUponFailCertification(GraphVertex toscaElement, LifecycleStateEnum nextState) {
StorageOperationStatus result = null;
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
Edge originEdge;
Vertex user = null;
if (nextState == LifecycleStateEnum.NOT_CERTIFIED_CHECKIN) {
@@ -575,7 +586,8 @@
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
- Either<Edge, TitanOperationStatus> deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.STATE, properties);
+ Either<Edge, JanusGraphOperationStatus> deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.STATE, properties);
if (deleteResult.isRight()) {
status = deleteResult.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete state edge. Status is {}. ", status);
@@ -584,7 +596,8 @@
if (result == null) {
// delete relation READY_FOR_CERTIFICATION
properties.put(GraphPropertyEnum.STATE, LifecycleStateEnum.READY_FOR_CERTIFICATION);
- deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
+ deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
if (deleteResult.isRight()) {
status = deleteResult.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_DELETE_LAST_STATE_EDGE_STATUS_IS, status);
@@ -594,7 +607,8 @@
if (result == null) {
// delete relation NOT_CERTIFIED_CHECKIN (in order to change to STATE)
properties.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
- deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
+ deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
if (deleteResult.isRight()) {
status = deleteResult.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_DELETE_LAST_STATE_EDGE_STATUS_IS, status);
@@ -605,16 +619,18 @@
// create new STATE relation NOT_CERTIFIED_CHECKIN
originEdge = deleteResult.left().value();
user = originEdge.outVertex();
- status = titanDao.createEdge(user, toscaElement.getVertex(), EdgeLabelEnum.STATE, originEdge);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(user, toscaElement.getVertex(), EdgeLabelEnum.STATE, originEdge);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create state edge. Status is {}. ", status);
result = StorageOperationStatus.INCONSISTENCY;
}
}
if (result == null) {
// delete relation LAST_MODIFIER (in order to change tester to designer)
- deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
- if (status != TitanOperationStatus.OK) {
+ deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create last modifier edge. Status is {}. ", status);
result = StorageOperationStatus.INCONSISTENCY;
}
@@ -622,8 +638,8 @@
if (result == null) {
// create new LAST_MODIFIER relation
originEdge = deleteResult.left().value();
- status = titanDao.createEdge(user, toscaElement.getVertex(), EdgeLabelEnum.LAST_MODIFIER, originEdge);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao.createEdge(user, toscaElement.getVertex(), EdgeLabelEnum.LAST_MODIFIER, originEdge);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create last modifier edge. Status is {}. ", status);
result = StorageOperationStatus.INCONSISTENCY;
}
@@ -642,7 +658,8 @@
// delete relation CERTIFICATION_IN_PROGRESS
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
- Either<Edge, TitanOperationStatus> deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.STATE, properties);
+ Either<Edge, JanusGraphOperationStatus> deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.STATE, properties);
if (deleteResult.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete state edge. Status is {}. ", deleteResult.right().value());
@@ -651,7 +668,8 @@
if (result == null) {
// delete relation READY_FOR_CERTIFICATION (LAST_STATE)
properties.put(GraphPropertyEnum.STATE, nextState);
- deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
+ deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElement, EdgeLabelEnum.LAST_STATE, properties);
if (deleteResult.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_DELETE_LAST_STATE_EDGE_STATUS_IS, deleteResult.right().value());
@@ -661,8 +679,10 @@
if (result == null) {
// create relation READY_FOR_CERTIFICATION (STATE)
originEdge = deleteResult.left().value();
- TitanOperationStatus status = titanDao.createEdge(originEdge.outVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, originEdge);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ status = janusGraphDao
+ .createEdge(originEdge.outVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, originEdge);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create state edge. Status is {}. ", status);
result = StorageOperationStatus.INCONSISTENCY;
}
@@ -686,15 +706,17 @@
Vertex lastCertifiedVertex = findRes.left().value();
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.IS_HIGHEST_VERSION, false);
- TitanOperationStatus status = titanDao.updateVertexMetadataPropertiesWithJson(lastCertifiedVertex, properties);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = janusGraphDao
+ .updateVertexMetadataPropertiesWithJson(lastCertifiedVertex, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to set highest version of tosca element {} to [{}]. Status is {}", toscaElement.getUniqueId(), false, status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
// remove previous certified version from the catalog
GraphVertex lastCertifiedV = new GraphVertex();
- lastCertifiedV.setVertex((TitanVertex) lastCertifiedVertex);
- lastCertifiedV.setUniqueId((String) titanDao.getProperty((TitanVertex) lastCertifiedVertex, GraphPropertyEnum.UNIQUE_ID.getProperty()));
+ lastCertifiedV.setVertex((JanusGraphVertex) lastCertifiedVertex);
+ lastCertifiedV.setUniqueId((String) janusGraphDao
+ .getProperty((JanusGraphVertex) lastCertifiedVertex, GraphPropertyEnum.UNIQUE_ID.getProperty()));
StorageOperationStatus res = updateEdgeToCatalogRoot(null, lastCertifiedV);
if (res != StorageOperationStatus.OK) {
return res;
@@ -708,41 +730,45 @@
}
private StorageOperationStatus handleRelationsUponRequestForCertification(GraphVertex toscaElement, GraphVertex modifier, GraphVertex owner) {
- TitanOperationStatus status;
+ JanusGraphOperationStatus status;
StorageOperationStatus result = null;
if (((String) toscaElement.getMetadataProperty(GraphPropertyEnum.STATE)).equals(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name())) {
// remove CHECKOUT relation
- Either<Edge, TitanOperationStatus> deleteRes = titanDao.deleteEdge(owner, toscaElement, EdgeLabelEnum.STATE);
+ Either<Edge, JanusGraphOperationStatus> deleteRes = janusGraphDao
+ .deleteEdge(owner, toscaElement, EdgeLabelEnum.STATE);
if (deleteRes.isRight()) {
status = deleteRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete edge. Status is {}. ", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (result == null) {
// create CHECKIN relation
Map<EdgePropertyEnum, Object> properties = new EnumMap<>(EdgePropertyEnum.class);
properties.put(EdgePropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
- status = titanDao.createEdge(modifier.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.LAST_STATE, properties);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(modifier.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.LAST_STATE, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge. Status is {}", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
} else {
- status = titanDao.replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
- if (status != TitanOperationStatus.OK) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ status = janusGraphDao
+ .replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
+ if (status != JanusGraphOperationStatus.OK) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
if (result == null) {
// create RFC relation
Map<EdgePropertyEnum, Object> properties = new EnumMap<>(EdgePropertyEnum.class);
properties.put(EdgePropertyEnum.STATE, LifecycleStateEnum.READY_FOR_CERTIFICATION);
- status = titanDao.createEdge(modifier.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, properties);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(modifier.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge. Status is {}", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
if (result == null) {
@@ -754,17 +780,19 @@
private StorageOperationStatus handleRelationsUponCertification(GraphVertex toscaElement, GraphVertex modifier, GraphVertex owner) {
StorageOperationStatus result = null;
- TitanOperationStatus status = titanDao.replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
- if (status != TitanOperationStatus.OK) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ JanusGraphOperationStatus status = janusGraphDao
+ .replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
+ if (status != JanusGraphOperationStatus.OK) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (result == null) {
Map<EdgePropertyEnum, Object> properties = new EnumMap<>(EdgePropertyEnum.class);
properties.put(EdgePropertyEnum.STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
- status = titanDao.createEdge(modifier, toscaElement, EdgeLabelEnum.STATE, properties);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(modifier, toscaElement, EdgeLabelEnum.STATE, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "failed to create edge. Status is {}", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
if (result == null) {
@@ -816,7 +844,7 @@
jsonMetadataMap.put(GraphPropertyEnum.IS_HIGHEST_VERSION.getProperty(), true);
propertiesToUpdate.put(GraphPropertyEnum.METADATA.getProperty(), JsonParserUtils.toJson(jsonMetadataMap));
- titanDao.setVertexProperties(previousVersionToscaElement, propertiesToUpdate);
+ janusGraphDao.setVertexProperties(previousVersionToscaElement, propertiesToUpdate);
Iterator<Edge> edgesIter = previousVersionToscaElement.edges(Direction.IN, EdgeLabelEnum.LAST_STATE.name());
if (!edgesIter.hasNext()) {
@@ -825,12 +853,13 @@
} else {
Edge lastStateEdge = edgesIter.next();
Vertex lastModifier = lastStateEdge.outVertex();
- TitanOperationStatus replaceRes = titanDao.replaceEdgeLabel(lastModifier, previousVersionToscaElement, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
- if (replaceRes != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus replaceRes = janusGraphDao
+ .replaceEdgeLabel(lastModifier, previousVersionToscaElement, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
+ if (replaceRes != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to replace label from {} to {}. status = {}", EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE, replaceRes);
result = StorageOperationStatus.INCONSISTENCY;
- if (replaceRes != TitanOperationStatus.INVALID_ID) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(replaceRes);
+ if (replaceRes != JanusGraphOperationStatus.INVALID_ID) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(replaceRes);
}
}
@@ -848,31 +877,34 @@
String toscaElementId = toscaElementVertex.getUniqueId();
if (!toscaElementVertex.getMetadataProperty(GraphPropertyEnum.STATE).equals(LifecycleStateEnum.CERTIFIED.name())) {
toscaElementVertex.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, false);
- Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(toscaElementVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateVertexRes = janusGraphDao.updateVertex(toscaElementVertex);
if (updateVertexRes.isRight()) {
- TitanOperationStatus titatStatus = updateVertexRes.right().value();
+ JanusGraphOperationStatus titatStatus = updateVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update tosca element vertex {}. Status is {}", toscaElementVertex.getUniqueId(), titatStatus);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(titatStatus);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(titatStatus);
}
- Either<Edge, TitanOperationStatus> deleteEdgeRes = null;
+ Either<Edge, JanusGraphOperationStatus> deleteEdgeRes = null;
if (result == null) {
CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to replace edge with label {} to label {} from {} to {}. ", EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE, ownerId, toscaElementId);
- deleteEdgeRes = titanDao.deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.STATE);
+ deleteEdgeRes = janusGraphDao
+ .deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.STATE);
if (deleteEdgeRes.isRight()) {
- TitanOperationStatus titanStatus = deleteEdgeRes.right().value();
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete edge with label {} from {} to {}. Status is {} ", EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE, ownerId, toscaElementId, titanStatus);
- if (!titanStatus.equals(TitanOperationStatus.INVALID_ID)) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(titanStatus);
+ JanusGraphOperationStatus janusGraphStatus = deleteEdgeRes.right().value();
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete edge with label {} from {} to {}. Status is {} ", EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE, ownerId, toscaElementId, janusGraphStatus);
+ if (!janusGraphStatus.equals(JanusGraphOperationStatus.INVALID_ID)) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(janusGraphStatus);
} else {
result = StorageOperationStatus.INCONSISTENCY;
}
}
}
if (result == null) {
- TitanOperationStatus createEdgeRes = titanDao.createEdge(ownerVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.LAST_STATE, deleteEdgeRes.left().value());
- if (createEdgeRes != TitanOperationStatus.OK) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(createEdgeRes);
+ JanusGraphOperationStatus
+ createEdgeRes = janusGraphDao
+ .createEdge(ownerVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.LAST_STATE, deleteEdgeRes.left().value());
+ if (createEdgeRes != JanusGraphOperationStatus.OK) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdgeRes);
}
}
}
@@ -907,11 +939,13 @@
GraphVertex clonedVertex = null;
if (result == null) {
clonedVertex = cloneResult.left().value();
- TitanOperationStatus status = titanDao.createEdge(toscaElementVertex.getVertex(), cloneResult.left().value().getVertex(), EdgeLabelEnum.VERSION, new HashMap<>());
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ status = janusGraphDao
+ .createEdge(toscaElementVertex.getVertex(), cloneResult.left().value().getVertex(), EdgeLabelEnum.VERSION, new HashMap<>());
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge with label {} from vertex {} to tosca element vertex {} on graph. Status is {}. ", EdgeLabelEnum.VERSION,
toscaElementVertex.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), cloneResult.left().value().getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
@@ -969,7 +1003,8 @@
if (!instInputs.isEmpty()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "before add inst inputs {} ", instInputs == null ? 0 : instInputs.size());
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> instInpVertexEither = titanDao.getChildVertex(toscaElementVertex, EdgeLabelEnum.INST_INPUTS, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> instInpVertexEither = janusGraphDao
+ .getChildVertex(toscaElementVertex, EdgeLabelEnum.INST_INPUTS, JsonParseFlagEnum.ParseJson);
if (instInpVertexEither.isLeft()) {
toscaDataVertex = instInpVertexEither.left().value();
}
@@ -985,7 +1020,8 @@
if (!instGroups.isEmpty()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "before add inst groups {} ", instGroups == null ? 0 : instGroups.size());
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> instGrVertexEither = titanDao.getChildVertex(toscaElementVertex, EdgeLabelEnum.INST_GROUPS, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> instGrVertexEither = janusGraphDao
+ .getChildVertex(toscaElementVertex, EdgeLabelEnum.INST_GROUPS, JsonParseFlagEnum.ParseJson);
if (instGrVertexEither.isLeft()) {
toscaDataVertex = instGrVertexEither.left().value();
}
@@ -1003,11 +1039,11 @@
Map<String, CompositionDataDefinition> jsonComposition = (Map<String, CompositionDataDefinition>) clonedVertex.getJson();
CompositionDataDefinition compositionDataDefinition = jsonComposition.get(JsonConstantKeysEnum.COMPOSITION.getValue());
compositionDataDefinition.setComponentInstances(instancesMap);
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(clonedVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao.updateVertex(clonedVertex);
if (updateElement.isRight()) {
- TitanOperationStatus status = updateElement.right().value();
+ JanusGraphOperationStatus status = updateElement.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update instances on metadata vertex . Status is {}. ", status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
}
@@ -1234,11 +1270,13 @@
}
}
if (result == null) {
- TitanOperationStatus status = titanDao.createEdge(previousCertifiedToscaElement, clonedToscaElement.getVertex(), EdgeLabelEnum.VERSION, new HashMap<>());
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ status = janusGraphDao
+ .createEdge(previousCertifiedToscaElement, clonedToscaElement.getVertex(), EdgeLabelEnum.VERSION, new HashMap<>());
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge with label {} from vertex {} to tosca element vertex {} on graph. Status is {}. ", EdgeLabelEnum.VERSION,
previousCertifiedToscaElement.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), clonedToscaElement.getUniqueId(), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
@@ -1269,9 +1307,10 @@
Map<GraphPropertyEnum, Object> properties = new HashMap<>();
properties.put(GraphPropertyEnum.UUID, uuid);
properties.put(GraphPropertyEnum.NAME, componentName);
- Either<List<GraphVertex>, TitanOperationStatus> getToscaElementsRes = titanDao.getByCriteria(toscaElementVertex.getLabel(), properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getToscaElementsRes = janusGraphDao
+ .getByCriteria(toscaElementVertex.getLabel(), properties, JsonParseFlagEnum.ParseMetadata);
if (getToscaElementsRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getToscaElementsRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getToscaElementsRes.right().value()));
}
if (result == null) {
previosVersions = getToscaElementsRes.left().value();
@@ -1344,11 +1383,11 @@
Either<GraphVertex, StorageOperationStatus> result;
- Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(toscaElementVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateVertexRes = janusGraphDao.updateVertex(toscaElementVertex);
if (updateVertexRes.isRight()) {
- TitanOperationStatus titatStatus = updateVertexRes.right().value();
+ JanusGraphOperationStatus titatStatus = updateVertexRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update state of tosca element vertex {} metadata. Status is {}", toscaElementVertex.getUniqueId(), titatStatus);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titatStatus));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(titatStatus));
} else {
result = Either.left(updateVertexRes.left().value());
}
@@ -1364,7 +1403,8 @@
// In case of cancel "ready for certification" remove last state edge with "STATE" property equals to "NOT_CERTIFIED_CHECKIN"
Map<GraphPropertyEnum, Object> vertexProperties = new EnumMap<>(GraphPropertyEnum.class);
vertexProperties.put(GraphPropertyEnum.STATE, nextState);
- Either<Edge, TitanOperationStatus> deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElementVertex, EdgeLabelEnum.LAST_STATE, vertexProperties);
+ Either<Edge, JanusGraphOperationStatus> deleteResult = janusGraphDao
+ .deleteBelongingEdgeByCriteria(toscaElementVertex, EdgeLabelEnum.LAST_STATE, vertexProperties);
if (deleteResult.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, faileToUpdateStateMsg, toscaElementVertex.getUniqueId(), deleteResult.right().value());
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "failed to update last state relation");
@@ -1373,20 +1413,23 @@
}
if (result == null) {
// Remove CHECKOUT relation
- Either<Edge, TitanOperationStatus> deleteEdgeResult = titanDao.deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.STATE);
+ Either<Edge, JanusGraphOperationStatus> deleteEdgeResult = janusGraphDao
+ .deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.STATE);
if (deleteEdgeResult.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, faileToUpdateStateMsg, toscaElementVertex.getUniqueId());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(deleteEdgeResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteEdgeResult.right().value()));
}
}
if (result == null) {
// Create CHECKIN relation
Map<EdgePropertyEnum, Object> edgeProperties = new EnumMap<>(EdgePropertyEnum.class);
edgeProperties.put(EdgePropertyEnum.STATE, nextState);
- TitanOperationStatus createEdgeRes = titanDao.createEdge(modifierVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.STATE, edgeProperties);
- if (createEdgeRes != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdgeRes = janusGraphDao
+ .createEdge(modifierVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.STATE, edgeProperties);
+ if (createEdgeRes != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, faileToUpdateStateMsg, toscaElementVertex.getUniqueId());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdgeRes));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdgeRes));
}
}
if (result == null) {
@@ -1398,17 +1441,19 @@
private Either<GraphVertex, StorageOperationStatus> updateLastModifierEdge(GraphVertex toscaElementVertex, GraphVertex ownerVertex, GraphVertex modifierVertex) {
Either<GraphVertex, StorageOperationStatus> result = null;
if (!modifierVertex.getMetadataProperties().get(GraphPropertyEnum.USERID).equals(ownerVertex.getMetadataProperties().get(GraphPropertyEnum.USERID))) {
- Either<Edge, TitanOperationStatus> deleteEdgeRes = titanDao.deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.LAST_MODIFIER);
+ Either<Edge, JanusGraphOperationStatus> deleteEdgeRes = janusGraphDao
+ .deleteEdge(ownerVertex, toscaElementVertex, EdgeLabelEnum.LAST_MODIFIER);
if (deleteEdgeRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete last modifier {} to tosca element {}. Edge type is {}", ownerVertex.getUniqueId(), ownerVertex.getUniqueId(), EdgeLabelEnum.LAST_MODIFIER);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(deleteEdgeRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteEdgeRes.right().value()));
}
if (result == null) {
- TitanOperationStatus createEdgeRes = titanDao.createEdge(modifierVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
+ JanusGraphOperationStatus createEdgeRes = janusGraphDao
+ .createEdge(modifierVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
- if (createEdgeRes != TitanOperationStatus.OK) {
+ if (createEdgeRes != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to associate user {} to component {}. Edge type is {}", modifierVertex.getUniqueId(), ownerVertex.getUniqueId(), EdgeLabelEnum.LAST_MODIFIER);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdgeRes));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdgeRes));
} else {
result = Either.left(modifierVertex);
}
@@ -1473,10 +1518,11 @@
GraphVertex modifier = null;
GraphVertex owner;
try {
- Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesRes = titanDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> getVerticesRes = janusGraphDao
+ .getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForRequestCertification(toscaElementId, modifierId, ownerId));
if (getVerticesRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVerticesRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVerticesRes.right().value()));
}
if (result == null) {
toscaElement = getVerticesRes.left().value().get(toscaElementId);
@@ -1515,17 +1561,19 @@
private StorageOperationStatus handleRelationsUponForceCertification(GraphVertex toscaElement, GraphVertex modifier, GraphVertex owner) {
StorageOperationStatus result = null;
- TitanOperationStatus status = titanDao.replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
- if (status != TitanOperationStatus.OK) {
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ JanusGraphOperationStatus status = janusGraphDao
+ .replaceEdgeLabel(owner.getVertex(), toscaElement.getVertex(), EdgeLabelEnum.STATE, EdgeLabelEnum.LAST_STATE);
+ if (status != JanusGraphOperationStatus.OK) {
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (result == null) {
Map<EdgePropertyEnum, Object> properties = new EnumMap<>(EdgePropertyEnum.class);
properties.put(EdgePropertyEnum.STATE, LifecycleStateEnum.CERTIFIED);
- status = titanDao.createEdge(modifier, toscaElement, EdgeLabelEnum.STATE, properties);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(modifier, toscaElement, EdgeLabelEnum.STATE, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "failed to create edge. Status is {}", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
if (result == null) {
@@ -1534,25 +1582,27 @@
return result;
}
- private StorageOperationStatus updateEdgeToCatalogRootByUndoCheckout(TitanVertex preV, GraphVertex curV) {
+ private StorageOperationStatus updateEdgeToCatalogRootByUndoCheckout(JanusGraphVertex preV, GraphVertex curV) {
if (preV == null) {
return updateEdgeToCatalogRoot(null, curV);
}
- String uniqueIdPreVer = (String) titanDao.getProperty((TitanVertex) preV, GraphPropertyEnum.UNIQUE_ID.getProperty());
- LifecycleStateEnum state = LifecycleStateEnum.findState((String) titanDao.getProperty(preV, GraphPropertyEnum.STATE.getProperty()));
+ String uniqueIdPreVer = (String) janusGraphDao
+ .getProperty((JanusGraphVertex) preV, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ LifecycleStateEnum state = LifecycleStateEnum.findState((String) janusGraphDao
+ .getProperty(preV, GraphPropertyEnum.STATE.getProperty()));
if (state == LifecycleStateEnum.CERTIFIED) {
return updateEdgeToCatalogRoot(null, curV);
}
- return titanDao.getVertexById(uniqueIdPreVer)
+ return janusGraphDao.getVertexById(uniqueIdPreVer)
.either(l -> updateEdgeToCatalogRoot(l, curV),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private StorageOperationStatus updateEdgeToCatalogRoot(GraphVertex newVersionV, GraphVertex prevVersionV) {
- Either<GraphVertex, TitanOperationStatus> catalog = titanDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT);
+ Either<GraphVertex, JanusGraphOperationStatus> catalog = janusGraphDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT);
if (catalog.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch catalog vertex. error {}", catalog.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(catalog.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(catalog.right().value());
}
GraphVertex catalogV = catalog.left().value();
if (newVersionV != null) {
@@ -1560,10 +1610,12 @@
if ( isAbstract == null || !isAbstract ) {
// no new vertex, only delete previous
- TitanOperationStatus result = titanDao.createEdge(catalogV, newVersionV, EdgeLabelEnum.CATALOG_ELEMENT, null);
- if (result != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ result = janusGraphDao
+ .createEdge(catalogV, newVersionV, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ if (result != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge from {} to catalog vertex. error {}", newVersionV.getUniqueId(), result);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(result);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(result);
}
}
}
@@ -1571,10 +1623,11 @@
Boolean isAbstract = (Boolean) prevVersionV.getMetadataProperty(GraphPropertyEnum.IS_ABSTRACT);
if (isAbstract == null || !isAbstract) {
// if prev == null -> new resource was added
- Either<Edge, TitanOperationStatus> deleteResult = titanDao.deleteEdge(catalogV, prevVersionV, EdgeLabelEnum.CATALOG_ELEMENT);
+ Either<Edge, JanusGraphOperationStatus> deleteResult = janusGraphDao
+ .deleteEdge(catalogV, prevVersionV, EdgeLabelEnum.CATALOG_ELEMENT);
if (deleteResult.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete edge from {} to catalog vertex. error {}", prevVersionV.getUniqueId(), deleteResult.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(deleteResult.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteResult.right().value());
}
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
similarity index 79%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index f700c2e..791db33 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -29,6 +29,7 @@
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
@@ -36,7 +37,6 @@
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -50,10 +50,10 @@
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -98,10 +98,11 @@
propertiesToMatch.put(GraphPropertyEnum.UNIQUE_ID, uniqueId);
VertexTypeEnum vertexType = ToscaElementTypeEnum.getVertexTypeByToscaType(nodeType);
- Either<List<GraphVertex>, TitanOperationStatus> getResponse = titanDao.getByCriteria(vertexType, propertiesToMatch, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResponse = janusGraphDao
+ .getByCriteria(vertexType, propertiesToMatch, parseFlag);
if (getResponse.isRight()) {
log.debug("Couldn't fetch component with type {} and unique id {}, error: {}", vertexType, uniqueId, getResponse.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value()));
}
List<GraphVertex> componentList = getResponse.left().value();
@@ -130,12 +131,12 @@
componentToDelete.addMetadataProperty(GraphPropertyEnum.IS_DELETED, Boolean.TRUE);
componentToDelete.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
- Either<GraphVertex, TitanOperationStatus> updateNode = titanDao.updateVertex(componentToDelete);
+ Either<GraphVertex, JanusGraphOperationStatus> updateNode = janusGraphDao.updateVertex(componentToDelete);
StorageOperationStatus updateComponent;
if (updateNode.isRight()) {
log.debug("Failed to update component {}. status is {}", componentToDelete.getUniqueId(), updateNode.right().value());
- updateComponent = DaoStatusConverter.convertTitanStatusToStorageStatus(updateNode.right().value());
+ updateComponent = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateNode.right().value());
result = Either.right(updateComponent);
return result;
}
@@ -157,40 +158,43 @@
Either<GraphVertex, StorageOperationStatus> result = null;
GraphVertex createdToscaElementVertex = null;
- TitanOperationStatus status;
+ JanusGraphOperationStatus status;
- Either<GraphVertex, TitanOperationStatus> createNextVersionRes = titanDao.createVertex(nextToscaElement);
+ Either<GraphVertex, JanusGraphOperationStatus> createNextVersionRes = janusGraphDao.createVertex(nextToscaElement);
if (createNextVersionRes.isRight()) {
status = createNextVersionRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create tosca element vertex {} with version {} on graph. Status is {}. ", previousToscaElement.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME),
previousToscaElement.getMetadataProperty(GraphPropertyEnum.VERSION), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
createdToscaElementVertex = createNextVersionRes.left().value();
Map<EdgePropertyEnum, Object> properties = new HashMap<>();
properties.put(EdgePropertyEnum.STATE, createdToscaElementVertex.getMetadataProperty(GraphPropertyEnum.STATE));
- status = titanDao.createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.STATE, properties);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.STATE, properties);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, EdgeLabelEnum.STATE, user.getUniqueId(),
previousToscaElement.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
- status = titanDao.createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, EdgeLabelEnum.LAST_MODIFIER, user.getUniqueId(),
nextToscaElement.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
- status = titanDao.createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.CREATOR, new HashMap<>());
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.CREATOR, new HashMap<>());
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, EdgeLabelEnum.CREATOR, user.getUniqueId(),
nextToscaElement.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (result == null) {
@@ -198,11 +202,12 @@
while (edgesToCopyIter.hasNext()) {
Edge currEdge = edgesToCopyIter.next();
Vertex currVertex = currEdge.inVertex();
- status = titanDao.createEdge(createdToscaElementVertex.getVertex(), currVertex, EdgeLabelEnum.getEdgeLabelEnum(currEdge.label()), currEdge);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .createEdge(createdToscaElementVertex.getVertex(), currVertex, EdgeLabelEnum.getEdgeLabelEnum(currEdge.label()), currEdge);
+ if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge with label {} from tosca element vertex {} to vertex with label {} on graph. Status is {}. ", currEdge.label(), createdToscaElementVertex.getUniqueId(),
currVertex.property(GraphPropertyEnum.LABEL.getProperty()), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
break;
}
}
@@ -216,8 +221,9 @@
return result;
}
- protected TitanOperationStatus setLastModifierFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
- Either<GraphVertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(componentV, EdgeLabelEnum.LAST_MODIFIER, JsonParseFlagEnum.NoParse);
+ protected JanusGraphOperationStatus setLastModifierFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(componentV, EdgeLabelEnum.LAST_MODIFIER, JsonParseFlagEnum.NoParse);
if (parentVertex.isRight()) {
log.debug("Failed to fetch last modifier for tosca element with id {} error {}", componentV.getUniqueId(), parentVertex.right().value());
return parentVertex.right().value();
@@ -226,7 +232,7 @@
String userId = (String) userV.getMetadataProperty(GraphPropertyEnum.USERID);
toscaElement.setLastUpdaterUserId(userId);
toscaElement.setLastUpdaterFullName(buildFullName(userV));
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
public String buildFullName(GraphVertex userV) {
@@ -244,8 +250,9 @@
return fullName;
}
- protected TitanOperationStatus setCreatorFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
- Either<GraphVertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(componentV, EdgeLabelEnum.CREATOR, JsonParseFlagEnum.NoParse);
+ protected JanusGraphOperationStatus setCreatorFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(componentV, EdgeLabelEnum.CREATOR, JsonParseFlagEnum.NoParse);
if (parentVertex.isRight()) {
log.debug("Failed to fetch creator for tosca element with id {} error {}", componentV.getUniqueId(), parentVertex.right().value());
return parentVertex.right().value();
@@ -255,7 +262,7 @@
toscaElement.setCreatorUserId(creatorUserId);
toscaElement.setCreatorFullName(buildFullName(userV));
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
protected <T extends ToscaElement> T getResourceMetaDataFromResource(T toscaElement) {
@@ -310,12 +317,12 @@
// handle user
String userId = toscaElement.getCreatorUserId();
- Either<GraphVertex, TitanOperationStatus> findUser = findUserVertex(userId);
+ Either<GraphVertex, JanusGraphOperationStatus> findUser = findUserVertex(userId);
if (findUser.isRight()) {
- TitanOperationStatus status = findUser.right().value();
+ JanusGraphOperationStatus status = findUser.right().value();
log.error(CANNOT_FIND_USER_IN_THE_GRAPH_STATUS_IS, userId, status);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
GraphVertex creatorVertex = findUser.left().value();
@@ -324,9 +331,9 @@
if (updaterId != null && !updaterId.equals(userId)) {
findUser = findUserVertex(updaterId);
if (findUser.isRight()) {
- TitanOperationStatus status = findUser.right().value();
+ JanusGraphOperationStatus status = findUser.right().value();
log.error(CANNOT_FIND_USER_IN_THE_GRAPH_STATUS_IS, userId, status);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
} else {
updaterVertex = findUser.left().value();
}
@@ -334,26 +341,29 @@
Map<EdgePropertyEnum, Object> props = new EnumMap<>(EdgePropertyEnum.class);
props.put(EdgePropertyEnum.STATE, (String) toscaElement.getMetadataValue(JsonPresentationFields.LIFECYCLE_STATE));
- TitanOperationStatus result = titanDao.createEdge(updaterVertex, nodeTypeVertex, EdgeLabelEnum.STATE, props);
+ JanusGraphOperationStatus
+ result = janusGraphDao
+ .createEdge(updaterVertex, nodeTypeVertex, EdgeLabelEnum.STATE, props);
log.debug("After associating user {} to resource {}. Edge type is {}", updaterVertex, nodeTypeVertex.getUniqueId(), EdgeLabelEnum.STATE);
- if (TitanOperationStatus.OK != result) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(result);
+ if (JanusGraphOperationStatus.OK != result) {
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(result);
}
- result = titanDao.createEdge(updaterVertex, nodeTypeVertex, EdgeLabelEnum.LAST_MODIFIER, null);
+ result = janusGraphDao
+ .createEdge(updaterVertex, nodeTypeVertex, EdgeLabelEnum.LAST_MODIFIER, null);
log.debug("After associating user {} to resource {}. Edge type is {}", updaterVertex, nodeTypeVertex.getUniqueId(), EdgeLabelEnum.LAST_MODIFIER);
- if (!result.equals(TitanOperationStatus.OK)) {
+ if (!result.equals(JanusGraphOperationStatus.OK)) {
log.error("Failed to associate user {} to resource {}. Edge type is {}", updaterVertex, nodeTypeVertex.getUniqueId(), EdgeLabelEnum.LAST_MODIFIER);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(result);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(result);
}
toscaElement.setLastUpdaterUserId(toscaElement.getCreatorUserId());
toscaElement.setLastUpdaterFullName(toscaElement.getCreatorFullName());
- result = titanDao.createEdge(creatorVertex, nodeTypeVertex, EdgeLabelEnum.CREATOR, null);
+ result = janusGraphDao.createEdge(creatorVertex, nodeTypeVertex, EdgeLabelEnum.CREATOR, null);
log.debug("After associating user {} to resource {}. Edge type is {} ", creatorVertex, nodeTypeVertex.getUniqueId(), EdgeLabelEnum.CREATOR);
- if (!result.equals(TitanOperationStatus.OK)) {
+ if (!result.equals(JanusGraphOperationStatus.OK)) {
log.error("Failed to associate user {} to resource {}. Edge type is {} ", creatorVertex, nodeTypeVertex.getUniqueId(), EdgeLabelEnum.CREATOR);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(result);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(result);
}
return StorageOperationStatus.OK;
}
@@ -369,10 +379,12 @@
GraphVertex subCategoryV = getCategoryVertex.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(nodeTypeVertex, subCategoryV, EdgeLabelEnum.CATEGORY, new HashMap<>());
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(nodeTypeVertex, subCategoryV, EdgeLabelEnum.CATEGORY, new HashMap<>());
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.trace("Failed to associate resource {} to category {} with id {}", nodeType.getUniqueId(), subcategoryName, subCategoryV.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge);
}
return StorageOperationStatus.OK;
}
@@ -436,53 +448,63 @@
return StorageOperationStatus.OK;
}
- protected TitanOperationStatus disassociateAndDeleteCommonElements(GraphVertex toscaElementVertex) {
- TitanOperationStatus status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ protected JanusGraphOperationStatus disassociateAndDeleteCommonElements(GraphVertex toscaElementVertex) {
+ JanusGraphOperationStatus
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate artifact for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.TOSCA_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.TOSCA_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate tosca artifact for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.DEPLOYMENT_ARTIFACTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.DEPLOYMENT_ARTIFACTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to deployment artifact for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.PROPERTIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.PROPERTIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate properties for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ATTRIBUTES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ATTRIBUTES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate attributes for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate additional information for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.CAPABILITIES);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate capabilities for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.REQUIREMENTS);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.REQUIREMENTS);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate requirements for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FORWARDING_PATH);
- if (status != TitanOperationStatus.OK) {
+ status = janusGraphDao
+ .disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.FORWARDING_PATH);
+ if (status != JanusGraphOperationStatus.OK) {
log.debug("Failed to disaccociate requirements for {} error {}", toscaElementVertex.getUniqueId(), status);
return status;
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
protected StorageOperationStatus assosiateCommonForToscaElement(GraphVertex nodeTypeVertex, ToscaElement toscaElement, List<GraphVertex> derivedResources) {
@@ -521,14 +543,16 @@
}
private StorageOperationStatus associateToCatalogRoot(GraphVertex nodeTypeVertex) {
- Either<GraphVertex, TitanOperationStatus> catalog = titanDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT);
+ Either<GraphVertex, JanusGraphOperationStatus> catalog = janusGraphDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT);
if (catalog.isRight()) {
log.debug("Failed to fetch catalog vertex. error {}", catalog.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(catalog.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(catalog.right().value());
}
- TitanOperationStatus createEdge = titanDao.createEdge(catalog.left().value(), nodeTypeVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(catalog.left().value(), nodeTypeVertex, EdgeLabelEnum.CATALOG_ELEMENT, null);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge);
}
protected StorageOperationStatus associatePropertiesToResource(GraphVertex nodeTypeVertex, ToscaElement nodeType, List<GraphVertex> derivedResources) {
@@ -579,11 +603,12 @@
if (derivedResources != null && !derivedResources.isEmpty()) {
for (GraphVertex derived : derivedResources) {
- Either<List<GraphVertex>, TitanOperationStatus> derivedProperties = titanDao.getChildrenVertecies(derived, edge, JsonParseFlagEnum.ParseJson);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> derivedProperties = janusGraphDao
+ .getChildrenVertecies(derived, edge, JsonParseFlagEnum.ParseJson);
if (derivedProperties.isRight()) {
- if (derivedProperties.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (derivedProperties.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get properties for derived from {} error {}", derived.getUniqueId(), derivedProperties.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(derivedProperties.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(derivedProperties.right().value()));
} else {
continue;
}
@@ -601,12 +626,12 @@
return Either.left(propertiesAll);
}
- protected TitanOperationStatus setArtifactsFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ARTIFACTS);
+ protected JanusGraphOperationStatus setArtifactsFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ARTIFACTS);
if (result.isLeft()) {
toscaElement.setArtifacts(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
@@ -614,7 +639,7 @@
if (result.isLeft()) {
toscaElement.setDeploymentArtifacts(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
@@ -622,37 +647,41 @@
if (result.isLeft()) {
toscaElement.setToscaArtifacts(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected TitanOperationStatus setAllVersions(GraphVertex componentV, ToscaElement toscaElement) {
+ protected JanusGraphOperationStatus setAllVersions(GraphVertex componentV, ToscaElement toscaElement) {
Map<String, String> allVersion = new HashMap<>();
allVersion.put((String) componentV.getMetadataProperty(GraphPropertyEnum.VERSION), componentV.getUniqueId());
ArrayList<GraphVertex> allChildrenAndParants = new ArrayList<>();
- Either<GraphVertex, TitanOperationStatus> childResourceRes = titanDao.getChildVertex(componentV, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childResourceRes = janusGraphDao
+ .getChildVertex(componentV, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
while (childResourceRes.isLeft()) {
GraphVertex child = childResourceRes.left().value();
allChildrenAndParants.add(child);
- childResourceRes = titanDao.getChildVertex(child, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ childResourceRes = janusGraphDao
+ .getChildVertex(child, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
}
- TitanOperationStatus operationStatus = childResourceRes.right().value();
+ JanusGraphOperationStatus operationStatus = childResourceRes.right().value();
- if (operationStatus != TitanOperationStatus.NOT_FOUND) {
+ if (operationStatus != JanusGraphOperationStatus.NOT_FOUND) {
return operationStatus;
} else {
- Either<GraphVertex, TitanOperationStatus> parentResourceRes = titanDao.getParentVertex(componentV, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> parentResourceRes = janusGraphDao
+ .getParentVertex(componentV, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
while (parentResourceRes.isLeft()) {
GraphVertex parent = parentResourceRes.left().value();
allChildrenAndParants.add(parent);
- parentResourceRes = titanDao.getParentVertex(parent, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ parentResourceRes = janusGraphDao
+ .getParentVertex(parent, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
}
operationStatus = parentResourceRes.right().value();
- if (operationStatus != TitanOperationStatus.NOT_FOUND) {
+ if (operationStatus != JanusGraphOperationStatus.NOT_FOUND) {
return operationStatus;
} else {
allChildrenAndParants.stream().filter(vertex -> {
@@ -661,7 +690,7 @@
}).forEach(vertex -> allVersion.put((String) vertex.getMetadataProperty(GraphPropertyEnum.VERSION), vertex.getUniqueId()));
toscaElement.setAllVersions(allVersion);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
}
}
@@ -679,10 +708,11 @@
}
// in case of user id == null -> get all users by label
// for Tester and Admin retrieve all users
- Either<List<GraphVertex>, TitanOperationStatus> usersByCriteria = titanDao.getByCriteria(VertexTypeEnum.USER, props, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> usersByCriteria = janusGraphDao
+ .getByCriteria(VertexTypeEnum.USER, props, JsonParseFlagEnum.NoParse);
if (usersByCriteria.isRight()) {
log.debug("Failed to fetch users by criteria {} error {}", props, usersByCriteria.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(usersByCriteria.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(usersByCriteria.right().value()));
}
List<GraphVertex> users = usersByCriteria.left().value();
@@ -691,10 +721,11 @@
for (GraphVertex userV : users) {
HashSet<String> ids = new HashSet<>();
- Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = titanDao.getChildrenVertecies(userV, EdgeLabelEnum.STATE, JsonParseFlagEnum.NoParse);
- if (childrenVertecies.isRight() && childrenVertecies.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies = janusGraphDao
+ .getChildrenVertecies(userV, EdgeLabelEnum.STATE, JsonParseFlagEnum.NoParse);
+ if (childrenVertecies.isRight() && childrenVertecies.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to fetch children vertices for user {} by edge {} error {}", userV.getMetadataProperty(GraphPropertyEnum.USERID), EdgeLabelEnum.STATE, childrenVertecies.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenVertecies.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenVertecies.right().value()));
}
// get all resource with current state
@@ -710,10 +741,11 @@
}
if (lastStateStates != null && !lastStateStates.isEmpty()) {
// get all resource with last state
- childrenVertecies = titanDao.getChildrenVertecies(userV, EdgeLabelEnum.LAST_STATE, JsonParseFlagEnum.NoParse);
- if (childrenVertecies.isRight() && childrenVertecies.right().value() != TitanOperationStatus.NOT_FOUND) {
+ childrenVertecies = janusGraphDao
+ .getChildrenVertecies(userV, EdgeLabelEnum.LAST_STATE, JsonParseFlagEnum.NoParse);
+ if (childrenVertecies.isRight() && childrenVertecies.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to fetch children vertices for user {} by edge {} error {}", userV.getMetadataProperty(GraphPropertyEnum.USERID), EdgeLabelEnum.LAST_STATE, childrenVertecies.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenVertecies.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenVertecies.right().value()));
}
if (childrenVertecies.isLeft()) {
boolean isFirst;
@@ -748,7 +780,7 @@
Iterator<Edge> edges = node.getVertex().edges(Direction.IN, edgelabel.name());
while (edges.hasNext()) {
Edge edge = edges.next();
- String stateStr = (String) titanDao.getProperty(edge, EdgePropertyEnum.STATE);
+ String stateStr = (String) janusGraphDao.getProperty(edge, EdgePropertyEnum.STATE);
LifecycleStateEnum nodeState = LifecycleStateEnum.findState(stateStr);
if (nodeState == null) {
@@ -809,9 +841,9 @@
}
protected <T extends ToscaElement> Either<T, StorageOperationStatus> getLightComponent(String componentUid, ComponentTypeEnum nodeType, ComponentParametersView parametersFilter) {
- Either<GraphVertex, TitanOperationStatus> getVertexRes = titanDao.getVertexById(componentUid);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexRes = janusGraphDao.getVertexById(componentUid);
if (getVertexRes.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexRes.right().value()));
}
return getLightComponent(getVertexRes.left().value(), nodeType, parametersFilter);
}
@@ -820,39 +852,39 @@
log.trace("Starting to build light component of type {}, id {}", nodeType, vertexComponent.getUniqueId());
- titanDao.parseVertexProperties(vertexComponent, JsonParseFlagEnum.ParseMetadata);
+ janusGraphDao.parseVertexProperties(vertexComponent, JsonParseFlagEnum.ParseMetadata);
T toscaElement = convertToComponent(vertexComponent);
- TitanOperationStatus status = setCreatorFromGraph(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus status = setCreatorFromGraph(vertexComponent, toscaElement);
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
status = setLastModifierFromGraph(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
status = setCategoriesFromGraph(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (!parametersFilter.isIgnoreAllVersions()) {
status = setAllVersions(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!parametersFilter.isIgnoreCapabilities()) {
status = setCapabilitiesFromGraph(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
if (!parametersFilter.isIgnoreRequirements()) {
status = setRequirementsFromGraph(vertexComponent, toscaElement);
- if (status != TitanOperationStatus.OK) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
log.debug("Ended to build light component of type {}, id {}", nodeType, vertexComponent.getUniqueId());
@@ -882,24 +914,27 @@
return (T) toscaElement;
}
- protected TitanOperationStatus setResourceCategoryFromGraphV(Vertex vertex, CatalogComponent catalogComponent) {
+ protected JanusGraphOperationStatus setResourceCategoryFromGraphV(Vertex vertex, CatalogComponent catalogComponent) {
- Either<Vertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<Vertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, EdgeLabelEnum.CATEGORY, catalogComponent.getUniqueId(), childVertex.right().value());
return childVertex.right().value();
}
Vertex subCategoryV = childVertex.left().value();
catalogComponent.setSubCategoryNormalizedName((String) subCategoryV.property(JsonPresentationFields.NORMALIZED_NAME.getPresentation()).value());
- Either<Vertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<Vertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
Vertex categoryV = parentVertex.left().value();
catalogComponent.setCategoryNormalizedName((String) categoryV.property(JsonPresentationFields.NORMALIZED_NAME.getPresentation()).value());
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected TitanOperationStatus setServiceCategoryFromGraphV(Vertex vertex, CatalogComponent catalogComponent) {
- Either<Vertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ protected JanusGraphOperationStatus setServiceCategoryFromGraphV(Vertex vertex, CatalogComponent catalogComponent) {
+ Either<Vertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, EdgeLabelEnum.CATEGORY, catalogComponent.getUniqueId(), childVertex.right().value());
return childVertex.right().value();
@@ -907,14 +942,15 @@
Vertex categoryV = childVertex.left().value();
catalogComponent.setCategoryNormalizedName((String) categoryV.property(JsonPresentationFields.NORMALIZED_NAME.getPresentation()).value());
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- protected TitanOperationStatus setResourceCategoryFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
+ protected JanusGraphOperationStatus setResourceCategoryFromGraph(GraphVertex componentV, ToscaElement toscaElement) {
List<CategoryDefinition> categories = new ArrayList<>();
SubCategoryDefinition subcategory;
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(componentV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(componentV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, EdgeLabelEnum.CATEGORY, componentV.getUniqueId(), childVertex.right().value());
return childVertex.right().value();
@@ -931,7 +967,8 @@
List<String> iconsfromJsonSubcat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS), listTypeSubcat);
subcategory.setIcons(iconsfromJsonSubcat);
- Either<GraphVertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
if (parentVertex.isRight()) {
log.debug("failed to fetch {} for category with id {}, error {}", EdgeLabelEnum.SUB_CATEGORY, subCategoryV.getUniqueId(), parentVertex.right().value());
return childVertex.right().value();
@@ -953,7 +990,7 @@
categories.add(category);
toscaElement.setCategories(categories);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
public <T extends ToscaElement> Either<T, StorageOperationStatus> updateToscaElement(T toscaElementToUpdate, GraphVertex elementV, ComponentParametersView filterResult) {
@@ -972,10 +1009,10 @@
result = Either.right(StorageOperationStatus.BAD_REQUEST);
return result;
}
- Either<GraphVertex, TitanOperationStatus> findUser = findUserVertex(modifierUserId);
+ Either<GraphVertex, JanusGraphOperationStatus> findUser = findUserVertex(modifierUserId);
if (findUser.isRight()) {
- TitanOperationStatus status = findUser.right().value();
+ JanusGraphOperationStatus status = findUser.right().value();
log.error(CANNOT_FIND_USER_IN_THE_GRAPH_STATUS_IS, modifierUserId, status);
return result;
}
@@ -983,10 +1020,11 @@
GraphVertex modifierV = findUser.left().value();
String toscaElementId = toscaElementToUpdate.getUniqueId();
- Either<GraphVertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(elementV, EdgeLabelEnum.LAST_MODIFIER, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(elementV, EdgeLabelEnum.LAST_MODIFIER, JsonParseFlagEnum.NoParse);
if (parentVertex.isRight()) {
log.debug("Failed to fetch last modifier for tosca element with id {} error {}", toscaElementId, parentVertex.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertex.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentVertex.right().value()));
}
GraphVertex userV = parentVertex.left().value();
String currentModifier = (String) userV.getMetadataProperty(GraphPropertyEnum.USERID);
@@ -1018,11 +1056,11 @@
// update all data on vertex
fillToscaElementVertexData(elementV, toscaElementToUpdate, JsonParseFlagEnum.ParseMetadata);
- Either<GraphVertex, TitanOperationStatus> updateElement = titanDao.updateVertex(elementV);
+ Either<GraphVertex, JanusGraphOperationStatus> updateElement = janusGraphDao.updateVertex(elementV);
if (updateElement.isRight()) {
log.error("Failed to update resource {}. status is {}", toscaElementId, updateElement.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateElement.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateElement.right().value()));
return result;
}
GraphVertex updateElementV = updateElement.left().value();
@@ -1031,10 +1069,10 @@
// file names accordingly
String newSystemName = (String) updateElementV.getMetadataProperty(GraphPropertyEnum.SYSTEM_NAME);
if (newSystemName != null && !newSystemName.equals(prevSystemName)) {
- Either<Map<String, ArtifactDataDefinition>, TitanOperationStatus> resultToscaArt = getDataFromGraph(updateElementV, EdgeLabelEnum.TOSCA_ARTIFACTS);
+ Either<Map<String, ArtifactDataDefinition>, JanusGraphOperationStatus> resultToscaArt = getDataFromGraph(updateElementV, EdgeLabelEnum.TOSCA_ARTIFACTS);
if (resultToscaArt.isRight()) {
log.debug("Failed to get tosca artifact from graph for tosca element {} error {}", toscaElementId, resultToscaArt.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resultToscaArt.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resultToscaArt.right().value()));
}
Map<String, ArtifactDataDefinition> toscaArtifacts = resultToscaArt.left().value();
@@ -1069,11 +1107,13 @@
}
protected StorageOperationStatus moveLastModifierEdge(GraphVertex elementV, GraphVertex modifierV) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(titanDao.moveEdge(elementV, modifierV, EdgeLabelEnum.LAST_MODIFIER, Direction.IN));
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphDao.moveEdge(elementV, modifierV, EdgeLabelEnum.LAST_MODIFIER, Direction.IN));
}
protected StorageOperationStatus moveCategoryEdge(GraphVertex elementV, GraphVertex categoryV) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(titanDao.moveEdge(elementV, categoryV, EdgeLabelEnum.CATEGORY, Direction.OUT));
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphDao.moveEdge(elementV, categoryV, EdgeLabelEnum.CATEGORY, Direction.OUT));
}
private void generateNewToscaFileName(String componentType, String componentName, ArtifactDataDefinition artifactInfo) {
@@ -1087,19 +1127,21 @@
List<CategoryDefinition> newCategoryList = toscaElementToUpdate.getCategories();
CategoryDefinition newCategory = newCategoryList.get(0);
- Either<GraphVertex, TitanOperationStatus> childVertex = titanDao.getChildVertex(elementV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertex = janusGraphDao
+ .getChildVertex(elementV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (childVertex.isRight()) {
log.debug(FAILED_TO_FETCH_FOR_TOSCA_ELEMENT_WITH_ID_ERROR, EdgeLabelEnum.CATEGORY, elementV.getUniqueId(), childVertex.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(childVertex.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childVertex.right().value());
}
GraphVertex subCategoryV = childVertex.left().value();
Map<GraphPropertyEnum, Object> metadataProperties = subCategoryV.getMetadataProperties();
String subCategoryNameCurrent = (String) metadataProperties.get(GraphPropertyEnum.NAME);
- Either<GraphVertex, TitanOperationStatus> parentVertex = titanDao.getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertex = janusGraphDao
+ .getParentVertex(subCategoryV, EdgeLabelEnum.SUB_CATEGORY, JsonParseFlagEnum.NoParse);
if (parentVertex.isRight()) {
log.debug("failed to fetch {} for category with id {}, error {}", EdgeLabelEnum.SUB_CATEGORY, subCategoryV.getUniqueId(), parentVertex.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(childVertex.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childVertex.right().value());
}
GraphVertex categoryV = parentVertex.left().value();
metadataProperties = categoryV.getMetadataProperties();
@@ -1134,15 +1176,15 @@
}
public <T extends ToscaElement> Either<List<T>, StorageOperationStatus> getElementCatalogData(ComponentTypeEnum componentType, List<ResourceTypeEnum> excludeTypes, boolean isHighestVersions) {
- Either<List<GraphVertex>, TitanOperationStatus> listOfComponents;
+ Either<List<GraphVertex>, JanusGraphOperationStatus> listOfComponents;
if (isHighestVersions) {
listOfComponents = getListOfHighestComponents(componentType, excludeTypes, JsonParseFlagEnum.NoParse);
} else {
listOfComponents = getListOfHighestAndAllCertifiedComponents(componentType, excludeTypes);
}
- if (listOfComponents.isRight() && listOfComponents.right().value() != TitanOperationStatus.NOT_FOUND) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(listOfComponents.right().value()));
+ if (listOfComponents.isRight() && listOfComponents.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(listOfComponents.right().value()));
}
List<T> result = new ArrayList<>();
if (listOfComponents.isLeft()) {
@@ -1167,9 +1209,9 @@
stopWatch.start();
Map<String, CatalogComponent> existInCatalog = new HashMap<>();
- Either<Iterator<Vertex>, TitanOperationStatus> verticesEither = titanDao.getCatalogOrArchiveVerticies(isCatalog);
+ Either<Iterator<Vertex>, JanusGraphOperationStatus> verticesEither = janusGraphDao.getCatalogOrArchiveVerticies(isCatalog);
if (verticesEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(verticesEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(verticesEither.right().value()));
}
Iterator<Vertex> vertices = verticesEither.left().value();
while (vertices.hasNext()) {
@@ -1234,7 +1276,7 @@
return isAddToCatalog;
}
- public Either<List<GraphVertex>, TitanOperationStatus> getListOfHighestComponents(ComponentTypeEnum
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getListOfHighestComponents(ComponentTypeEnum
componentType, List<ResourceTypeEnum> excludeTypes, JsonParseFlagEnum parseFlag) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
Map<GraphPropertyEnum, Object> propertiesHasNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
@@ -1248,14 +1290,15 @@
propertiesHasNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
propertiesHasNotToMatch.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
- return titanDao.getByCriteria(null, propertiesToMatch, propertiesHasNotToMatch, parseFlag);
+ return janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesHasNotToMatch, parseFlag);
}
// highest + (certified && !highest)
- public Either<List<GraphVertex>, TitanOperationStatus> getListOfHighestAndAllCertifiedComponents
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> getListOfHighestAndAllCertifiedComponents
(ComponentTypeEnum componentType, List<ResourceTypeEnum> excludeTypes) {
long startFetchAllStates = System.currentTimeMillis();
- Either<List<GraphVertex>, TitanOperationStatus> highestNodes = getListOfHighestComponents(componentType, excludeTypes, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> highestNodes = getListOfHighestComponents(componentType, excludeTypes, JsonParseFlagEnum.ParseMetadata);
Map<GraphPropertyEnum, Object> propertiesToMatchCertified = new EnumMap<>(GraphPropertyEnum.class);
Map<GraphPropertyEnum, Object> propertiesHasNotToMatchCertified = new EnumMap<>(GraphPropertyEnum.class);
@@ -1270,8 +1313,9 @@
propertiesHasNotToMatchCertified.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
propertiesHasNotToMatchCertified.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- Either<List<GraphVertex>, TitanOperationStatus> certifiedNotHighestNodes = titanDao.getByCriteria(null, propertiesToMatchCertified, propertiesHasNotToMatchCertified, JsonParseFlagEnum.ParseMetadata);
- if (certifiedNotHighestNodes.isRight() && certifiedNotHighestNodes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> certifiedNotHighestNodes = janusGraphDao
+ .getByCriteria(null, propertiesToMatchCertified, propertiesHasNotToMatchCertified, JsonParseFlagEnum.ParseMetadata);
+ if (certifiedNotHighestNodes.isRight() && certifiedNotHighestNodes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(certifiedNotHighestNodes.right().value());
}
@@ -1298,32 +1342,33 @@
props.put(GraphPropertyEnum.IS_DELETED, true);
props.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
- Either<List<GraphVertex>, TitanOperationStatus> componentsToDelete = titanDao.getByCriteria(null, props, JsonParseFlagEnum.NoParse);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> componentsToDelete = janusGraphDao
+ .getByCriteria(null, props, JsonParseFlagEnum.NoParse);
if (componentsToDelete.isRight()) {
- TitanOperationStatus error = componentsToDelete.right().value();
- if (error.equals(TitanOperationStatus.NOT_FOUND)) {
+ JanusGraphOperationStatus error = componentsToDelete.right().value();
+ if (error.equals(JanusGraphOperationStatus.NOT_FOUND)) {
log.trace("no components to delete");
return Either.left(new ArrayList<>());
} else {
log.info("failed to find components to delete. error : {}", error.name());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
}
return Either.left(componentsToDelete.left().value());
}
- protected TitanOperationStatus setAdditionalInformationFromGraph(GraphVertex componentV, ToscaElement
+ protected JanusGraphOperationStatus setAdditionalInformationFromGraph(GraphVertex componentV, ToscaElement
toscaElement) {
- Either<Map<String, AdditionalInfoParameterDataDefinition>, TitanOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ Either<Map<String, AdditionalInfoParameterDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.ADDITIONAL_INFORMATION);
if (result.isLeft()) {
toscaElement.setAdditionalInformation(result.left().value());
} else {
- if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
return result.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
// --------------------------------------------
@@ -1339,13 +1384,13 @@
public abstract <T extends
ToscaElement> Either<T, StorageOperationStatus> createToscaElement(ToscaElement toscaElement);
- protected abstract <T extends ToscaElement> TitanOperationStatus
+ protected abstract <T extends ToscaElement> JanusGraphOperationStatus
setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement);
- protected abstract <T extends ToscaElement> TitanOperationStatus
+ protected abstract <T extends ToscaElement> JanusGraphOperationStatus
setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement);
- protected abstract <T extends ToscaElement> TitanOperationStatus
+ protected abstract <T extends ToscaElement> JanusGraphOperationStatus
setRequirementsFromGraph(GraphVertex componentV, T toscaElement);
protected abstract <T extends ToscaElement> StorageOperationStatus
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
similarity index 89%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index dd9c3ca..43f3487 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
@@ -27,20 +27,20 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.*;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -84,7 +84,7 @@
@Autowired
private GroupsOperation groupsOperation;
@Autowired
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private static final Logger log = Logger.getLogger(ToscaOperationFacade.class.getName());
// endregion
@@ -107,10 +107,11 @@
public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, ComponentParametersView filters) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, filters.detectParseFlag());
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, filters.detectParseFlag());
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value(), filters);
@@ -118,10 +119,11 @@
public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, JsonParseFlagEnum parseFlag) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, parseFlag);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, parseFlag);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value());
@@ -133,14 +135,15 @@
public Either<Boolean, StorageOperationStatus> validateComponentExists(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
- TitanOperationStatus status = getVertexEither.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getVertexEither.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(false);
} else {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
}
return Either.left(true);
@@ -152,10 +155,11 @@
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- Either<List<GraphVertex>, TitanOperationStatus> getVertexEither = titanDao.getByCriteria(ModelConverter.getVertexType(component), props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getByCriteria(ModelConverter.getVertexType(component), props);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, component.getUniqueId(), getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value().get(0));
@@ -221,10 +225,11 @@
return StorageOperationStatus.OK;
} else {
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao
+ .getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll);
if (getResponse.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentToDelete.getUniqueId(), getResponse.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value());
}
GraphVertex componentV = getResponse.left().value();
@@ -240,10 +245,11 @@
public <T extends Component> Either<T, StorageOperationStatus> deleteToscaComponent(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (getVertexEither.isRight()) {
log.debug("Couldn't fetch component vertex with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
Either<ToscaElement, StorageOperationStatus> deleteElement = deleteToscaElement(getVertexEither.left().value());
@@ -303,14 +309,15 @@
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID);
- Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resources = janusGraphDao
+ .getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
if (resources.isRight()) {
- if (resources.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (resources.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
return StorageOperationStatus.OK;
} else {
log.debug("failed to get resources from graph with property name: {}", csarUUID);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resources.right().value());
}
}
return StorageOperationStatus.ENTITY_ALREADY_EXISTS;
@@ -351,12 +358,13 @@
props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName);
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
- Either<List<GraphVertex>, TitanOperationStatus> getLatestRes = titanDao.getByCriteria(vertexType, props, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestRes = janusGraphDao
+ .getByCriteria(vertexType, props, parseFlag);
if (getLatestRes.isRight()) {
- TitanOperationStatus status = getLatestRes.right().value();
+ JanusGraphOperationStatus status = getLatestRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch {} with name {}. status={} ", vertexType, toscaResourceName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
List<GraphVertex> resources = getLatestRes.left().value();
@@ -413,11 +421,12 @@
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, name);
- Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resources = janusGraphDao
+ .getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
- if (resources.isRight() && resources.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (resources.isRight() && resources.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to get resources from graph with property name: {}", name);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resources.right().value()));
}
List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null);
if (isNotEmpty(resourceList)) {
@@ -442,16 +451,18 @@
copyArtifactsToNewComponent(newComponent, oldComponent);
- Either<GraphVertex, TitanOperationStatus> componentVEither = titanDao.getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> componentVEither = janusGraphDao
+ .getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse);
if (componentVEither.isRight()) {
log.debug("Falied to fetch component {} error {}", oldComponent.getUniqueId(), componentVEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(componentVEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(componentVEither.right().value()));
}
GraphVertex componentv = componentVEither.left().value();
- Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
- if (parentVertexEither.isRight() && parentVertexEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertexEither = janusGraphDao
+ .getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ if (parentVertexEither.isRight() && parentVertexEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Falied to fetch parent version for component {} error {}", oldComponent.getUniqueId(), parentVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentVertexEither.right().value()));
}
Either<ToscaElement, StorageOperationStatus> deleteToscaComponent = deleteToscaElement(componentv);
@@ -465,17 +476,20 @@
return Either.right(createToscaComponent.right().value());
}
Resource newElement = createToscaComponent.left().value();
- Either<GraphVertex, TitanOperationStatus> newVersionEither = titanDao.getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> newVersionEither = janusGraphDao
+ .getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse);
if (newVersionEither.isRight()) {
log.debug("Falied to fetch new tosca element component {} error {}", newComponent.getUniqueId(), newVersionEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(newVersionEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(newVersionEither.right().value()));
}
if (parentVertexEither.isLeft()) {
GraphVertex previousVersionV = parentVertexEither.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null);
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null);
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.debug("Falied to associate to previous version {} new version {} error {}", previousVersionV.getUniqueId(), newVersionEither.right().value(), createEdge);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge));
}
}
return Either.left(newElement);
@@ -512,10 +526,11 @@
public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate, ComponentParametersView filterResult) {
String componentId = componentToUpdate.getUniqueId();
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex elementV = getVertexEither.left().value();
ToscaElementOperation toscaElementOperation = getToscaElementOperation(elementV);
@@ -544,11 +559,12 @@
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> highestResources = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, parseFlag);
if (highestResources.isRight()) {
- TitanOperationStatus status = highestResources.right().value();
+ JanusGraphOperationStatus status = highestResources.right().value();
log.debug("failed to find resource with name {}. status={} ", nodeName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
@@ -587,11 +603,12 @@
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getComponentsRes = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getComponentsRes.isRight()) {
- TitanOperationStatus status = getComponentsRes.right().value();
+ JanusGraphOperationStatus status = getComponentsRes.right().value();
log.debug("Failed to fetch the component with system name {}. Status is {} ", systemName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
componentVertices = getComponentsRes.left().value();
@@ -629,11 +646,12 @@
if (componentType != null) {
hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
}
- Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourceRes = janusGraphDao
+ .getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
if (getResourceRes.isRight()) {
- TitanOperationStatus status = getResourceRes.right().value();
+ JanusGraphOperationStatus status = getResourceRes.right().value();
log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
return getToscaElementByOperation(getResourceRes.left().value().get(0));
@@ -711,7 +729,8 @@
boolean isAllowedToDelete = true;
for (EdgeLabelEnum edgeLabelEnum : forbiddenEdgeLabelEnums) {
- Either<Edge, TitanOperationStatus> belongingEdgeByCriteria = titanDao.getBelongingEdgeByCriteria(elementV, edgeLabelEnum, null);
+ Either<Edge, JanusGraphOperationStatus> belongingEdgeByCriteria = janusGraphDao
+ .getBelongingEdgeByCriteria(elementV, edgeLabelEnum, null);
if (belongingEdgeByCriteria.isLeft()){
log.debug("Marked element {} in use. don't delete it", elementV.getUniqueId());
isAllowedToDelete = false;
@@ -789,13 +808,14 @@
StorageOperationStatus result = null;
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Going to add component instances to component {}", containerComponent.getUniqueId());
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (result == null) {
result = nodeTemplateOperation.associateComponentInstancesToComponent(containerComponent, resourcesInstancesMap, metadataVertex.left().value(), allowDeleted);
@@ -920,10 +940,11 @@
public Either<List<InputDefinition>, StorageOperationStatus> createAndAssociateInputs(Map<String, InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
@@ -948,10 +969,11 @@
public Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(Map<String, InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
@@ -984,11 +1006,12 @@
log.trace("#addDataTypesToComponent - enter, componentId={}", componentId);
/* get component vertex */
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
/* not found / error */
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex vertex = getVertexEither.left().value();
log.trace("#addDataTypesToComponent - get vertex ok");
@@ -1041,10 +1064,11 @@
public Either<List<InputDefinition>, StorageOperationStatus> getComponentInputs(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
@@ -1069,10 +1093,11 @@
public Either<List<InputDefinition>, StorageOperationStatus> updateInputsToComponent(List<InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
@@ -1096,10 +1121,11 @@
// region - ComponentInstance
public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> associateComponentInstancePropertiesToComponent(Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
@@ -1173,10 +1199,11 @@
public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> associateComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instInputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex vertex = getVertexEither.left().value();
@@ -1365,10 +1392,11 @@
public StorageOperationStatus associateDeploymentArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, String componentId, User user) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
@@ -1392,10 +1420,11 @@
public StorageOperationStatus associateArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instArtifacts, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
@@ -1419,10 +1448,11 @@
public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<PropertyDefinition>> instArttributes, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
@@ -1444,10 +1474,11 @@
// endregion
public StorageOperationStatus associateOrAddCalculatedCapReq(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReg, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
@@ -1514,12 +1545,13 @@
Map<GraphPropertyEnum, Object> hasProps = new EnumMap<>(GraphPropertyEnum.class);
Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class);
fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType);
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- if (getRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (getRes.right().value().equals(JanusGraphOperationStatus.NOT_FOUND)) {
return Either.left(new ArrayList<>());
} else {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
}
}
// region -> Fetch non checked-out services
@@ -1565,9 +1597,10 @@
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag);
if (getRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
} else {
List<ComponentMetadataData> latestVersionList = getRes.left().value().stream().map(ModelConverter::convertToComponentMetadata).collect(Collectors.toList());
ComponentMetadataData latestVersion = latestVersionList.size() == 1 ? latestVersionList.get(0)
@@ -1579,9 +1612,10 @@
public Either<ComponentMetadataData, StorageOperationStatus> getComponentMetadata(String componentId) {
Either<ComponentMetadataData, StorageOperationStatus> result;
- Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
} else {
ComponentMetadataData componentMetadata = ModelConverter.convertToComponentMetadata(getRes.left().value());
result = Either.left(componentMetadata);
@@ -1672,10 +1706,11 @@
properties.put(GraphPropertyEnum.NORMALIZED_NAME, normalizedName);
properties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse);
- if (vertexEither.isRight() && vertexEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse);
+ if (vertexEither.isRight() && vertexEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to get vertex from graph with property normalizedName: {}", normalizedName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
if (vertexList != null && !vertexList.isEmpty()) {
@@ -1776,9 +1811,10 @@
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (vertexEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
@@ -1803,11 +1839,12 @@
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (vertexEither.isRight()) {
log.debug("Couldn't fetch metadata for component with uuid {}, error: {}", componentUuid, vertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
@@ -1883,11 +1920,12 @@
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getResourcesRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourcesRes = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getResourcesRes.isRight()) {
log.debug("Failed to fetch all certified resources. Status is {}", getResourcesRes.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getResourcesRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResourcesRes.right().value()));
}
List<GraphVertex> resourceVerticies = getResourcesRes.left().value();
for (GraphVertex resourceV : resourceVerticies) {
@@ -1912,11 +1950,12 @@
hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourceRes = janusGraphDao
+ .getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
if (getResourceRes.isRight()) {
- TitanOperationStatus status = getResourceRes.right().value();
+ JanusGraphOperationStatus status = getResourceRes.right().value();
log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
return getToscaElementByOperation(getResourceRes.left().value().get(0));
@@ -1938,21 +1977,24 @@
GraphVertex resourceMetadataData = null;
List<GraphVertex> resourceMetadataDataList = null;
- Either<List<GraphVertex>, TitanOperationStatus> byCsar = titanDao.getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> byCsar = janusGraphDao
+ .getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata);
if (byCsar.isRight()) {
- if (TitanOperationStatus.NOT_FOUND == byCsar.right().value()) {
+ if (JanusGraphOperationStatus.NOT_FOUND == byCsar.right().value()) {
// Fix Defect DE256036
if (StringUtils.isEmpty(systemName)) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND));
}
props.clear();
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
props.put(GraphPropertyEnum.SYSTEM_NAME, systemName);
- Either<List<GraphVertex>, TitanOperationStatus> bySystemname = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> bySystemname = janusGraphDao
+ .getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata);
if (bySystemname.isRight()) {
log.debug("getLatestResourceByCsarOrName - Failed to find by system name {} error {} ", systemName, bySystemname.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(bySystemname.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(bySystemname.right().value()));
}
if (bySystemname.left().value().size() > 2) {
log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) must return only 2 latest version, but was returned - {}", bySystemname.left().value().size());
@@ -2035,10 +2077,11 @@
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
Map<GraphPropertyEnum, Object> propsHasNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propsHasNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> resourcesByTypeEither = titanDao.getByCriteria(null, props, propsHasNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resourcesByTypeEither = janusGraphDao
+ .getByCriteria(null, props, propsHasNotToMatch, JsonParseFlagEnum.ParseMetadata);
if (resourcesByTypeEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resourcesByTypeEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resourcesByTypeEither.right().value()));
}
List<GraphVertex> vertexList = resourcesByTypeEither.left().value();
@@ -2052,7 +2095,7 @@
}
public void commit() {
- titanDao.commit();
+ janusGraphDao.commit();
}
public Either<Service, StorageOperationStatus> updateDistributionStatus(Service service, User user, DistributionStatusEnum distributionStatus) {
@@ -2070,21 +2113,22 @@
Either<ComponentMetadataData, StorageOperationStatus> result = null;
GraphVertex serviceVertex;
- Either<GraphVertex, TitanOperationStatus> updateRes = null;
- Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> updateRes = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- TitanOperationStatus status = getRes.right().value();
+ JanusGraphOperationStatus status = getRes.right().value();
log.error("Failed to fetch component {}. status is {}", component.getUniqueId(), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
serviceVertex = getRes.left().value();
long lastUpdateDate = System.currentTimeMillis();
serviceVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
component.setLastUpdateDate(lastUpdateDate);
- updateRes = titanDao.updateVertex(serviceVertex);
+ updateRes = janusGraphDao.updateVertex(serviceVertex);
if (updateRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateRes.right().value()));
}
}
if (result == null) {
@@ -2093,8 +2137,8 @@
return result;
}
- public HealingTitanDao getTitanDao() {
- return titanDao;
+ public HealingJanusGraphDao getJanusGraphDao() {
+ return janusGraphDao;
}
public Either<List<Service>, StorageOperationStatus> getCertifiedServicesWithDistStatus(Set<DistributionStatusEnum> distStatus) {
@@ -2136,11 +2180,12 @@
}
private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) {
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getRes.isRight()) {
- if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (getRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
}
} else {
for (GraphVertex vertex : getRes.left().value()) {
@@ -2158,7 +2203,7 @@
}
public void rollback() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
public StorageOperationStatus addDeploymentArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> finalDeploymentArtifacts) {
@@ -2505,10 +2550,11 @@
public Either<Component, StorageOperationStatus> shouldUpgradeToLatestDerived(Resource clonedResource) {
String componentId = clonedResource.getUniqueId();
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex nodeTypeV = getVertexEither.left().value();
@@ -2518,7 +2564,7 @@
Either<ToscaElement, StorageOperationStatus> shouldUpdateDerivedVersion = nodeTypeOperation.shouldUpdateDerivedVersion(toscaElementToUpdate, nodeTypeV);
if (shouldUpdateDerivedVersion.isRight() && StorageOperationStatus.OK != shouldUpdateDerivedVersion.right().value()) {
log.debug("Failed to update derived version for node type {} derived {}, error: {}", componentId, clonedResource.getDerivedFrom().get(0), shouldUpdateDerivedVersion.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
if (shouldUpdateDerivedVersion.isLeft()) {
return Either.left(ModelConverter.convertFromToscaElement(shouldUpdateDerivedVersion.left().value()));
@@ -2559,11 +2605,11 @@
public Either<PolicyDefinition, StorageOperationStatus> associatePolicyToComponent(String componentId, PolicyDefinition policyDefinition, int counter) {
Either<PolicyDefinition, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither;
- getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither;
+ getVertexEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
} else {
if (getVertexEither.left().value().getLabel() != VertexTypeEnum.TOPOLOGY_TEMPLATE) {
log.error("Policy association to component of Tosca type {} is not allowed. ", getVertexEither.left().value().getLabel());
@@ -2584,18 +2630,18 @@
public StorageOperationStatus associatePoliciesToComponent(String componentId, List<PolicyDefinition> policies) {
log.debug("#associatePoliciesToComponent - associating policies for component {}.", componentId);
- return titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
+ return janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
.either(containerVertex -> topologyTemplateOperation.addPoliciesToToscaElement(containerVertex, policies),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
public Either<PolicyDefinition, StorageOperationStatus> updatePolicyOfComponent(String componentId, PolicyDefinition policyDefinition) {
Either<PolicyDefinition, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither;
- getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither;
+ getVertexEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
if (result == null) {
StorageOperationStatus status = topologyTemplateOperation.updatePolicyOfToscaElement(getVertexEither.left().value(), policyDefinition);
@@ -2611,19 +2657,20 @@
public StorageOperationStatus updatePoliciesOfComponent(String componentId, List<PolicyDefinition> policyDefinition) {
log.debug("#updatePoliciesOfComponent - updating policies for component {}", componentId);
- return titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.either(containerVertex -> topologyTemplateOperation.updatePoliciesOfToscaElement(containerVertex, policyDefinition),
err -> err);
}
public StorageOperationStatus removePolicyFromComponent(String componentId, String policyId) {
StorageOperationStatus status = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- status = DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ status = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
if (status == null) {
status = topologyTemplateOperation.removePolicyFromToscaElement(getVertexEither.left().value(), policyId);
@@ -2632,15 +2679,15 @@
}
public boolean canAddGroups(String componentId) {
- GraphVertex vertex = titanDao.getVertexById(componentId)
+ GraphVertex vertex = janusGraphDao.getVertexById(componentId)
.left()
- .on(this::onTitanError);
+ .on(this::onJanusGraphError);
return topologyTemplateOperation.hasEdgeOfType(vertex, EdgeLabelEnum.GROUPS);
}
- GraphVertex onTitanError(TitanOperationStatus toe) {
+ GraphVertex onJanusGraphError(JanusGraphOperationStatus toe) {
throw new StorageException(
- DaoStatusConverter.convertTitanStatusToStorageStatus(toe));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toe));
}
public void updateNamesOfCalculatedCapabilitiesRequirements(String componentId){
@@ -2672,7 +2719,7 @@
public Either<Boolean, StorageOperationStatus> isComponentInUse(String componentId) {
final List<EdgeLabelEnum> forbiddenEdgeLabelEnums = Arrays.asList(EdgeLabelEnum.INSTANCE_OF, EdgeLabelEnum.PROXY_OF, EdgeLabelEnum.ALLOTTED_OF);
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if (vertexById.isLeft()) {
for (EdgeLabelEnum edgeLabelEnum : forbiddenEdgeLabelEnums) {
Iterator<Edge> edgeItr = vertexById.left().value().getVertex().edges(Direction.IN, edgeLabelEnum.name());
@@ -2693,11 +2740,12 @@
}
propertiesToMatch.put(GraphPropertyEnum.INVARIANT_UUID, componentInvariantUuid);
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
if (vertexEither.isRight()) {
log.debug("Couldn't fetch metadata for component with type {} and invariantUUId {}, error: {}", componentInvariantUuid, vertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
@@ -2722,10 +2770,11 @@
public Either<List<Component>, StorageOperationStatus> getParentComponents(String componentId) {
List<Component> parentComponents = new ArrayList<>();
final List<EdgeLabelEnum> relationEdgeLabelEnums = Arrays.asList(EdgeLabelEnum.INSTANCE_OF, EdgeLabelEnum.PROXY_OF);
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if (vertexById.isLeft()) {
for (EdgeLabelEnum edgeLabelEnum : relationEdgeLabelEnums) {
- Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(vertexById.left().value(), edgeLabelEnum, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertexEither = janusGraphDao
+ .getParentVertex(vertexById.left().value(), edgeLabelEnum, JsonParseFlagEnum.ParseJson);
if(parentVertexEither.isLeft()){
Either<Component, StorageOperationStatus> componentEither = getToscaElement(parentVertexEither.left().value().getUniqueId());
if(componentEither.isLeft()){
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperation.java
similarity index 78%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperation.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperation.java
index 5faa6bb..3596fff 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperation.java
@@ -1,20 +1,20 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
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.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.ComponentDependency;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -29,10 +29,10 @@
private static final Logger log = Logger.getLogger(UpgradeOperation.class.getName());
public Either<List<ComponentDependency>, StorageOperationStatus> getComponentDependencies(String componentId) {
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if (vertexById.isRight()) {
log.debug("Failed to fetch vertex with id {} error {}", componentId, vertexById.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexById.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexById.right().value()));
}
List<ComponentDependency> dependencies = new ArrayList<>();
@@ -44,24 +44,26 @@
}
GraphVertex vertexToStart = vertex;
- Function<GraphVertex, Either<GraphVertex, TitanOperationStatus>> getNextElement = vertexP -> titanDao.getParentVertex(vertexP, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
+ Function<GraphVertex, Either<GraphVertex, JanusGraphOperationStatus>> getNextElement = vertexP -> janusGraphDao
+ .getParentVertex(vertexP, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
status = handleVersionChain(componentId, dependencies, vertex, getNextElement);
if (status != StorageOperationStatus.OK) {
return Either.right(status);
}
vertex = vertexToStart;
- getNextElement = vertexP -> titanDao.getChildVertex(vertexP, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
+ getNextElement = vertexP -> janusGraphDao
+ .getChildVertex(vertexP, EdgeLabelEnum.VERSION, JsonParseFlagEnum.ParseAll);
status = handleVersionChain(componentId, dependencies, vertex, getNextElement);
return status == StorageOperationStatus.OK ? Either.left(dependencies) : Either.right(status);
}
- private StorageOperationStatus handleVersionChain(String componentId, List<ComponentDependency> dependencies, GraphVertex vertexToStart, Function<GraphVertex, Either<GraphVertex, TitanOperationStatus>> getNextElement) {
+ private StorageOperationStatus handleVersionChain(String componentId, List<ComponentDependency> dependencies, GraphVertex vertexToStart, Function<GraphVertex, Either<GraphVertex, JanusGraphOperationStatus>> getNextElement) {
StorageOperationStatus status;
boolean nextInChain = true;
GraphVertex vertex = vertexToStart;
- Either<GraphVertex, TitanOperationStatus> nextInChainV;
+ Either<GraphVertex, JanusGraphOperationStatus> nextInChainV;
while (nextInChain) {
nextInChainV = getNextElement.apply(vertex);
if (nextInChainV.isRight()) {
@@ -103,10 +105,11 @@
}
private StorageOperationStatus fillDependenciesByLabel(String componentId, GraphVertex vertex, ComponentDependency dependency, EdgeLabelEnum label) {
- Either<List<GraphVertex>, TitanOperationStatus> parentVertecies = titanDao.getParentVertecies(vertex, label, JsonParseFlagEnum.ParseAll);
- if (parentVertecies.isRight() && parentVertecies.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> parentVertecies = janusGraphDao
+ .getParentVertecies(vertex, label, JsonParseFlagEnum.ParseAll);
+ if (parentVertecies.isRight() && parentVertecies.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to fetch parent verticies by label INSTANCE_OF for vertex with id {} error {}", componentId, parentVertecies.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertecies.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentVertecies.right().value());
}
if (parentVertecies.isLeft()) {
List<ComponentDependency> existIn = new ArrayList<>( );
@@ -119,8 +122,8 @@
private void handleHighestVersion(GraphVertex vertexOrigin, EdgeLabelEnum label, List<ComponentDependency> exisIn, GraphVertex containerVertex) {
Boolean isHighest = (Boolean) containerVertex.getMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION);
if ( isHighest && needToAddToDepenedency(containerVertex) ) {
- TitanVertex titanVertex = containerVertex.getVertex();
- Iterator<Edge> edges = titanVertex.edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
+ JanusGraphVertex janusGraphVertex = containerVertex.getVertex();
+ Iterator<Edge> edges = janusGraphVertex.edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
//verify that it is a last version - highest by version number
if ( edges == null || !edges.hasNext() ){
ComponentDependency container = fillDataFromVertex(containerVertex, vertexOrigin.getUniqueId(), label);
@@ -137,14 +140,15 @@
}
private boolean findAllottedChain(GraphVertex vertex, ComponentDependency container) {
- Either<List<GraphVertex>, TitanOperationStatus> parentVertecies = titanDao.getParentVertecies(vertex, EdgeLabelEnum.INSTANCE_OF, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> parentVertecies = janusGraphDao
+ .getParentVertecies(vertex, EdgeLabelEnum.INSTANCE_OF, JsonParseFlagEnum.ParseAll);
if (parentVertecies.isLeft()) {
List<ComponentDependency> existIn = new ArrayList<>();
parentVertecies.left().value().forEach(v -> {
Boolean isHighest = (Boolean) v.getMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION);
if ( isHighest && needToAddToDepenedency(v) ) {
- TitanVertex titanVertex = v.getVertex();
- Iterator<Edge> edges = titanVertex.edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
+ JanusGraphVertex janusGraphVertex = v.getVertex();
+ Iterator<Edge> edges = janusGraphVertex.edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
//verify that it is a last version - highest by version number
if ( edges == null || !edges.hasNext() ){
ComponentDependency parentContainer = fillDataFromVertex(v, vertex.getUniqueId(), EdgeLabelEnum.INSTANCE_OF);
@@ -178,14 +182,15 @@
private void findInstanceNames(GraphVertex v, String originId, EdgeLabelEnum edgeLabel, ComponentDependency container) {
Map<String, CompositionDataDefinition> jsonComposition = (Map<String, CompositionDataDefinition>) v.getJson();
CompositionDataDefinition compositionDataDefinition = jsonComposition.get(JsonConstantKeysEnum.COMPOSITION.getValue());
- TitanVertex vertex = v.getVertex();
+ JanusGraphVertex vertex = v.getVertex();
Iterator<Edge> edges = vertex.edges(Direction.OUT, edgeLabel.name());
while (edges != null && edges.hasNext()) {
Edge edge = edges.next();
- TitanVertex inVertex = (TitanVertex) edge.inVertex();
- String id = (String) titanDao.getProperty(inVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ JanusGraphVertex inVertex = (JanusGraphVertex) edge.inVertex();
+ String id = (String) janusGraphDao.getProperty(inVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
if (id.equals(originId)) {
- List<String> instanceOnEdge = (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
+ List<String> instanceOnEdge = (List<String>) janusGraphDao
+ .getProperty(edge, EdgePropertyEnum.INSTANCES);
Map<String, ComponentInstanceDataDefinition> componentInstances = compositionDataDefinition.getComponentInstances();
if (componentInstances != null) {
@@ -205,17 +210,18 @@
}
public List<String> getInstanceIdFromAllottedEdge(String resourceId, String serviceInvariantUUID) {
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(resourceId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(resourceId);
if ( vertexById.isLeft() ){
GraphVertex vertexG = vertexById.left().value();
- TitanVertex vertex = vertexG.getVertex();
+ JanusGraphVertex vertex = vertexG.getVertex();
Iterator<Edge> edges = vertex.edges(Direction.OUT, EdgeLabelEnum.ALLOTTED_OF.name());
while ( edges != null && edges.hasNext() ){
Edge edge = edges.next();
- TitanVertex inVertex = (TitanVertex)edge.inVertex();
- String vertexInInvUUID = (String) titanDao.getProperty(inVertex, GraphPropertyEnum.INVARIANT_UUID.getProperty());
+ JanusGraphVertex inVertex = (JanusGraphVertex)edge.inVertex();
+ String vertexInInvUUID = (String) janusGraphDao
+ .getProperty(inVertex, GraphPropertyEnum.INVARIANT_UUID.getProperty());
if ( vertexInInvUUID.equals(serviceInvariantUUID) ){
- return (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES) ;
+ return (List<String>) janusGraphDao.getProperty(edge, EdgePropertyEnum.INSTANCES) ;
}
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityRequirementNameResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityRequirementNameResolver.java
similarity index 98%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityRequirementNameResolver.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityRequirementNameResolver.java
index 6bdce99..c4b7882 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityRequirementNameResolver.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityRequirementNameResolver.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@@ -6,9 +6,9 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.utils.ComponentUtilities;
import org.openecomp.sdc.common.log.wrappers.Logger;
import java.util.*;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapper.java
similarity index 91%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapper.java
index 2c3c98e..cc28ae4 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapper.java
@@ -1,10 +1,10 @@
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
similarity index 99%
rename from catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
rename to catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 9412c5c..cd34ad5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -18,12 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@@ -36,11 +35,11 @@
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
import org.openecomp.sdc.be.resources.data.ProductMetadataData;
import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/StorageException.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/StorageException.java
index 40c39f3..e75533f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/StorageException.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/StorageException.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.be.model.operations;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@@ -15,14 +15,16 @@
this.params = params;
}
- public StorageException(String message, Throwable cause, TitanOperationStatus titanOperationStatus, String... params){
+ public StorageException(String message, Throwable cause, JanusGraphOperationStatus janusGraphOperationStatus, String... params){
super(message, cause);
- storageOperationStatus = DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus);
+ storageOperationStatus = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus);
this.params = params;
}
- public StorageException(TitanOperationStatus titanOperationStatus, String... params) {
- storageOperationStatus = DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus);
+ public StorageException(JanusGraphOperationStatus janusGraphOperationStatus, String... params) {
+ storageOperationStatus = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus);
this.params = params;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IAdditionalInformationOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IAdditionalInformationOperation.java
index 3fb58a0..b1ce9de 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IAdditionalInformationOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IAdditionalInformationOperation.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.be.model.operations.api;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
@@ -32,19 +32,19 @@
public interface IAdditionalInformationOperation {
- public Either<AdditionalInformationDefinition, TitanOperationStatus> addAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String key, String value);
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> addAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String key, String value);
- public Either<AdditionalInformationDefinition, TitanOperationStatus> updateAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String origKey, String key, String value);
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> updateAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String origKey, String key, String value);
- public Either<AdditionalInformationDefinition, TitanOperationStatus> deleteAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String key);
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> deleteAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String key);
- public Either<AdditionalInfoParameterData, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String resourceUniqueId);
+ public Either<AdditionalInfoParameterData, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String resourceUniqueId);
- public Either<AdditionalInformationDefinition, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters);
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters);
- public TitanOperationStatus findResourceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties);
+ public JanusGraphOperationStatus findResourceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties);
- public TitanOperationStatus findServiceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties);
+ public JanusGraphOperationStatus findServiceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties);
public Either<AdditionalInformationDefinition, StorageOperationStatus> createAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String key, String value, boolean inTransaction);
@@ -54,20 +54,20 @@
public Either<Integer, StorageOperationStatus> getNumberOfAdditionalInformationParameters(NodeTypeEnum nodeType, String resourceId, boolean inTransaction);
- public Either<Integer, TitanOperationStatus> getNumberOfParameters(NodeTypeEnum nodeType, String resourceId);
+ public Either<Integer, JanusGraphOperationStatus> getNumberOfParameters(NodeTypeEnum nodeType, String resourceId);
- public Either<AdditionalInfoParameterInfo, TitanOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String id);
+ public Either<AdditionalInfoParameterInfo, JanusGraphOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String id);
public Either<AdditionalInfoParameterInfo, StorageOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String id, boolean inTransaction);
- public Either<AdditionalInformationDefinition, TitanOperationStatus> getAllAdditionalInformationParameters(NodeTypeEnum nodeType, String resourceId, boolean ignoreVerification);
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> getAllAdditionalInformationParameters(NodeTypeEnum nodeType, String resourceId, boolean ignoreVerification);
public Either<AdditionalInformationDefinition, StorageOperationStatus> getAllAdditionalInformationParameters(NodeTypeEnum nodeType, String resourceId, boolean ignoreVerification, boolean inTransaction);
public Either<AdditionalInformationDefinition, StorageOperationStatus> deleteAllAdditionalInformationParameters(NodeTypeEnum nodeType, String resourceId, boolean inTransaction);
- public Either<TitanVertex, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, TitanVertex matadatVertex);
+ public Either<JanusGraphVertex, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, JanusGraphVertex matadatVertex);
- public TitanOperationStatus addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters, TitanVertex metadataVertex);
+ public JanusGraphOperationStatus addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters, JanusGraphVertex metadataVertex);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IArtifactOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IArtifactOperation.java
index e1b04e9..e3b7689 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IArtifactOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IArtifactOperation.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.model.operations.api;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
@@ -37,6 +37,6 @@
public Either<Map<String, ArtifactDefinition>, StorageOperationStatus> getArtifacts(String parentId, NodeTypeEnum parentType, boolean inTransaction);
- public StorageOperationStatus addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, TitanVertex parentVertex);
+ public StorageOperationStatus addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, JanusGraphVertex parentVertex);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityOperation.java
index da059fe..3525e13 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityOperation.java
@@ -21,13 +21,13 @@
package org.openecomp.sdc.be.model.operations.api;
import fj.data.Either;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.PropertyDefinition;
import java.util.Map;
public interface ICapabilityOperation {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> getAllCapabilityTypePropertiesFromAllDerivedFrom(String firstParentType);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllCapabilityTypePropertiesFromAllDerivedFrom(String firstParentType);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
index 4316f73..780b9af 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
@@ -21,7 +21,7 @@
package org.openecomp.sdc.be.model.operations.api;
import fj.data.Either;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
import java.util.Map;
@@ -46,5 +46,5 @@
public Either<CapabilityTypeDefinition, StorageOperationStatus> getCapabilityType(String uniqueId);
public Either<CapabilityTypeDefinition, StorageOperationStatus> getCapabilityType(String uniqueId, boolean inTransaction);
- Either<Map<String, CapabilityTypeDefinition>, TitanOperationStatus> getAllCapabilityTypes();
+ Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes();
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java
index 0c03ee3..100916f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java
@@ -21,13 +21,13 @@
package org.openecomp.sdc.be.model.operations.api;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.resources.data.InputValueData;
public interface IInputsOperation {
- ImmutablePair<TitanOperationStatus, String> findInputValue(String resourceInstanceId, String propertyId);
+ ImmutablePair<JanusGraphOperationStatus, String> findInputValue(String resourceInstanceId, String propertyId);
ComponentInstanceInput buildResourceInstanceInput(InputValueData propertyValueData, ComponentInstanceInput resourceInstanceInput);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java
index 3e987ed..c53f3e3 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java
@@ -24,7 +24,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.lang.reflect.Type;
import java.util.List;
@@ -37,9 +37,9 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -63,7 +63,7 @@
private static final Logger log = Logger.getLogger(AbstractOperation.class.getName());
@Autowired
- protected HealingTitanGenericDao titanGenericDao;
+ protected HealingJanusGraphGenericDao janusGraphGenericDao;
public static final String EMPTY_VALUE = null;
@@ -74,8 +74,8 @@
protected DataTypeValidatorConverter dataTypeValidatorConverter = DataTypeValidatorConverter.getInstance();
- protected <SomeData extends GraphNode, SomeDefenition> Either<SomeData, TitanOperationStatus> addDefinitionToNodeType(SomeDefenition someDefinition, NodeTypeEnum nodeType, String nodeUniqueId, final GraphEdgeLabels edgeType,
- Supplier<SomeData> dataBuilder, Supplier<String> defNameGenerator) {
+ protected <SomeData extends GraphNode, SomeDefenition> Either<SomeData, JanusGraphOperationStatus> addDefinitionToNodeType(SomeDefenition someDefinition, NodeTypeEnum nodeType, String nodeUniqueId, final GraphEdgeLabels edgeType,
+ Supplier<SomeData> dataBuilder, Supplier<String> defNameGenerator) {
String defName = defNameGenerator.get();
log.debug("Got {} {}", defName, someDefinition);
@@ -84,29 +84,31 @@
log.debug("Before adding {} to graph. data = {}", defName, someData);
@SuppressWarnings("unchecked")
- Either<SomeData, TitanOperationStatus> eitherSomeData = titanGenericDao.createNode(someData, (Class<SomeData>) someData.getClass());
+ Either<SomeData, JanusGraphOperationStatus> eitherSomeData = janusGraphGenericDao
+ .createNode(someData, (Class<SomeData>) someData.getClass());
log.debug("After adding {} to graph. status is = {}", defName, eitherSomeData);
if (eitherSomeData.isRight()) {
- TitanOperationStatus operationStatus = eitherSomeData.right().value();
+ JanusGraphOperationStatus operationStatus = eitherSomeData.right().value();
log.error("Failed to add {} to graph. status is {}", defName, operationStatus);
return Either.right(operationStatus);
}
UniqueIdData uniqueIdData = new UniqueIdData(nodeType, nodeUniqueId);
log.debug("Before associating {} to {}.", uniqueIdData, defName);
- Either<GraphRelation, TitanOperationStatus> eitherRelations = titanGenericDao.createRelation(uniqueIdData, eitherSomeData.left().value(), edgeType, null);
+ Either<GraphRelation, JanusGraphOperationStatus> eitherRelations = janusGraphGenericDao
+ .createRelation(uniqueIdData, eitherSomeData.left().value(), edgeType, null);
if (eitherRelations.isRight()) {
- TitanOperationStatus operationStatus = eitherRelations.right().value();
+ JanusGraphOperationStatus operationStatus = eitherRelations.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("AddDefinitionToNodeType", "Failed to associate" + nodeType.getName() + " " + nodeUniqueId + "to " + defName + "in graph. status is " + operationStatus, ErrorSeverity.ERROR);
return Either.right(operationStatus);
}
return Either.left(eitherSomeData.left().value());
}
- protected <SomeData extends GraphNode, SomeDefenition> TitanOperationStatus addDefinitionToNodeType(TitanVertex vertex, SomeDefenition someDefinition, NodeTypeEnum nodeType, String nodeUniqueId, final GraphEdgeLabels edgeType,
- Supplier<SomeData> dataBuilder, Supplier<String> defNameGenerator) {
+ protected <SomeData extends GraphNode, SomeDefenition> JanusGraphOperationStatus addDefinitionToNodeType(JanusGraphVertex vertex, SomeDefenition someDefinition, NodeTypeEnum nodeType, String nodeUniqueId, final GraphEdgeLabels edgeType,
+ Supplier<SomeData> dataBuilder, Supplier<String> defNameGenerator) {
String defName = defNameGenerator.get();
log.debug("Got {} {}", defName, someDefinition);
@@ -115,18 +117,20 @@
log.debug("Before adding {} to graph. data = {}", defName, someData);
@SuppressWarnings("unchecked")
- Either<TitanVertex, TitanOperationStatus> eitherSomeData = titanGenericDao.createNode(someData);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> eitherSomeData = janusGraphGenericDao.createNode(someData);
log.debug("After adding {} to graph. status is = {}", defName, eitherSomeData);
if (eitherSomeData.isRight()) {
- TitanOperationStatus operationStatus = eitherSomeData.right().value();
+ JanusGraphOperationStatus operationStatus = eitherSomeData.right().value();
log.error("Failed to add {} to graph. status is {}", defName, operationStatus);
return operationStatus;
}
- TitanOperationStatus relations = titanGenericDao.createEdge(vertex, eitherSomeData.left().value(), edgeType, null);
- if (!relations.equals(TitanOperationStatus.OK)) {
+ JanusGraphOperationStatus
+ relations = janusGraphGenericDao
+ .createEdge(vertex, eitherSomeData.left().value(), edgeType, null);
+ if (!relations.equals(JanusGraphOperationStatus.OK)) {
BeEcompErrorManager.getInstance().logInternalFlowError("AddDefinitionToNodeType", "Failed to associate" + nodeType.getName() + " " + nodeUniqueId + "to " + defName + "in graph. status is " + relations, ErrorSeverity.ERROR);
return relations;
}
@@ -134,25 +138,27 @@
}
interface NodeElementFetcher<ElementDefinition> {
- TitanOperationStatus findAllNodeElements(String nodeId, List<ElementDefinition> listTofill);
+ JanusGraphOperationStatus findAllNodeElements(String nodeId, List<ElementDefinition> listTofill);
}
- public <ElementDefinition> TitanOperationStatus findAllResourceElementsDefinitionRecursively(String resourceId, List<ElementDefinition> elements, NodeElementFetcher<ElementDefinition> singleNodeFetcher) {
+ public <ElementDefinition> JanusGraphOperationStatus findAllResourceElementsDefinitionRecursively(String resourceId, List<ElementDefinition> elements, NodeElementFetcher<ElementDefinition> singleNodeFetcher) {
if (log.isTraceEnabled())
log.trace("Going to fetch elements under resource {}", resourceId);
- TitanOperationStatus resourceAttributesStatus = singleNodeFetcher.findAllNodeElements(resourceId, elements);
+ JanusGraphOperationStatus
+ resourceAttributesStatus = singleNodeFetcher.findAllNodeElements(resourceId, elements);
- if (resourceAttributesStatus != TitanOperationStatus.OK) {
+ if (resourceAttributesStatus != JanusGraphOperationStatus.OK) {
return resourceAttributesStatus;
}
- Either<ImmutablePair<ResourceMetadataData, GraphEdge>, TitanOperationStatus> parentNodes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
+ Either<ImmutablePair<ResourceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
ResourceMetadataData.class);
if (parentNodes.isRight()) {
- TitanOperationStatus parentNodesStatus = parentNodes.right().value();
- if (parentNodesStatus != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus parentNodesStatus = parentNodes.right().value();
+ if (parentNodesStatus != JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logInternalFlowError("findAllResourceElementsDefinitionRecursively", "Failed to find parent elements of resource " + resourceId + ". status is " + parentNodesStatus, ErrorSeverity.ERROR);
return parentNodesStatus;
}
@@ -161,25 +167,25 @@
if (parentNodes.isLeft()) {
ImmutablePair<ResourceMetadataData, GraphEdge> parnetNodePair = parentNodes.left().value();
String parentUniqueId = parnetNodePair.getKey().getMetadataDataDefinition().getUniqueId();
- TitanOperationStatus addParentIntStatus = findAllResourceElementsDefinitionRecursively(parentUniqueId, elements, singleNodeFetcher);
+ JanusGraphOperationStatus addParentIntStatus = findAllResourceElementsDefinitionRecursively(parentUniqueId, elements, singleNodeFetcher);
- if (addParentIntStatus != TitanOperationStatus.OK) {
+ if (addParentIntStatus != JanusGraphOperationStatus.OK) {
BeEcompErrorManager.getInstance().logInternalFlowError("findAllResourceElementsDefinitionRecursively", "Failed to find all resource elements of resource " + parentUniqueId, ErrorSeverity.ERROR);
return addParentIntStatus;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
protected <T, TStatus> void handleTransactionCommitRollback(boolean inTransaction, Either<T, TStatus> result) {
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -212,7 +218,7 @@
}
String innerType = null;
- Either<String, TitanOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
+ Either<String, JanusGraphOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
if (checkInnerType.isRight()) {
return StorageOperationStatus.INVALID_TYPE;
}
@@ -300,19 +306,19 @@
return value;
}
- protected Either<String, TitanOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) {
+ protected Either<String, JanusGraphOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) {
String innerType = null;
if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) {
SchemaDefinition def = schemeGen.get();
if (def == null) {
log.debug("Schema doesn't exists for property of type {}", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
PropertyDataDefinition propDef = def.getProperty();
if (propDef == null) {
log.debug("Property in Schema Definition inside property of type {} doesn't exist", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
innerType = propDef.getType();
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
index ebec8b1..f247bbb 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -29,10 +29,10 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -58,7 +58,7 @@
private static final Logger log = Logger.getLogger(AdditionalInformationOperation.class.getName());
@javax.annotation.Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
private static final String GOING_TO_EXECUTE_COMMIT_ON_GRAPH = "Going to execute commit on graph.";
private static final String GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH = "Going to execute rollback on graph.";
@@ -71,18 +71,20 @@
@Override
- public Either<AdditionalInformationDefinition, TitanOperationStatus> addAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String key, String value) {
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> addAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String key, String value) {
- TitanOperationStatus verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
- if (verifyNodeTypeVsComponent != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
+ if (verifyNodeTypeVsComponent != JanusGraphOperationStatus.OK) {
return Either.right(verifyNodeTypeVsComponent);
}
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
return Either.right(status);
}
@@ -104,17 +106,18 @@
if (parameters.containsKey(key)) {
log.debug("The key {} already exists under component {}", key, componentId);
- return Either.right(TitanOperationStatus.ALREADY_EXIST);
+ return Either.right(JanusGraphOperationStatus.ALREADY_EXIST);
}
idToKey.put(String.valueOf(lastCreatedCounter), key);
parameters.put(key, value);
parameterData.getAdditionalInfoParameterDataDefinition().setLastCreatedCounter(lastCreatedCounter);
- Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(parameterData, AdditionalInfoParameterData.class);
if (updateNode.isRight()) {
- TitanOperationStatus status = updateNode.right().value();
+ JanusGraphOperationStatus status = updateNode.right().value();
BeEcompErrorManager.getInstance().logBeFailedUpdateNodeError("UpdateAdditionalInformationParameter", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + componentId, String.valueOf(status));
return Either.right(status);
}
@@ -126,18 +129,20 @@
}
@Override
- public Either<AdditionalInformationDefinition, TitanOperationStatus> updateAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id, String key, String value) {
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> updateAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id, String key, String value) {
- TitanOperationStatus verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
- if (verifyNodeTypeVsComponent != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
+ if (verifyNodeTypeVsComponent != JanusGraphOperationStatus.OK) {
return Either.right(verifyNodeTypeVsComponent);
}
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
return Either.right(status);
}
@@ -146,7 +151,7 @@
Map<String, String> parameters = parameterData.getParameters();
Map<String, String> idToKey = parameterData.getIdToKey();
if (idToKey == null || !idToKey.containsKey(id)) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
String origKey = idToKey.get(id);
@@ -154,7 +159,7 @@
if (!origKey.equals(key)) {
if (parameters.containsKey(key)) {
log.debug("The key {} already exists", key);
- return Either.right(TitanOperationStatus.ALREADY_EXIST);
+ return Either.right(JanusGraphOperationStatus.ALREADY_EXIST);
}
String removed = parameters.remove(origKey);
log.trace("The key-value {} = {} was removed from additionalInformation", origKey, removed);
@@ -162,10 +167,11 @@
parameters.put(key, value);
idToKey.put(id, key);
- Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(parameterData, AdditionalInfoParameterData.class);
if (updateNode.isRight()) {
- TitanOperationStatus status = updateNode.right().value();
+ JanusGraphOperationStatus status = updateNode.right().value();
BeEcompErrorManager.getInstance().logBeFailedUpdateNodeError("UpdateAdditionalInformationParameter", "additional information of resource " + componentId, String.valueOf(status));
return Either.right(status);
}
@@ -177,18 +183,20 @@
}
@Override
- public Either<AdditionalInformationDefinition, TitanOperationStatus> deleteAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id) {
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> deleteAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id) {
- TitanOperationStatus verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
- if (verifyNodeTypeVsComponent != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
+ if (verifyNodeTypeVsComponent != JanusGraphOperationStatus.OK) {
return Either.right(verifyNodeTypeVsComponent);
}
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
return Either.right(status);
}
@@ -198,7 +206,7 @@
Map<String, String> idToKey = parameterData.getIdToKey();
if (idToKey == null || !idToKey.containsKey(id)) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
String key = idToKey.get(id);
@@ -206,10 +214,11 @@
String removedValue = parameters.remove(key);
log.trace("The key-value {} = {} was removed from additionalInformation", removedKey, removedValue);
- Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(parameterData, AdditionalInfoParameterData.class);
if (updateNode.isRight()) {
- TitanOperationStatus status = updateNode.right().value();
+ JanusGraphOperationStatus status = updateNode.right().value();
BeEcompErrorManager.getInstance().logBeFailedUpdateNodeError("DeleteAdditionalInformationParameter", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + componentId, String.valueOf(status));
return Either.right(status);
}
@@ -248,7 +257,7 @@
}
@Override
- public Either<AdditionalInfoParameterData, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId) {
+ public Either<AdditionalInfoParameterData, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId) {
UniqueIdData from = new UniqueIdData(nodeType, componentId);
@@ -258,18 +267,20 @@
AdditionalInfoParameterData additionalInfoParameterData = new AdditionalInfoParameterData(additionalInfoParameterDataDefinition, new HashMap<>(), new HashMap<>());
- Either<AdditionalInfoParameterData, TitanOperationStatus> createNode = titanGenericDao.createNode(additionalInfoParameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> createNode = janusGraphGenericDao
+ .createNode(additionalInfoParameterData, AdditionalInfoParameterData.class);
if (createNode.isRight()) {
- TitanOperationStatus status = createNode.right().value();
+ JanusGraphOperationStatus status = createNode.right().value();
BeEcompErrorManager.getInstance().logBeFailedCreateNodeError("AddAdditionalInformationNode", uniqueId, String.valueOf(status));
return Either.right(status);
}
AdditionalInfoParameterData to = createNode.left().value();
- Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(from, to, GraphEdgeLabels.ADDITIONAL_INFORMATION, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphGenericDao
+ .createRelation(from, to, GraphEdgeLabels.ADDITIONAL_INFORMATION, null);
if (createRelation.isRight()) {
- TitanOperationStatus status = createRelation.right().value();
+ JanusGraphOperationStatus status = createRelation.right().value();
return Either.right(status);
}
@@ -277,7 +288,7 @@
}
@Override
- public Either<TitanVertex, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, TitanVertex metadataVertex) {
+ public Either<JanusGraphVertex, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, JanusGraphVertex metadataVertex) {
String uniqueId = UniqueIdBuilder.buildAdditionalInformationUniqueId(componentId);
AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition = new AdditionalInfoParameterDataDefinition();
@@ -285,26 +296,27 @@
AdditionalInfoParameterData additionalInfoParameterData = new AdditionalInfoParameterData(additionalInfoParameterDataDefinition, new HashMap<>(), new HashMap<>());
- Either<TitanVertex, TitanOperationStatus> createNode = titanGenericDao.createNode(additionalInfoParameterData);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> createNode = janusGraphGenericDao.createNode(additionalInfoParameterData);
if (createNode.isRight()) {
- TitanOperationStatus status = createNode.right().value();
+ JanusGraphOperationStatus status = createNode.right().value();
BeEcompErrorManager.getInstance().logBeFailedCreateNodeError("AddAdditionalInformationNode", uniqueId, String.valueOf(status));
return Either.right(status);
}
- TitanVertex additionalInfoVertex = createNode.left().value();
+ JanusGraphVertex additionalInfoVertex = createNode.left().value();
- TitanOperationStatus createRelation = titanGenericDao.createEdge(metadataVertex, additionalInfoVertex, GraphEdgeLabels.ADDITIONAL_INFORMATION, null);
+ JanusGraphOperationStatus createRelation = janusGraphGenericDao
+ .createEdge(metadataVertex, additionalInfoVertex, GraphEdgeLabels.ADDITIONAL_INFORMATION, null);
- if (!createRelation.equals(TitanOperationStatus.OK)) {
+ if (!createRelation.equals(JanusGraphOperationStatus.OK)) {
return Either.right(createRelation);
}
return Either.left(additionalInfoVertex);
}
- public Either<AdditionalInformationDefinition, TitanOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters) {
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters) {
- Either<AdditionalInfoParameterData, TitanOperationStatus> status = this.addAdditionalInformationNode(nodeType, componentId);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> status = this.addAdditionalInformationNode(nodeType, componentId);
if (status.isRight()) {
return Either.right(status.right().value());
@@ -314,7 +326,8 @@
populateParameterNodeWithParameters(parameterData, parameters);
- Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(parameterData, AdditionalInfoParameterData.class);
if (updateNode.isRight()) {
return Either.right(updateNode.right().value());
@@ -325,21 +338,21 @@
return Either.left(informationDefinition);
}
- public TitanOperationStatus addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters, TitanVertex metadataVertex) {
+ public JanusGraphOperationStatus addAdditionalInformationNode(NodeTypeEnum nodeType, String componentId, AdditionalInformationDefinition parameters, JanusGraphVertex metadataVertex) {
- Either<TitanVertex, TitanOperationStatus> status = this.addAdditionalInformationNode(nodeType, componentId, metadataVertex);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> status = this.addAdditionalInformationNode(nodeType, componentId, metadataVertex);
if (status.isRight()) {
return status.right().value();
}
- TitanVertex additionalInfoVertex = status.left().value();
+ JanusGraphVertex additionalInfoVertex = status.left().value();
- Map<String, Object> newProp = titanGenericDao.getProperties(additionalInfoVertex);
+ Map<String, Object> newProp = janusGraphGenericDao.getProperties(additionalInfoVertex);
AdditionalInfoParameterData parameterData = GraphElementFactory.createElement(NodeTypeEnum.AdditionalInfoParameters.getName(), GraphElementTypeEnum.Node, newProp, AdditionalInfoParameterData.class);
populateParameterNodeWithParameters(parameterData, parameters);
- return titanGenericDao.updateVertex(parameterData, additionalInfoVertex);
+ return janusGraphGenericDao.updateVertex(parameterData, additionalInfoVertex);
}
private void populateParameterNodeWithParameters(AdditionalInfoParameterData parameterData, AdditionalInformationDefinition aiDefinition) {
@@ -373,21 +386,22 @@
}
@Override
- public TitanOperationStatus findResourceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties) {
+ public JanusGraphOperationStatus findResourceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties) {
log.trace("Going to fetch additional information under resource {}", uniqueId);
- TitanOperationStatus resourceCapabilitiesStatus = findAdditionalInformationOfNode(NodeTypeEnum.Resource, uniqueId, properties);
+ JanusGraphOperationStatus resourceCapabilitiesStatus = findAdditionalInformationOfNode(NodeTypeEnum.Resource, uniqueId, properties);
- if (!resourceCapabilitiesStatus.equals(TitanOperationStatus.OK)) {
+ if (!resourceCapabilitiesStatus.equals(JanusGraphOperationStatus.OK)) {
return resourceCapabilitiesStatus;
}
- Either<ImmutablePair<ResourceMetadataData, GraphEdge>, TitanOperationStatus> parentNodes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
+ Either<ImmutablePair<ResourceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
ResourceMetadataData.class);
if (parentNodes.isRight()) {
- TitanOperationStatus parentNodesStatus = parentNodes.right().value();
- if (!parentNodesStatus.equals(TitanOperationStatus.NOT_FOUND)) {
+ JanusGraphOperationStatus parentNodesStatus = parentNodes.right().value();
+ if (!parentNodesStatus.equals(JanusGraphOperationStatus.NOT_FOUND)) {
log.error("Failed to find parent additional information of resource {}. status is {}", uniqueId, parentNodesStatus);
return parentNodesStatus;
}
@@ -396,33 +410,34 @@
if (parentNodes.isLeft()) {
ImmutablePair<ResourceMetadataData, GraphEdge> parnetNodePair = parentNodes.left().value();
String parentUniqueId = parnetNodePair.getKey().getMetadataDataDefinition().getUniqueId();
- TitanOperationStatus addParentIntStatus = findResourceAllAdditionalInformationRecursively(parentUniqueId, properties);
+ JanusGraphOperationStatus addParentIntStatus = findResourceAllAdditionalInformationRecursively(parentUniqueId, properties);
- if (addParentIntStatus != TitanOperationStatus.OK) {
+ if (addParentIntStatus != JanusGraphOperationStatus.OK) {
log.error("Failed to find all resource additional information of resource {}", parentUniqueId);
return addParentIntStatus;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@Override
- public TitanOperationStatus findServiceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties) {
+ public JanusGraphOperationStatus findServiceAllAdditionalInformationRecursively(String uniqueId, List<AdditionalInformationDefinition> properties) {
log.trace("Going to fetch additional information under service {}", uniqueId);
- TitanOperationStatus resourceCapabilitiesStatus = findAdditionalInformationOfNode(NodeTypeEnum.Service, uniqueId, properties);
+ JanusGraphOperationStatus resourceCapabilitiesStatus = findAdditionalInformationOfNode(NodeTypeEnum.Service, uniqueId, properties);
- if (!resourceCapabilitiesStatus.equals(TitanOperationStatus.OK)) {
+ if (!resourceCapabilitiesStatus.equals(JanusGraphOperationStatus.OK)) {
return resourceCapabilitiesStatus;
}
- Either<ImmutablePair<ServiceMetadataData, GraphEdge>, TitanOperationStatus> parentNodes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Service), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Service,
+ Either<ImmutablePair<ServiceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Service), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Service,
ServiceMetadataData.class);
if (parentNodes.isRight()) {
- TitanOperationStatus parentNodesStatus = parentNodes.right().value();
- if (!parentNodesStatus.equals(TitanOperationStatus.NOT_FOUND)) {
+ JanusGraphOperationStatus parentNodesStatus = parentNodes.right().value();
+ if (!parentNodesStatus.equals(JanusGraphOperationStatus.NOT_FOUND)) {
log.error("Failed to find parent additional information of resource {}. status is {}", uniqueId, parentNodesStatus);
return parentNodesStatus;
}
@@ -431,26 +446,27 @@
if (parentNodes.isLeft()) {
ImmutablePair<ServiceMetadataData, GraphEdge> parnetNodePair = parentNodes.left().value();
String parentUniqueId = parnetNodePair.getKey().getMetadataDataDefinition().getUniqueId();
- TitanOperationStatus addParentIntStatus = findServiceAllAdditionalInformationRecursively(parentUniqueId, properties);
+ JanusGraphOperationStatus addParentIntStatus = findServiceAllAdditionalInformationRecursively(parentUniqueId, properties);
- if (addParentIntStatus != TitanOperationStatus.OK) {
+ if (addParentIntStatus != JanusGraphOperationStatus.OK) {
log.error("Failed to find all resource additional information of resource {}", parentUniqueId);
return addParentIntStatus;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus findAdditionalInformationOfNode(NodeTypeEnum nodeType, String uniqueId, List<AdditionalInformationDefinition> properties) {
+ private JanusGraphOperationStatus findAdditionalInformationOfNode(NodeTypeEnum nodeType, String uniqueId, List<AdditionalInformationDefinition> properties) {
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> childNode = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> childNode = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (childNode.isRight()) {
- TitanOperationStatus status = childNode.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childNode.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
return status;
}
@@ -464,7 +480,7 @@
properties.add(additionalInfoDef);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@@ -483,13 +499,13 @@
try {
- Either<AdditionalInformationDefinition, TitanOperationStatus> either = this.addAdditionalInformationParameter(nodeType, resourceId, key, value);
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> either = this.addAdditionalInformationParameter(nodeType, resourceId, key, value);
if (either.isRight()) {
- TitanOperationStatus status = either.right().value();
+ JanusGraphOperationStatus status = either.right().value();
log.debug("Failed to add additional information property {} to component {}. Status is {}", key, resourceId, status);
BeEcompErrorManager.getInstance().logBeFailedUpdateNodeError("CreateAdditionalInformationParameter", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + resourceId, String.valueOf(status));
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
} else {
AdditionalInformationDefinition additionalInformationDefinition = either.left().value();
result = Either.left(additionalInformationDefinition);
@@ -509,11 +525,11 @@
try {
- Either<AdditionalInformationDefinition, TitanOperationStatus> either = this.updateAdditionalInformationParameter(nodeType, resourceId, id, key, value);
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> either = this.updateAdditionalInformationParameter(nodeType, resourceId, id, key, value);
if (either.isRight()) {
log.info("Failed to update additional information property {} to component {}", key, resourceId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value()));
} else {
AdditionalInformationDefinition additionalInformationDefinition = either.left().value();
result = Either.left(additionalInformationDefinition);
@@ -534,11 +550,11 @@
try {
- Either<AdditionalInformationDefinition, TitanOperationStatus> either = this.deleteAdditionalInformationParameter(nodeType, resourceId, id);
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> either = this.deleteAdditionalInformationParameter(nodeType, resourceId, id);
if (either.isRight()) {
log.error("Failed to delete additional information id {} to component {}", id, resourceId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value()));
} else {
AdditionalInformationDefinition additionalInformationDefinition = either.left().value();
result = Either.left(additionalInformationDefinition);
@@ -559,11 +575,11 @@
try {
- Either<Integer, TitanOperationStatus> either = this.getNumberOfParameters(nodeType, resourceId);
+ Either<Integer, JanusGraphOperationStatus> either = this.getNumberOfParameters(nodeType, resourceId);
if (either.isRight()) {
log.error("Failed to get the number of additional information properties in component {}", resourceId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value()));
} else {
Integer counter = either.left().value();
result = Either.left(counter);
@@ -574,10 +590,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -585,13 +601,14 @@
}
@Override
- public Either<Integer, TitanOperationStatus> getNumberOfParameters(NodeTypeEnum nodeType, String resourceId) {
+ public Either<Integer, JanusGraphOperationStatus> getNumberOfParameters(NodeTypeEnum nodeType, String resourceId) {
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), resourceId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), resourceId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
return Either.right(status);
}
@@ -609,18 +626,20 @@
}
@Override
- public Either<AdditionalInfoParameterInfo, TitanOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id) {
+ public Either<AdditionalInfoParameterInfo, JanusGraphOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String componentId, String id) {
- TitanOperationStatus verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
- if (verifyNodeTypeVsComponent != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
+ if (verifyNodeTypeVsComponent != JanusGraphOperationStatus.OK) {
return Either.right(verifyNodeTypeVsComponent);
}
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
return Either.right(status);
}
@@ -630,7 +649,7 @@
Map<String, String> idToKey = parameterData.getIdToKey();
if (idToKey == null || !idToKey.containsKey(id)) {
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
String key = idToKey.get(id);
@@ -638,11 +657,12 @@
log.trace("The key-value {} = {} was retrieved for id {}", key, value, id);
- Either<AdditionalInfoParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(parameterData, AdditionalInfoParameterData.class);
if (updateNode.isRight()) {
- TitanOperationStatus status = updateNode.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = updateNode.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logBeFailedRetrieveNodeError("GetAdditionnalInformationParameter", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + componentId, String.valueOf(status));
}
return Either.right(status);
@@ -655,21 +675,23 @@
}
@Override
- public Either<AdditionalInformationDefinition, TitanOperationStatus> getAllAdditionalInformationParameters(NodeTypeEnum nodeType, String componentId, boolean ignoreVerification) {
+ public Either<AdditionalInformationDefinition, JanusGraphOperationStatus> getAllAdditionalInformationParameters(NodeTypeEnum nodeType, String componentId, boolean ignoreVerification) {
if (!ignoreVerification) {
- TitanOperationStatus verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
- if (verifyNodeTypeVsComponent != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ verifyNodeTypeVsComponent = verifyNodeTypeVsComponent(nodeType, componentId);
+ if (verifyNodeTypeVsComponent != JanusGraphOperationStatus.OK) {
return Either.right(verifyNodeTypeVsComponent);
}
}
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logBeFailedRetrieveNodeError("GetAdditionnalInformationParameters", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + componentId, String.valueOf(status));
}
return Either.right(status);
@@ -693,11 +715,11 @@
try {
- Either<AdditionalInformationDefinition, TitanOperationStatus> either = this.getAllAdditionalInformationParameters(nodeType, resourceId, ignoreVerification);
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> either = this.getAllAdditionalInformationParameters(nodeType, resourceId, ignoreVerification);
if (either.isRight()) {
- TitanOperationStatus status = either.right().value();
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus status = either.right().value();
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
} else {
AdditionalInformationDefinition additionalInformationDefinition = either.left().value();
result = Either.left(additionalInformationDefinition);
@@ -716,10 +738,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -732,11 +754,11 @@
try {
- Either<AdditionalInfoParameterInfo, TitanOperationStatus> either = this.getAdditionalInformationParameter(nodeType, resourceId, id);
+ Either<AdditionalInfoParameterInfo, JanusGraphOperationStatus> either = this.getAdditionalInformationParameter(nodeType, resourceId, id);
if (either.isRight()) {
log.error("Failed to fetch additional information property with id {} of component {}", id, resourceId);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value()));
} else {
AdditionalInfoParameterInfo additionalInformationDefinition = either.left().value();
result = Either.left(additionalInformationDefinition);
@@ -756,16 +778,17 @@
try {
- Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, TitanOperationStatus> getResult = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), resourceId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
+ Either<ImmutablePair<AdditionalInfoParameterData, GraphEdge>, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), resourceId, GraphEdgeLabels.ADDITIONAL_INFORMATION,
NodeTypeEnum.AdditionalInfoParameters, AdditionalInfoParameterData.class);
if (getResult.isRight()) {
- TitanOperationStatus status = getResult.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getResult.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(StorageOperationStatus.OK);
} else {
BeEcompErrorManager.getInstance().logBeFailedDeleteNodeError("DeleteAdditionalInformationNode", ADDITIONAL_INFORMATION_OF + nodeType.getName() + " " + resourceId, String.valueOf(status));
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
return result;
}
@@ -773,11 +796,12 @@
ImmutablePair<AdditionalInfoParameterData, GraphEdge> value = getResult.left().value();
AdditionalInfoParameterData parameterData = value.getLeft();
- Either<AdditionalInfoParameterData, TitanOperationStatus> deleteNodeRes = titanGenericDao.deleteNode(parameterData, AdditionalInfoParameterData.class);
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> deleteNodeRes = janusGraphGenericDao
+ .deleteNode(parameterData, AdditionalInfoParameterData.class);
if (deleteNodeRes.isRight()) {
- TitanOperationStatus status = getResult.right().value();
+ JanusGraphOperationStatus status = getResult.right().value();
BeEcompErrorManager.getInstance().logBeFailedDeleteNodeError("DeleteAdditionalInformationNode", (String) parameterData.getUniqueId(), String.valueOf(status));
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
@@ -792,12 +816,13 @@
}
}
- private TitanOperationStatus verifyNodeTypeVsComponent(NodeTypeEnum nodeType, String componentId) {
- Either<TitanVertex, TitanOperationStatus> vertexByProperty = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId);
+ private JanusGraphOperationStatus verifyNodeTypeVsComponent(NodeTypeEnum nodeType, String componentId) {
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexByProperty = janusGraphGenericDao
+ .getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId);
if (vertexByProperty.isRight()) {
- TitanOperationStatus status = vertexByProperty.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = vertexByProperty.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return status;
} else {
@@ -806,14 +831,14 @@
if (label != null) {
if (!label.equals(nodeType.getName())) {
log.debug("The node type {} is not appropriate to component {}", nodeType, componentId);
- return TitanOperationStatus.INVALID_ID;
+ return JanusGraphOperationStatus.INVALID_ID;
}
} else {
log.debug("The node type {} with id {} does not have a label property.", nodeType, componentId);
- return TitanOperationStatus.INVALID_ID;
+ return JanusGraphOperationStatus.INVALID_ID;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
index 9beb205..4e65fa5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -33,11 +33,11 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
@@ -61,7 +61,7 @@
private static final String THE_RETURNED_ARTIFACT_DEFINTION_IS = "The returned ArtifactDefintion is {}";
@javax.annotation.Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@javax.annotation.Resource
private HeatParametersOperation heatParametersOperation;
@@ -77,12 +77,12 @@
super();
}
- public TitanGenericDao getTitanGenericDao() {
- return titanGenericDao;
+ public JanusGraphGenericDao getJanusGraphGenericDao() {
+ return janusGraphGenericDao;
}
- public void setTitanGenericDao(TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
public HeatParametersOperation getHeatParametersOperation() {
@@ -100,13 +100,13 @@
if (status.isRight()) {
if (!inTransaction) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
log.debug("Failed to add artifact {} to {} {}", artifactInfo.getArtifactName(), type , parentId);
return Either.right(status.right().value());
} else {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
ArtifactData artifactData = status.left().value();
@@ -119,7 +119,7 @@
}
@Override
- public StorageOperationStatus addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, TitanVertex parentVertex) {
+ public StorageOperationStatus addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, JanusGraphVertex parentVertex) {
StorageOperationStatus status = addArtifactToGraph(artifactInfo, parentId, type, failIfExist, parentVertex);
@@ -129,7 +129,7 @@
return status;
}
- private StorageOperationStatus addArtifactToGraph(ArtifactDefinition artifactInfo, String id, NodeTypeEnum type, boolean failIfexist, TitanVertex parentVertex) {
+ private StorageOperationStatus addArtifactToGraph(ArtifactDefinition artifactInfo, String id, NodeTypeEnum type, boolean failIfexist, JanusGraphVertex parentVertex) {
if (artifactInfo.getUniqueId() == null || artifactInfo.getUniqueId().isEmpty()) {
String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(id, artifactInfo.getArtifactLabel());
@@ -142,20 +142,21 @@
ArtifactData artifactData = new ArtifactData(artifactInfo);
- Either<TitanVertex, TitanOperationStatus> existArtifact = titanGenericDao.getVertexByProperty(artifactData.getUniqueIdKey(), artifactData.getUniqueId());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> existArtifact = janusGraphGenericDao
+ .getVertexByProperty(artifactData.getUniqueIdKey(), artifactData.getUniqueId());
if (existArtifact.isRight()) {
- if (existArtifact.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (existArtifact.right().value().equals(JanusGraphOperationStatus.NOT_FOUND)) {
// create new node
log.debug("Before adding artifact to graph {}", artifactData);
if (artifactData.getArtifactDataDefinition().getArtifactUUID() == null || artifactData.getArtifactDataDefinition().getArtifactUUID().isEmpty())
updateUUID(artifactData.getArtifactDataDefinition(), null, artifactData.getArtifactDataDefinition().getArtifactVersion());
- Either<TitanVertex, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(artifactData);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao.createNode(artifactData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.debug("Failed to add artifact {} to graph. status is {}", artifactData.getArtifactDataDefinition().getArtifactName(), operationStatus);
BeEcompErrorManager.getInstance().logBeFailedCreateNodeError("Add artifact", artifactData.getArtifactDataDefinition().getArtifactName(), String.valueOf(operationStatus));
- return DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus);
}
// add heat parameters
@@ -169,11 +170,11 @@
} else {
log.debug("Failed to check existance of artifact in graph for id {}", artifactData.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(existArtifact.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(existArtifact.right().value());
}
} else if (failIfexist) {
log.debug("Artifact {} already exist", artifactData.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ALREADY_EXIST);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ALREADY_EXIST);
}
// save logical artifact ref name on edge as property
@@ -181,10 +182,11 @@
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), artifactInfo.getArtifactLabel());
if (artifactInfo.getArtifactGroupType() != null)
properties.put(GraphEdgePropertiesDictionary.GROUP_TYPE.getProperty(), artifactInfo.getArtifactGroupType().getType());
- TitanOperationStatus relation = titanGenericDao.createEdge(parentVertex, artifactData, GraphEdgeLabels.ARTIFACT_REF, properties);
- if (!relation.equals(TitanOperationStatus.OK)) {
+ JanusGraphOperationStatus relation = janusGraphGenericDao
+ .createEdge(parentVertex, artifactData, GraphEdgeLabels.ARTIFACT_REF, properties);
+ if (!relation.equals(JanusGraphOperationStatus.OK)) {
log.debug("Failed to create relation in graph for id {} to new artifact", id);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(relation);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(relation);
}
return StorageOperationStatus.OK;
@@ -203,21 +205,23 @@
ArtifactData artifactData = new ArtifactData(artifactInfo);
- Either<ArtifactData, TitanOperationStatus> existArtifact = titanGenericDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> existArtifact = janusGraphGenericDao
+ .getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
if (existArtifact.isRight()) {
- if (existArtifact.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (existArtifact.right().value().equals(JanusGraphOperationStatus.NOT_FOUND)) {
// create new node
log.debug("Before adding artifact to graph {}" , artifactData);
if (artifactData.getArtifactDataDefinition().getArtifactUUID() == null || artifactData.getArtifactDataDefinition().getArtifactUUID().isEmpty())
updateUUID(artifactData.getArtifactDataDefinition(), null, artifactData.getArtifactDataDefinition().getArtifactVersion());
- Either<ArtifactData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(artifactData, ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(artifactData, ArtifactData.class);
log.debug("After adding artifact to graph {}", artifactData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.debug("Failed to add artifact {} to graph. status is {}", artifactData.getArtifactDataDefinition().getArtifactName(), operationStatus);
BeEcompErrorManager.getInstance().logBeFailedCreateNodeError("Add artifact", artifactData.getArtifactDataDefinition().getArtifactName(), String.valueOf(operationStatus));
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
}
artifactData = createNodeResult.left().value();
@@ -232,11 +236,12 @@
} else {
log.debug("Failed to check existance of artifact in graph for id {}", artifactData.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(existArtifact.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(existArtifact.right().value()));
}
} else if (failIfexist) {
log.debug("Artifact {} already exist", artifactData.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ALREADY_EXIST));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.ALREADY_EXIST));
} else {
artifactData = existArtifact.left().value();
}
@@ -248,10 +253,11 @@
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), artifactInfo.getArtifactLabel());
if (artifactInfo.getArtifactGroupType() != null)
properties.put(GraphEdgePropertiesDictionary.GROUP_TYPE.getProperty(), artifactInfo.getArtifactGroupType().getType());
- Either<GraphRelation, TitanOperationStatus> relation = titanGenericDao.createRelation(parent, artifactData, GraphEdgeLabels.ARTIFACT_REF, properties);
+ Either<GraphRelation, JanusGraphOperationStatus> relation = janusGraphGenericDao
+ .createRelation(parent, artifactData, GraphEdgeLabels.ARTIFACT_REF, properties);
if (relation.isRight()) {
log.debug("Failed to create relation in graph fro id {} to new artifact", id);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(relation.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(relation.right().value()));
}
return Either.left(artifactData);
@@ -291,14 +297,14 @@
if (status.isRight()) {
if (!inTransaction) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
log.debug("Failed to update artifact {} of {} {}. status is {}", artifactId, type.getName(), id, status.right().value());
BeEcompErrorManager.getInstance().logBeFailedUpdateNodeError("Update Artifact", artifactId, String.valueOf(status.right().value()));
return Either.right(status.right().value());
} else {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
ArtifactData artifactData = status.left().value();
@@ -314,7 +320,7 @@
if (status.isRight()) {
if (!inTransaction) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
log.debug("Failed to delete artifact {} of resource {}", artifactId, id);
@@ -322,7 +328,7 @@
return Either.right(status.right().value());
} else {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
ArtifactData artifactData = status.left().value();
@@ -335,21 +341,21 @@
@SuppressWarnings("null")
private Either<ArtifactData, StorageOperationStatus> updateArtifactOnGraph(ArtifactDefinition artifactInfo, String artifactId, NodeTypeEnum type, String id) {
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graph.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(graph.right().value()));
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId).vertices();
- Iterator<TitanVertex> iterator = verticesArtifact.iterator();
+ Iterable<JanusGraphVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId).vertices();
+ Iterator<JanusGraphVertex> iterator = verticesArtifact.iterator();
if (!iterator.hasNext()) {
log.debug("No artifact node for id = {}", artifactId);
return Either.right(StorageOperationStatus.NOT_FOUND);
}
- TitanVertex artifactV = iterator.next();
+ JanusGraphVertex artifactV = iterator.next();
Iterator<Edge> iterEdge = artifactV.edges(Direction.IN, GraphEdgeLabels.ARTIFACT_REF.getProperty());
@@ -385,8 +391,10 @@
String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(id, artifactInfo.getArtifactLabel());
artifactInfo.setUniqueId(uniqueId);
// update UUID and artifact version
- String oldChecksum = artifactV.valueOrNull(titanGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
- String oldVersion = artifactV.valueOrNull(titanGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
+ String oldChecksum = artifactV.valueOrNull(
+ janusGraphGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
+ String oldVersion = artifactV.valueOrNull(
+ janusGraphGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
updateUUID(artifactInfo, oldChecksum, oldVersion);
log.debug("try to create new artifact ref node for id {}", uniqueId);
Either<ArtifactData, StorageOperationStatus> addedArtifactRes = addArtifactToGraph(artifactInfo, id, type, true);
@@ -435,10 +443,11 @@
Vertex vertexIn = edgeToHeat.inVertex();
String generatedFromArtifactId = vertexIn.value(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef));
UniqueIdData generatedFromArtifactNode = new UniqueIdData(NodeTypeEnum.ArtifactRef, generatedFromArtifactId);
- Either<GraphRelation, TitanOperationStatus> createRelationToGeneratedFromArtifactRes = titanGenericDao.createRelation(addedArtifact, generatedFromArtifactNode, GraphEdgeLabels.GENERATED_FROM, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelationToGeneratedFromArtifactRes = janusGraphGenericDao
+ .createRelation(addedArtifact, generatedFromArtifactNode, GraphEdgeLabels.GENERATED_FROM, null);
if (createRelationToGeneratedFromArtifactRes.isRight()) {
log.error("Failed to create relation from heat_env {} to heat {}", addedArtifact.getUniqueId(), generatedFromArtifactNode);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createRelationToGeneratedFromArtifactRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createRelationToGeneratedFromArtifactRes.right().value()));
}
}
}
@@ -446,14 +455,17 @@
} else {
if (edgeCount == 1) {
- String oldChecksum = artifactV.valueOrNull(titanGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
- String oldVersion = artifactV.valueOrNull(titanGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
+ String oldChecksum = artifactV.valueOrNull(
+ janusGraphGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
+ String oldVersion = artifactV.valueOrNull(
+ janusGraphGenericDao.getGraph().left().value().getPropertyKey(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
updateUUID(artifactInfo, oldChecksum, oldVersion);
// update exist
- Either<ArtifactData, TitanOperationStatus> updatedArtifact = titanGenericDao.updateNode(artifactData, ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> updatedArtifact = janusGraphGenericDao
+ .updateNode(artifactData, ArtifactData.class);
if (updatedArtifact.isRight()) {
log.debug("failed to update artifact node for id {}", artifactData.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updatedArtifact.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updatedArtifact.right().value()));
}
if (artifactInfo.getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())) {
@@ -511,7 +523,7 @@
return false;
}
- private Either<Boolean, StorageOperationStatus> setRelevantHeatParamId(TitanVertex artifactV, ArtifactDefinition artifactInfo) {
+ private Either<Boolean, StorageOperationStatus> setRelevantHeatParamId(JanusGraphVertex artifactV, ArtifactDefinition artifactInfo) {
Map<String, String> heatParametersHM = new HashMap<>();
@@ -524,7 +536,8 @@
Vertex heatVertex = heat.inVertex();
String heatUniqueId = (String) heatVertex.value(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef));
- Either<List<ImmutablePair<HeatParameterData, GraphEdge>>, TitanOperationStatus> getHeatParametersRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), heatUniqueId, GraphEdgeLabels.HEAT_PARAMETER,
+ Either<List<ImmutablePair<HeatParameterData, GraphEdge>>, JanusGraphOperationStatus> getHeatParametersRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), heatUniqueId, GraphEdgeLabels.HEAT_PARAMETER,
NodeTypeEnum.HeatParameter, HeatParameterData.class);
if (getHeatParametersRes.isRight()) {
log.debug("No heat parameters for heat artifact {}", heatUniqueId);
@@ -550,17 +563,18 @@
}
private Either<ArtifactData, StorageOperationStatus> removeArtifactOnGraph(String id, String artifactId, NodeTypeEnum type, boolean deleteMandatoryArtifact) {
- Either<TitanGraph, StorageOperationStatus> graph = titanGenericDao.getGraph()
+ Either<JanusGraph, StorageOperationStatus> graph = janusGraphGenericDao.getGraph()
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (graph.isRight()) {
return Either.right(graph.right().value());
}
- TitanGraph tGraph = graph.left().value();
- Either<ArtifactData, StorageOperationStatus> artifactData = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId, ArtifactData.class)
+ JanusGraph tGraph = graph.left().value();
+ Either<ArtifactData, StorageOperationStatus> artifactData = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId, ArtifactData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (artifactData.isRight()) {
log.debug("Failed to retrieve artifact for id = {}", artifactId);
return Either.right(artifactData.right().value());
@@ -572,8 +586,8 @@
}
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId).vertices();
- Iterator<TitanVertex> iterator = verticesArtifact.iterator();
+ Iterable<JanusGraphVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId).vertices();
+ Iterator<JanusGraphVertex> iterator = verticesArtifact.iterator();
if (!iterator.hasNext()) {
log.debug("No artifact node for id = {}", artifactId);
return Either.right(StorageOperationStatus.NOT_FOUND);
@@ -649,20 +663,20 @@
public Either<Map<String, ArtifactDefinition>, StorageOperationStatus> getArtifacts(String parentId, NodeTypeEnum parentType, boolean inTransaction) {
Either<Map<String, ArtifactDefinition>, StorageOperationStatus> result = null;
try {
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
log.debug("Failed to work with graph {}", graph.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graph.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(graph.right().value()));
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(parentType), parentId).vertices();
+ Iterable<JanusGraphVertex> vertices = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(parentType), parentId).vertices();
if (vertices == null) {
log.debug("No nodes for type {} for id = {}", parentType, parentId);
result = Either.right(StorageOperationStatus.NOT_FOUND);
return result;
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
Map<String, ArtifactDefinition> artifactMap = new HashMap<>();
while (iterator.hasNext()) {
@@ -676,15 +690,16 @@
Vertex artifactV = edge.inVertex();
- Map<String, Object> properties = this.titanGenericDao.getProperties(artifactV);
+ Map<String, Object> properties = this.janusGraphGenericDao.getProperties(artifactV);
ArtifactData artifact = GraphElementFactory.createElement(NodeTypeEnum.ArtifactRef.getName(), GraphElementTypeEnum.Node, properties, ArtifactData.class);
if (artifact != null) {
ArtifactDefinition artifactDefinition = new ArtifactDefinition(artifact.getArtifactDataDefinition());
Iterator<Edge> edgesGeneratedFrom = artifactV.edges(Direction.OUT, GraphEdgeLabels.GENERATED_FROM.getProperty());
if (edgesGeneratedFrom != null && edgesGeneratedFrom.hasNext()) {
- TitanVertex inVertex = (TitanVertex) edgesGeneratedFrom.next().inVertex();
- String artifactIdGeneratedFrom = (String) titanGenericDao.getProperty(inVertex, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
+ JanusGraphVertex inVertex = (JanusGraphVertex) edgesGeneratedFrom.next().inVertex();
+ String artifactIdGeneratedFrom = (String) janusGraphGenericDao
+ .getProperty(inVertex, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
artifactDefinition.setGeneratedFromId(artifactIdGeneratedFrom);
}
List<HeatParameterDefinition> heatParams = new ArrayList<>();
@@ -707,9 +722,9 @@
} finally {
if (!inTransaction) {
if (result == null || result.isRight()) {
- this.titanGenericDao.rollback();
+ this.janusGraphGenericDao.rollback();
} else {
- this.titanGenericDao.commit();
+ this.janusGraphGenericDao.commit();
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CacheMangerOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CacheMangerOperation.java
index 3a0eef1..abd3c91 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CacheMangerOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CacheMangerOperation.java
@@ -23,7 +23,7 @@
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.cache.ComponentCache;
import org.openecomp.sdc.be.model.cache.DaoInfo;
@@ -31,7 +31,7 @@
import org.openecomp.sdc.be.model.cache.workers.CacheWorker;
import org.openecomp.sdc.be.model.cache.workers.IWorker;
import org.openecomp.sdc.be.model.cache.workers.SyncWorker;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,7 +50,7 @@
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@Autowired
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Autowired
private ComponentCache componentCache;
@@ -183,8 +183,8 @@
}
}
- public TitanGenericDao getTitanGenericDao() {
- return titanGenericDao;
+ public JanusGraphGenericDao getJanusGraphGenericDao() {
+ return janusGraphGenericDao;
}
public ComponentCache getComponentCache() {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java
index 382a2e0..ed635d1 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java
@@ -36,11 +36,11 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
@@ -71,11 +71,11 @@
@VisibleForTesting
- public void setTitanGenericDao(HealingTitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(HealingJanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
- public Either<CapabilityData, TitanOperationStatus> addCapabilityToGraph(String resourceId, CapabilityTypeData capTypeData, CapabilityDefinition capabilityDefinition) {
+ public Either<CapabilityData, JanusGraphOperationStatus> addCapabilityToGraph(String resourceId, CapabilityTypeData capTypeData, CapabilityDefinition capabilityDefinition) {
log.debug("#addCapabilityToGraph - capabilityDefinition={}", capabilityDefinition);
@@ -83,11 +83,12 @@
CapabilityData capabilityData = buildCapabilityData(capabilityDefinition, capUniqueId);
log.debug("addCapabilityToGraph - Before adding capability to graph. capabilityTypeData = {}", capabilityData);
- Either<CapabilityData, TitanOperationStatus> createCapResult = titanGenericDao.createNode(capabilityData, CapabilityData.class);
+ Either<CapabilityData, JanusGraphOperationStatus> createCapResult = janusGraphGenericDao
+ .createNode(capabilityData, CapabilityData.class);
log.debug("addCapabilityToGraph - After adding capability to graph. status is = {}", createCapResult);
if (createCapResult.isRight()) {
- TitanOperationStatus operationStatus = createCapResult.right().value();
+ JanusGraphOperationStatus operationStatus = createCapResult.right().value();
log.error("addCapabilityToGraph - Failed to add capability of type {} to graph. status is {}", capabilityDefinition.getType(), operationStatus);
return createCapResult;
}
@@ -101,14 +102,15 @@
return createCapResult;
}
- private Either<GraphRelation, TitanOperationStatus> connectToCapabilityType(CapabilityData capabilityData, CapabilityTypeData capabilityTypeData) {
+ private Either<GraphRelation, JanusGraphOperationStatus> connectToCapabilityType(CapabilityData capabilityData, CapabilityTypeData capabilityTypeData) {
Map<String, Object> properties = new HashMap<>();
String capabilityName = capabilityData.getCapabilityDataDefinition().getName();
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), capabilityName);
- return titanGenericDao.createRelation(capabilityData, capabilityTypeData, GraphEdgeLabels.CAPABILITY_IMPL, properties);
+ return janusGraphGenericDao
+ .createRelation(capabilityData, capabilityTypeData, GraphEdgeLabels.CAPABILITY_IMPL, properties);
}
@@ -117,13 +119,13 @@
* @param capabilites
* @return
*/
- public Either<List<CapabilityDefinition>, TitanOperationStatus> getCapabilitiesWithProps(List<ImmutablePair<CapabilityData, GraphEdge>> capabilites) {
- List<Either<CapabilityDefinition, TitanOperationStatus>> listFilledCapabilitiesResults = capabilites.stream()
+ public Either<List<CapabilityDefinition>, JanusGraphOperationStatus> getCapabilitiesWithProps(List<ImmutablePair<CapabilityData, GraphEdge>> capabilites) {
+ List<Either<CapabilityDefinition, JanusGraphOperationStatus>> listFilledCapabilitiesResults = capabilites.stream()
.map(ImmutablePair::getLeft)
.map(this::toCapabilityDefinitionWithProps)
.collect(Collectors.toList());
- Optional<TitanOperationStatus> status = listFilledCapabilitiesResults.stream().filter(Either::isRight)
+ Optional<JanusGraphOperationStatus> status = listFilledCapabilitiesResults.stream().filter(Either::isRight)
.map(res -> res.right().value())
.findFirst();
@@ -138,7 +140,7 @@
return Either.left(listCapabilities);
}
- private Either<CapabilityDefinition, TitanOperationStatus> toCapabilityDefinitionWithProps(CapabilityData capabilityData) {
+ private Either<CapabilityDefinition, JanusGraphOperationStatus> toCapabilityDefinitionWithProps(CapabilityData capabilityData) {
CapabilityDefinition capabilityDefinition = new CapabilityDefinition(capabilityData.getCapabilityDataDefinition());
return getCapabilityProperties(capabilityDefinition.getUniqueId(), capabilityDefinition.getType())
.left()
@@ -157,33 +159,34 @@
* @param capabilityUid
* @return
*/
- private Either<List<ComponentInstanceProperty>, TitanOperationStatus> getCapabilityProperties(String capabilityUid, String capabilityType) {
- Either<CapabilityTypeDefinition, TitanOperationStatus> capabilityTypeRes = capabilityTypeOperation.getCapabilityTypeByType(capabilityType);
+ private Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> getCapabilityProperties(String capabilityUid, String capabilityType) {
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeRes = capabilityTypeOperation.getCapabilityTypeByType(capabilityType);
if (capabilityTypeRes.isRight()) {
- TitanOperationStatus status = capabilityTypeRes.right().value();
+ JanusGraphOperationStatus status = capabilityTypeRes.right().value();
return Either.right(status);
}
CapabilityTypeDefinition capabilityTypeDefinition = capabilityTypeRes.left().value();
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> typesPropsRes = getPropertiesOfCapabilityTypeAndAcestors(capabilityTypeDefinition);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> typesPropsRes = getPropertiesOfCapabilityTypeAndAcestors(capabilityTypeDefinition);
if (typesPropsRes.isRight()) {
- TitanOperationStatus status = typesPropsRes.right().value();
+ JanusGraphOperationStatus status = typesPropsRes.right().value();
return Either.right(status);
}
Map<String, PropertyDefinition> capabilityTypeProperties = typesPropsRes.left().value();
if (isEmpty(capabilityTypeProperties)) {
- return Either.right(TitanOperationStatus.OK);
+ return Either.right(JanusGraphOperationStatus.OK);
}
Map<String, PropertyDefinition> uidToPropDefMap = capabilityTypeProperties.values().stream()
.collect(Collectors.toMap(PropertyDefinition::getUniqueId, Function.identity()));
// Find all properties values on the capability
- Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, TitanOperationStatus> propertyValNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Capability), capabilityUid, GraphEdgeLabels.PROPERTY_VALUE,
+ Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, JanusGraphOperationStatus> propertyValNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Capability), capabilityUid, GraphEdgeLabels.PROPERTY_VALUE,
NodeTypeEnum.PropertyValue, PropertyValueData.class);
if (propertyValNodes.isRight()) {
@@ -192,7 +195,7 @@
List<ImmutablePair<PropertyValueData, GraphEdge>> propValsRelationPairs = propertyValNodes.left().value();
if (isEmpty(propValsRelationPairs)) {
- return Either.right(TitanOperationStatus.OK);
+ return Either.right(JanusGraphOperationStatus.OK);
}
List<ComponentInstanceProperty> capabilityProperties = new ArrayList<>();
@@ -200,12 +203,13 @@
for (ImmutablePair<PropertyValueData, GraphEdge> propValRelPair : propValsRelationPairs) {
PropertyValueData propertyValueData = propValRelPair.getLeft();
- Either<ImmutablePair<PropertyData, GraphEdge>, TitanOperationStatus> propertyDefRes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueData.getUniqueId(), GraphEdgeLabels.PROPERTY_IMPL,
+ Either<ImmutablePair<PropertyData, GraphEdge>, JanusGraphOperationStatus> propertyDefRes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueData.getUniqueId(), GraphEdgeLabels.PROPERTY_IMPL,
NodeTypeEnum.Property, PropertyData.class);
if (propertyDefRes.isRight()) {
- TitanOperationStatus status = propertyDefRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = propertyDefRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -242,8 +246,8 @@
.collect(Collectors.toSet());
}
- private Either<List<ComponentInstanceProperty>, TitanOperationStatus> onLoadPropValuesFailure(TitanOperationStatus status, Map<String, PropertyDefinition> capabilityTypeProperties) {
- if (status == TitanOperationStatus.NOT_FOUND) {
+ private Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> onLoadPropValuesFailure(JanusGraphOperationStatus status, Map<String, PropertyDefinition> capabilityTypeProperties) {
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(buildPropsFromCapabilityTypeProps(capabilityTypeProperties));
} else {
return Either.right(status);
@@ -267,15 +271,15 @@
* @param capabilityTypeDefinition
* @return
*/
- private Either<Map<String, PropertyDefinition>, TitanOperationStatus> getPropertiesOfCapabilityTypeAndAcestors(CapabilityTypeDefinition capabilityTypeDefinition) {
+ private Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getPropertiesOfCapabilityTypeAndAcestors(CapabilityTypeDefinition capabilityTypeDefinition) {
// Get the properties on the group type of this capability
Map<String, PropertyDefinition> capabilityTypeProperties = capabilityTypeDefinition.getProperties();
String derivedFrom = capabilityTypeDefinition.getDerivedFrom();
if (!Strings.isNullOrEmpty(derivedFrom)) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> parentPropsRes = capabilityTypeOperation.getAllCapabilityTypePropertiesFromAllDerivedFrom(derivedFrom);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> parentPropsRes = capabilityTypeOperation.getAllCapabilityTypePropertiesFromAllDerivedFrom(derivedFrom);
if(parentPropsRes.isRight()) {
- TitanOperationStatus status = parentPropsRes.right().value();
+ JanusGraphOperationStatus status = parentPropsRes.right().value();
return Either.right(status);
}
if (capabilityTypeProperties != null) {
@@ -297,15 +301,15 @@
* @param capabilityTypeData
* @return
*/
- private Either<List<ComponentInstanceProperty>, TitanOperationStatus> createCapabilityProperties(CapabilityData capabilityData,
- CapabilityTypeData capabilityTypeData) {
+ private Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> createCapabilityProperties(CapabilityData capabilityData,
+ CapabilityTypeData capabilityTypeData) {
CapabilityDefinition capabilityDefintion = (CapabilityDefinition)capabilityData.getCapabilityDataDefinition();
CapabilityTypeDefinition capabilityTypeDefinition = (CapabilityTypeDefinition)capabilityTypeData.getCapabilityTypeDataDefinition();
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> typesPropsRes = getPropertiesOfCapabilityTypeAndAcestors(capabilityTypeDefinition);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> typesPropsRes = getPropertiesOfCapabilityTypeAndAcestors(capabilityTypeDefinition);
if (typesPropsRes.isRight()) {
- TitanOperationStatus status = typesPropsRes.right().value();
+ JanusGraphOperationStatus status = typesPropsRes.right().value();
return Either.right(status);
}
@@ -313,10 +317,10 @@
if (isEmpty(capabilityTypeProperties) && !isEmpty(capabilityDefintion.getProperties())) {
log.debug("#createCapabilityProperties - It's not valid if group capability has properties while corresponding capability type doesn't.");
- return Either.right(TitanOperationStatus.MATCH_NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.MATCH_NOT_FOUND);
}
- Optional<TitanOperationStatus> error = capabilityDefintion.getProperties().stream()
+ Optional<JanusGraphOperationStatus> error = capabilityDefintion.getProperties().stream()
.map(property -> createPropertyValue(property, capabilityData, capabilityTypeProperties.get(property.getName())))
.filter(Either::isRight)
.map(result -> result.right().value())
@@ -342,11 +346,11 @@
.collect(Collectors.toList());
}
- private Either<PropertyValueData, TitanOperationStatus> createPropertyValue(ComponentInstanceProperty capabilityProperty,
- CapabilityData capabilityData,
- PropertyDefinition capTypePropertyDefinition) {
+ private Either<PropertyValueData, JanusGraphOperationStatus> createPropertyValue(ComponentInstanceProperty capabilityProperty,
+ CapabilityData capabilityData,
+ PropertyDefinition capTypePropertyDefinition) {
if (capTypePropertyDefinition == null) {
- return Either.right(TitanOperationStatus.MATCH_NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.MATCH_NOT_FOUND);
}
CapabilityDefinition capabilityDefintion = (CapabilityDefinition)capabilityData.getCapabilityDataDefinition();
@@ -357,7 +361,8 @@
PropertyValueData propertyValueData = new PropertyValueData();
propertyValueData.setUniqueId(uniqueId);
propertyValueData.setValue(capabilityProperty.getValue());
- Either<PropertyValueData, TitanOperationStatus> propResult = titanGenericDao.createNode(propertyValueData, PropertyValueData.class);
+ Either<PropertyValueData, JanusGraphOperationStatus> propResult = janusGraphGenericDao
+ .createNode(propertyValueData, PropertyValueData.class);
// It's not accepted if Capability Type doesn't have suitable property
propResult = propResult.left()
.bind(propValueData -> connectToProperty(propValueData, capTypePropertyDefinition))
@@ -372,22 +377,23 @@
return propResult;
}
- private Either<GraphRelation, TitanOperationStatus> connectCapability(PropertyValueData propValueData, String name, CapabilityData capabilityData) {
+ private Either<GraphRelation, JanusGraphOperationStatus> connectCapability(PropertyValueData propValueData, String name, CapabilityData capabilityData) {
Map<String, Object> properties = new HashMap<>();
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), name);
- return titanGenericDao.createRelation(capabilityData, propValueData, GraphEdgeLabels.PROPERTY_VALUE, properties);
+ return janusGraphGenericDao.createRelation(capabilityData, propValueData, GraphEdgeLabels.PROPERTY_VALUE, properties);
}
- private Either<GraphRelation, TitanOperationStatus> connectToProperty(PropertyValueData propValueData, PropertyDefinition propertyDefinition) {
- Either<PropertyData, TitanOperationStatus> dataTypesRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property),
+ private Either<GraphRelation, JanusGraphOperationStatus> connectToProperty(PropertyValueData propValueData, PropertyDefinition propertyDefinition) {
+ Either<PropertyData, JanusGraphOperationStatus> dataTypesRes = janusGraphGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property),
propertyDefinition.getUniqueId(), PropertyData.class);
Map<String, Object> properties = new HashMap<>();
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), propertyDefinition.getName());
return dataTypesRes.left()
- .bind(propertyData -> titanGenericDao.createRelation(propValueData, propertyData, GraphEdgeLabels.PROPERTY_IMPL, properties));
+ .bind(propertyData -> janusGraphGenericDao
+ .createRelation(propValueData, propertyData, GraphEdgeLabels.PROPERTY_IMPL, properties));
}
@@ -408,12 +414,14 @@
public StorageOperationStatus deleteCapability(CapabilityDefinition capabilityDef) {
- return titanGenericDao.deleteChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), capabilityDef.getUniqueId(), GraphEdgeLabels.PROPERTY_VALUE,
+ return janusGraphGenericDao
+ .deleteChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), capabilityDef.getUniqueId(), GraphEdgeLabels.PROPERTY_VALUE,
NodeTypeEnum.PropertyValue, PropertyValueData.class)
.left()
- .bind(props -> titanGenericDao.deleteNode(new CapabilityData(capabilityDef), CapabilityData.class))
+ .bind(props -> janusGraphGenericDao
+ .deleteNode(new CapabilityData(capabilityDef), CapabilityData.class))
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.right()
.on(capData -> StorageOperationStatus.OK);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
index 1cc1380..61c7e0c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
@@ -30,9 +30,9 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -66,10 +66,10 @@
/**
* FOR TEST ONLY
*
- * @param titanGenericDao
+ * @param janusGraphGenericDao
*/
- public void setTitanGenericDao(HealingTitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(HealingJanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@Override
@@ -102,26 +102,27 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("#addCapabilityType - Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("#addCapabilityType - Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
}
- public Either<Map<String, PropertyDefinition>, TitanOperationStatus> getAllCapabilityTypePropertiesFromAllDerivedFrom(String firstParentType) {
+ public Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllCapabilityTypePropertiesFromAllDerivedFrom(String firstParentType) {
return propertyOperation.getAllTypePropertiesFromAllDerivedFrom(firstParentType, NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
}
public Either<CapabilityTypeDefinition, StorageOperationStatus> validateUpdateProperties(CapabilityTypeDefinition capabilityTypeDefinition) {
- TitanOperationStatus error = null;
+ JanusGraphOperationStatus error = null;
if (MapUtils.isNotEmpty(capabilityTypeDefinition.getProperties()) && capabilityTypeDefinition.getDerivedFrom() != null) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> allPropertiesRes =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> allPropertiesRes =
getAllCapabilityTypePropertiesFromAllDerivedFrom(capabilityTypeDefinition.getDerivedFrom());
- if (allPropertiesRes.isRight() && !allPropertiesRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (allPropertiesRes.isRight() && !allPropertiesRes.right().value().equals(
+ JanusGraphOperationStatus.NOT_FOUND)) {
error = allPropertiesRes.right().value();
log.debug("Couldn't fetch derived from property nodes for capability type {}, error: {}", capabilityTypeDefinition.getType(), error);
}
@@ -131,7 +132,7 @@
.forEach(e -> e.getValue().setType(derivedFromProperties.get(e.getKey()).getType()));
List<PropertyDefinition> properties = capabilityTypeDefinition.getProperties().values().stream().collect(Collectors.toList());
- Either<List<PropertyDefinition>, TitanOperationStatus> validatePropertiesRes = propertyOperation.validatePropertiesUniqueness(allPropertiesRes.left().value(),
+ Either<List<PropertyDefinition>, JanusGraphOperationStatus> validatePropertiesRes = propertyOperation.validatePropertiesUniqueness(allPropertiesRes.left().value(),
properties);
if (validatePropertiesRes.isRight()) {
error = validatePropertiesRes.right().value();
@@ -141,7 +142,7 @@
if (error == null) {
return Either.left(capabilityTypeDefinition);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
@@ -179,21 +180,22 @@
CapabilityTypeData capabilityTypeData = buildCapabilityTypeData(capabilityTypeDefinition, ctUniqueId);
log.debug("Before adding capability type to graph. capabilityTypeData = {}", capabilityTypeData);
- Either<CapabilityTypeData, TitanOperationStatus> createCTResult = titanGenericDao.createNode(capabilityTypeData, CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> createCTResult = janusGraphGenericDao
+ .createNode(capabilityTypeData, CapabilityTypeData.class);
log.debug("After adding capability type to graph. status is = {}", createCTResult);
if (createCTResult.isRight()) {
- TitanOperationStatus operationStatus = createCTResult.right().value();
+ JanusGraphOperationStatus operationStatus = createCTResult.right().value();
log.error("Failed to capability type {} to graph. status is {}", capabilityTypeDefinition.getType(), operationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
}
CapabilityTypeData resultCTD = createCTResult.left().value();
Map<String, PropertyDefinition> propertiesMap = capabilityTypeDefinition.getProperties();
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToCapablityType = propertyOperation.addPropertiesToElementType(resultCTD.getUniqueId(), NodeTypeEnum.CapabilityType, propertiesMap);
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToCapablityType = propertyOperation.addPropertiesToElementType(resultCTD.getUniqueId(), NodeTypeEnum.CapabilityType, propertiesMap);
if (addPropertiesToCapablityType.isRight()) {
log.error("Failed add properties {} to capability {}", propertiesMap, capabilityTypeDefinition.getType());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertiesToCapablityType.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertiesToCapablityType.right().value()));
}
return addDerivedFromRelation(capabilityTypeDefinition, ctUniqueId)
@@ -223,14 +225,14 @@
Either<CapabilityTypeDefinition, StorageOperationStatus> result = null;
try {
- Either<CapabilityTypeDefinition, TitanOperationStatus> ctResult = this.getCapabilityTypeByUid(uniqueId);
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> ctResult = this.getCapabilityTypeByUid(uniqueId);
if (ctResult.isRight()) {
- TitanOperationStatus status = ctResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = ctResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
log.error("Failed to retrieve information on capability type {}. status is {}", uniqueId, status);
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(ctResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(ctResult.right().value()));
return result;
}
@@ -240,13 +242,13 @@
} finally {
if (!inTransaction) {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
- public Either<CapabilityTypeDefinition, TitanOperationStatus> getCapabilityTypeByType(String capabilityType) {
+ public Either<CapabilityTypeDefinition, JanusGraphOperationStatus> getCapabilityTypeByType(String capabilityType) {
// Optimization: In case of Capability Type its unique ID is the same as type
return getCapabilityTypeByUid(capabilityType);
}
@@ -257,14 +259,15 @@
* @param uniqueId
* @return
*/
- public Either<CapabilityTypeDefinition, TitanOperationStatus> getCapabilityTypeByUid(String uniqueId) {
+ public Either<CapabilityTypeDefinition, JanusGraphOperationStatus> getCapabilityTypeByUid(String uniqueId) {
- Either<CapabilityTypeDefinition, TitanOperationStatus> result = null;
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> result = null;
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypesRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId, CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypesRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId, CapabilityTypeData.class);
if (capabilityTypesRes.isRight()) {
- TitanOperationStatus status = capabilityTypesRes.right().value();
+ JanusGraphOperationStatus status = capabilityTypesRes.right().value();
log.debug("Capability type {} cannot be found in graph. status is {}", uniqueId, status);
return Either.right(status);
}
@@ -272,9 +275,9 @@
CapabilityTypeData ctData = capabilityTypesRes.left().value();
CapabilityTypeDefinition capabilityTypeDefinition = new CapabilityTypeDefinition(ctData.getCapabilityTypeDataDefinition());
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> propertiesStatus =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> propertiesStatus =
OperationUtils.fillProperties(uniqueId, propertyOperation, NodeTypeEnum.CapabilityType);
- if (propertiesStatus.isRight() && propertiesStatus.right().value() != TitanOperationStatus.OK) {
+ if (propertiesStatus.isRight() && propertiesStatus.right().value() != JanusGraphOperationStatus.OK) {
log.error("Failed to fetch properties of capability type {}", uniqueId);
return Either.right(propertiesStatus.right().value());
}
@@ -283,14 +286,16 @@
capabilityTypeDefinition.setProperties(propertiesStatus.left().value());
}
- Either<ImmutablePair<CapabilityTypeData, GraphEdge>, TitanOperationStatus> parentNode = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<CapabilityTypeData, GraphEdge>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
log.debug("After retrieving DERIVED_FROM node of {}. status is {}", uniqueId, parentNode);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus != TitanOperationStatus.NOT_FOUND) {
- log.error("Failed to find the parent capability of capability type {}. status is {}", uniqueId, titanOperationStatus);
- result = Either.right(titanOperationStatus);
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus != JanusGraphOperationStatus.NOT_FOUND) {
+ log.error("Failed to find the parent capability of capability type {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
+ result = Either.right(janusGraphOperationStatus);
return result;
}
} else {
@@ -319,9 +324,10 @@
private Either<CapabilityTypeDefinition, StorageOperationStatus> updateCapabilityTypeOnGraph(CapabilityTypeDefinition capabilityTypeDefinitionNew, CapabilityTypeDefinition capabilityTypeDefinitionOld) {
- return titanGenericDao.updateNode(new CapabilityTypeData(capabilityTypeDefinitionNew), CapabilityTypeData.class)
+ return janusGraphGenericDao
+ .updateNode(new CapabilityTypeData(capabilityTypeDefinitionNew), CapabilityTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(updatedNode -> updateProperties(capabilityTypeDefinitionNew.getUniqueId(), capabilityTypeDefinitionNew.getProperties()))
.left()
@@ -336,7 +342,7 @@
log.debug("#updateCapabilityTypeProperties - updating properties for capability type with id {}", capabilityTypeId);
return propertyOperation.mergePropertiesAssociatedToNode(NodeTypeEnum.CapabilityType, capabilityTypeId, properties)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private Either<GraphRelation, StorageOperationStatus> updateDerivedFrom(CapabilityTypeDefinition updatedCapabilityType, String currDerivedFromCapabilityType) {
@@ -408,16 +414,17 @@
public Either<CapabilityTypeDefinition, StorageOperationStatus> getCapabilityType(String uniqueId) {
return getCapabilityType(uniqueId, true);
}
- public Either<Map<String, CapabilityTypeDefinition>, TitanOperationStatus> getAllCapabilityTypes() {
+ public Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes() {
Map<String, CapabilityTypeDefinition> capabilityTypes = new HashMap<>();
- Either<Map<String, CapabilityTypeDefinition>, TitanOperationStatus> result = Either.left(capabilityTypes);
+ Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> result = Either.left(capabilityTypes);
- Either<List<CapabilityTypeData>, TitanOperationStatus> getAllCapabilityTypes =
- titanGenericDao.getByCriteria(NodeTypeEnum.CapabilityType, null, CapabilityTypeData.class);
+ Either<List<CapabilityTypeData>, JanusGraphOperationStatus> getAllCapabilityTypes =
+ janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.CapabilityType, null, CapabilityTypeData.class);
if (getAllCapabilityTypes.isRight()) {
- TitanOperationStatus status = getAllCapabilityTypes.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getAllCapabilityTypes.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(status);
} else {
return result;
@@ -434,12 +441,12 @@
log.trace("Going to fetch data type {}. uid is {}",
capabilityTypeData.getCapabilityTypeDataDefinition().getType(),
capabilityTypeData.getUniqueId());
- Either<CapabilityTypeDefinition, TitanOperationStatus> capabilityTypesByUid =
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypesByUid =
getAndAddPropertiesANdDerivedFrom(capabilityTypeData.getUniqueId(), capabilityTypes);
if (capabilityTypesByUid.isRight()) {
- TitanOperationStatus status = capabilityTypesByUid.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = capabilityTypesByUid.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -473,18 +480,19 @@
return derivedFrom;
}
- private Either<CapabilityTypeDefinition, TitanOperationStatus> getAndAddPropertiesANdDerivedFrom(
+ private Either<CapabilityTypeDefinition, JanusGraphOperationStatus> getAndAddPropertiesANdDerivedFrom(
String uniqueId, Map<String, CapabilityTypeDefinition> capabilityTypeDefinitionMap) {
if (capabilityTypeDefinitionMap.containsKey(uniqueId)) {
return Either.left(capabilityTypeDefinitionMap.get(uniqueId));
}
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypesRes =
- titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId,
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypesRes =
+ janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), uniqueId,
CapabilityTypeData.class);
if (capabilityTypesRes.isRight()) {
- TitanOperationStatus status = capabilityTypesRes.right().value();
+ JanusGraphOperationStatus status = capabilityTypesRes.right().value();
log.debug(DATA_TYPE_CANNOT_BE_FOUND_IN_GRAPH_STATUS_IS, uniqueId, status);
return Either.right(status);
}
@@ -493,10 +501,10 @@
CapabilityTypeDefinition capabilityTypeDefinition =
new CapabilityTypeDefinition(ctData.getCapabilityTypeDataDefinition());
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> propertiesStatus =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> propertiesStatus =
OperationUtils.fillProperties(uniqueId, propertyOperation, NodeTypeEnum.CapabilityType);
- if (propertiesStatus.isRight() && propertiesStatus.right().value() != TitanOperationStatus.OK) {
+ if (propertiesStatus.isRight() && propertiesStatus.right().value() != JanusGraphOperationStatus.OK) {
log.error(FAILED_TO_FETCH_PROPERTIES_OF_DATA_TYPE, uniqueId);
return Either.right(propertiesStatus.right().value());
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CommonTypeOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CommonTypeOperations.java
index 96b0832..768a96e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CommonTypeOperations.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CommonTypeOperations.java
@@ -10,9 +10,9 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.springframework.stereotype.Component;
@@ -20,25 +20,25 @@
@Component
public class CommonTypeOperations {
- private final HealingTitanGenericDao titanGenericDao;
+ private final HealingJanusGraphGenericDao janusGraphGenericDao;
private final PropertyOperation propertyOperation;
private final OperationUtils operationUtils;
- public CommonTypeOperations(HealingTitanGenericDao titanGenericDao, PropertyOperation propertyOperation,
- OperationUtils operationUtils) {
- this.titanGenericDao = titanGenericDao;
+ public CommonTypeOperations(HealingJanusGraphGenericDao janusGraphGenericDao, PropertyOperation propertyOperation,
+ OperationUtils operationUtils) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
this.propertyOperation = propertyOperation;
this.operationUtils = operationUtils;
}
public <T extends GraphNode> void addType(T typeData, Class<T> clazz) {
- titanGenericDao.createNode(typeData, clazz)
+ janusGraphGenericDao.createNode(typeData, clazz)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
}
public <T extends GraphNode> Optional<T> getType(String uniqueId, Class<T> clazz, NodeTypeEnum nodeType) {
- T type = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, clazz)
+ T type = janusGraphGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, clazz)
.left()
.on(err -> null);
return Optional.ofNullable(type);
@@ -48,7 +48,7 @@
Map<String, Object> mapCriteria = new HashMap<>();
mapCriteria.put(GraphPropertiesDictionary.TYPE.getProperty(), type);
mapCriteria.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
- return titanGenericDao.getByCriteria(nodeType, mapCriteria, clazz)
+ return janusGraphGenericDao.getByCriteria(nodeType, mapCriteria, clazz)
.left()
.on(err -> emptyList())
.stream()
@@ -58,13 +58,14 @@
public void addProperties(String uniqueId, NodeTypeEnum nodeType, List<PropertyDefinition> properties) {
propertyOperation.addPropertiesToElementType(uniqueId, nodeType, properties)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
}
public void fillProperties(String uniqueId, NodeTypeEnum nodeType, Consumer<List<PropertyDefinition>> propertySetter) {
- TitanOperationStatus status = propertyOperation.fillPropertiesList(uniqueId, nodeType, propertySetter);
- if (status!=TitanOperationStatus.OK) {
- operationUtils.onTitanOperationFailure(status);
+ JanusGraphOperationStatus
+ status = propertyOperation.fillPropertiesList(uniqueId, nodeType, propertySetter);
+ if (status!= JanusGraphOperationStatus.OK) {
+ operationUtils.onJanusGraphOperationFailure(status);
}
}
@@ -72,13 +73,13 @@
* Handle update of type without dervidedFrom attribute
*/
public <T extends GraphNode> void updateType(T typeData, List<PropertyDefinition> properties, Class<T> clazz, NodeTypeEnum nodeType) {
- titanGenericDao.updateNode(typeData, clazz)
+ janusGraphGenericDao.updateNode(typeData, clazz)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
Map<String, PropertyDefinition> newProperties = properties.stream()
.collect(Collectors.toMap(PropertyDefinition::getName, Function.identity()));
propertyOperation.mergePropertiesAssociatedToNode(nodeType, typeData.getUniqueId(), newProperties)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
index 34dce75..91b4e0a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 java.util.HashMap;
import java.util.Map;
@@ -35,11 +35,11 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -83,10 +83,10 @@
/**
* FOR TEST ONLY
*
- * @param titanGenericDao
+ * @param janusGraphGenericDao
*/
- public void setTitanGenericDao(HealingTitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(HealingJanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@Override
@@ -95,19 +95,20 @@
Either<Integer, StorageOperationStatus> result = null;
try {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
if (graphResult.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graphResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(graphResult.right().value()));
return result;
}
- Either<TitanVertex, TitanOperationStatus> vertexService = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexService = janusGraphGenericDao
+ .getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId);
if (vertexService.isRight()) {
log.debug("failed to fetch vertex of resource instance for id = {}", resourceInstanceId);
- TitanOperationStatus status = vertexService.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = vertexService.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexService.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexService.right().value()));
return result;
}
Vertex vertex = vertexService.left().value();
@@ -130,34 +131,36 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("increaseAndGetResourceInstanceSpecificCounter operation : Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("increaseAndGetResourceInstanceSpecificCounter operation : Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
}
- private void connectAttValueDataToComponentInstanceData(Wrapper<TitanOperationStatus> errorWrapper, ComponentInstanceData compIns, AttributeValueData attValueData) {
+ private void connectAttValueDataToComponentInstanceData(Wrapper<JanusGraphOperationStatus> errorWrapper, ComponentInstanceData compIns, AttributeValueData attValueData) {
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(compIns, attValueData, GraphEdgeLabels.ATTRIBUTE_VALUE, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(compIns, attValueData, GraphEdgeLabels.ATTRIBUTE_VALUE, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
errorWrapper.setInnerElement(operationStatus);
BeEcompErrorManager.getInstance().logInternalFlowError("connectAttValueDataToComponentInstanceData",
"Failed to associate resource instance " + compIns.getUniqueId() + " attribute value " + attValueData.getUniqueId() + " in graph. status is " + operationStatus, ErrorSeverity.ERROR);
}
}
- private void connectAttValueDataToAttData(Wrapper<TitanOperationStatus> errorWrapper, AttributeData attData, AttributeValueData attValueData) {
+ private void connectAttValueDataToAttData(Wrapper<JanusGraphOperationStatus> errorWrapper, AttributeData attData, AttributeValueData attValueData) {
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(attValueData, attData, GraphEdgeLabels.ATTRIBUTE_IMPL, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(attValueData, attData, GraphEdgeLabels.ATTRIBUTE_IMPL, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("connectAttValueDataToAttData",
"Failed to associate attribute value " + attValueData.getUniqueId() + " to attribute " + attData.getUniqueId() + " in graph. status is " + operationStatus, ErrorSeverity.ERROR);
@@ -165,8 +168,8 @@
}
}
- private void createAttributeValueDataNode(ComponentInstanceProperty attributeInstanceProperty, Integer index, Wrapper<TitanOperationStatus> errorWrapper, ComponentInstanceData resourceInstanceData,
- Wrapper<AttributeValueData> attValueDataWrapper) {
+ private void createAttributeValueDataNode(ComponentInstanceProperty attributeInstanceProperty, Integer index, Wrapper<JanusGraphOperationStatus> errorWrapper, ComponentInstanceData resourceInstanceData,
+ Wrapper<AttributeValueData> attValueDataWrapper) {
String valueUniqueUid = attributeInstanceProperty.getValueUniqueUid();
if (valueUniqueUid == null) {
@@ -174,11 +177,12 @@
AttributeValueData attributeValueData = buildAttributeValueDataFromComponentInstanceAttribute(attributeInstanceProperty, attValueDatauniqueId);
log.debug("Before adding attribute value to graph {}", attributeValueData);
- Either<AttributeValueData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(attributeValueData, AttributeValueData.class);
+ Either<AttributeValueData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(attributeValueData, AttributeValueData.class);
log.debug("After adding attribute value to graph {}", attributeValueData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
errorWrapper.setInnerElement(operationStatus);
} else {
attValueDataWrapper.setInnerElement(createNodeResult.left().value());
@@ -186,7 +190,7 @@
} else {
BeEcompErrorManager.getInstance().logInternalFlowError("CreateAttributeValueDataNode", "attribute value already exists.", ErrorSeverity.ERROR);
- errorWrapper.setInnerElement(TitanOperationStatus.ALREADY_EXIST);
+ errorWrapper.setInnerElement(JanusGraphOperationStatus.ALREADY_EXIST);
}
}
@@ -258,10 +262,10 @@
* @param resourceInstanceId
* @return
*/
- private Either<AttributeValueData, TitanOperationStatus> updateAttributeOfResourceInstance(ComponentInstanceProperty resourceInstanceAttribute, String resourceInstanceId) {
+ private Either<AttributeValueData, JanusGraphOperationStatus> updateAttributeOfResourceInstance(ComponentInstanceProperty resourceInstanceAttribute, String resourceInstanceId) {
- Either<AttributeValueData, TitanOperationStatus> result = null;
- Wrapper<TitanOperationStatus> errorWrapper = new Wrapper<>();
+ Either<AttributeValueData, JanusGraphOperationStatus> result = null;
+ Wrapper<JanusGraphOperationStatus> errorWrapper = new Wrapper<>();
UpdateDataContainer<AttributeData, AttributeValueData> updateDataContainer = new UpdateDataContainer<>(GraphEdgeLabels.ATTRIBUTE_IMPL, (() -> AttributeData.class), (() -> AttributeValueData.class), NodeTypeEnum.Attribute,
NodeTypeEnum.AttributeValue);
preUpdateElementOfResourceInstanceValidations(updateDataContainer, resourceInstanceAttribute, resourceInstanceId, errorWrapper);
@@ -269,9 +273,10 @@
AttributeValueData attributeValueData = updateDataContainer.getValueDataWrapper().getInnerElement();
attributeValueData.setHidden(resourceInstanceAttribute.isHidden());
attributeValueData.setValue(resourceInstanceAttribute.getValue());
- Either<AttributeValueData, TitanOperationStatus> updateRes = titanGenericDao.updateNode(attributeValueData, AttributeValueData.class);
+ Either<AttributeValueData, JanusGraphOperationStatus> updateRes = janusGraphGenericDao
+ .updateNode(attributeValueData, AttributeValueData.class);
if (updateRes.isRight()) {
- TitanOperationStatus status = updateRes.right().value();
+ JanusGraphOperationStatus status = updateRes.right().value();
errorWrapper.setInnerElement(status);
} else {
result = Either.left(updateRes.left().value());
@@ -284,8 +289,8 @@
}
- private Either<AttributeValueData, TitanOperationStatus> addAttributeToResourceInstance(ComponentInstanceProperty attributeInstanceProperty, String resourceInstanceId, Integer index) {
- Wrapper<TitanOperationStatus> errorWrapper = new Wrapper<>();
+ private Either<AttributeValueData, JanusGraphOperationStatus> addAttributeToResourceInstance(ComponentInstanceProperty attributeInstanceProperty, String resourceInstanceId, Integer index) {
+ Wrapper<JanusGraphOperationStatus> errorWrapper = new Wrapper<>();
Wrapper<ComponentInstanceData> compInsWrapper = new Wrapper<>();
Wrapper<AttributeData> attDataWrapper = new Wrapper<>();
Wrapper<AttributeValueData> attValueDataWrapper = new Wrapper<>();
@@ -320,7 +325,7 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void preUpdateElementOfResourceInstanceValidations(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer, IComponentInstanceConnectedElement resourceInstanceProerty,
- String resourceInstanceId, Wrapper<TitanOperationStatus> errorWrapper) {
+ String resourceInstanceId, Wrapper<JanusGraphOperationStatus> errorWrapper) {
if (errorWrapper.isEmpty()) {
// Verify VFC instance Exist
@@ -344,14 +349,15 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void validateElementConnectedToInstance(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer, IComponentInstanceConnectedElement resourceInstanceProerty,
- Wrapper<TitanOperationStatus> errorWrapper) {
- Either<ImmutablePair<SomeData, GraphEdge>, TitanOperationStatus> child = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), resourceInstanceProerty.getValueUniqueUid(),
+ Wrapper<JanusGraphOperationStatus> errorWrapper) {
+ Either<ImmutablePair<SomeData, GraphEdge>, JanusGraphOperationStatus> child = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), resourceInstanceProerty.getValueUniqueUid(),
updateDataContainer.getGraphEdge(), updateDataContainer.getNodeType(), updateDataContainer.getSomeDataClassGen().get());
if (child.isRight()) {
- TitanOperationStatus status = child.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = child.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
@@ -361,16 +367,17 @@
}
private <SomeValueData extends GraphNode, SomeData extends GraphNode> void validateElementConnectedToComponentInstanceExist(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer,
- IComponentInstanceConnectedElement resourceInstanceProerty, Wrapper<TitanOperationStatus> errorWrapper) {
+ IComponentInstanceConnectedElement resourceInstanceProerty, Wrapper<JanusGraphOperationStatus> errorWrapper) {
String valueUniqueUid = resourceInstanceProerty.getValueUniqueUid();
if (valueUniqueUid == null) {
- errorWrapper.setInnerElement(TitanOperationStatus.INVALID_ID);
+ errorWrapper.setInnerElement(JanusGraphOperationStatus.INVALID_ID);
} else {
- Either<SomeValueData, TitanOperationStatus> findPropertyValueRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), valueUniqueUid, updateDataContainer.getSomeValueDataClassGen().get());
+ Either<SomeValueData, JanusGraphOperationStatus> findPropertyValueRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), valueUniqueUid, updateDataContainer.getSomeValueDataClassGen().get());
if (findPropertyValueRes.isRight()) {
- TitanOperationStatus status = findPropertyValueRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findPropertyValueRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
} else {
@@ -380,31 +387,33 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void validateElementConnectedToComponentExist(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer,
- IComponentInstanceConnectedElement resourceInstanceElementConnected, Wrapper<TitanOperationStatus> errorWrapper) {
+ IComponentInstanceConnectedElement resourceInstanceElementConnected, Wrapper<JanusGraphOperationStatus> errorWrapper) {
String uniqueId = resourceInstanceElementConnected.getUniqueId();
- Either<SomeData, TitanOperationStatus> findPropertyDefRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeType()), uniqueId, updateDataContainer.getSomeDataClassGen().get());
+ Either<SomeData, JanusGraphOperationStatus> findPropertyDefRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeType()), uniqueId, updateDataContainer.getSomeDataClassGen().get());
if (findPropertyDefRes.isRight()) {
- TitanOperationStatus status = findPropertyDefRes.right().value();
+ JanusGraphOperationStatus status = findPropertyDefRes.right().value();
errorWrapper.setInnerElement(status);
}
}
- private void validateRIExist(String resourceInstanceId, Wrapper<TitanOperationStatus> errorWrapper) {
+ private void validateRIExist(String resourceInstanceId, Wrapper<JanusGraphOperationStatus> errorWrapper) {
validateRIExist(resourceInstanceId, null, errorWrapper);
}
- private void validateRIExist(String resourceInstanceId, Wrapper<ComponentInstanceData> compInsDataWrapper, Wrapper<TitanOperationStatus> errorWrapper) {
+ private void validateRIExist(String resourceInstanceId, Wrapper<ComponentInstanceData> compInsDataWrapper, Wrapper<JanusGraphOperationStatus> errorWrapper) {
validateElementExistInGraph(resourceInstanceId, NodeTypeEnum.ResourceInstance, () -> ComponentInstanceData.class, compInsDataWrapper, errorWrapper);
}
public <ElementData extends GraphNode> void validateElementExistInGraph(String elementUniqueId, NodeTypeEnum elementNodeType, Supplier<Class<ElementData>> elementClassGen, Wrapper<ElementData> elementDataWrapper,
- Wrapper<TitanOperationStatus> errorWrapper) {
- Either<ElementData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(elementNodeType), elementUniqueId, elementClassGen.get());
+ Wrapper<JanusGraphOperationStatus> errorWrapper) {
+ Either<ElementData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(elementNodeType), elementUniqueId, elementClassGen.get());
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
} else {
@@ -421,25 +430,27 @@
* @param index
* @return
*/
- private Either<InputValueData, TitanOperationStatus> addInputToResourceInstance(ComponentInstanceInput resourceInstanceInput, String resourceInstanceId, Integer index) {
+ private Either<InputValueData, JanusGraphOperationStatus> addInputToResourceInstance(ComponentInstanceInput resourceInstanceInput, String resourceInstanceId, Integer index) {
- Either<ComponentInstanceData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId, ComponentInstanceData.class);
+ Either<ComponentInstanceData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId, ComponentInstanceData.class);
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
String propertyId = resourceInstanceInput.getUniqueId();
- Either<InputsData, TitanOperationStatus> findPropertyDefRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Input), propertyId, InputsData.class);
+ Either<InputsData, JanusGraphOperationStatus> findPropertyDefRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Input), propertyId, InputsData.class);
if (findPropertyDefRes.isRight()) {
- TitanOperationStatus status = findPropertyDefRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findPropertyDefRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -451,13 +462,13 @@
ComponentInstanceData resourceInstanceData = findResInstanceRes.left().value();
- ImmutablePair<TitanOperationStatus, String> isInputValueExists = inputOperation.findInputValue(resourceInstanceId, propertyId);
- if (isInputValueExists.getLeft() == TitanOperationStatus.ALREADY_EXIST) {
+ ImmutablePair<JanusGraphOperationStatus, String> isInputValueExists = inputOperation.findInputValue(resourceInstanceId, propertyId);
+ if (isInputValueExists.getLeft() == JanusGraphOperationStatus.ALREADY_EXIST) {
log.debug("The property {} already added to the resource instance {}", propertyId, resourceInstanceId);
resourceInstanceInput.setValueUniqueUid(isInputValueExists.getRight());
}
- if (isInputValueExists.getLeft() != TitanOperationStatus.NOT_FOUND) {
+ if (isInputValueExists.getLeft() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("After finding input value of {} on componenet instance {}", propertyId, resourceInstanceId);
return Either.right(isInputValueExists.getLeft());
}
@@ -473,20 +484,20 @@
SchemaDefinition def = propDataDef.getSchema();
if (def == null) {
log.debug("Schema doesn't exists for property of type {}", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
PropertyDataDefinition propDef = def.getProperty();
if (propDef == null) {
log.debug("Property in Schema Definition inside property of type {} doesn't exist", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
innerType = propDef.getType();
}
log.debug("Before validateAndUpdatePropertyValue");
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
return Either.right(status);
}
@@ -501,21 +512,23 @@
log.debug("After validateAndUpdateRules. pair = {} ", pair);
if (pair.getRight() != null && !pair.getRight()) {
BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), resourceInstanceInput.getName(), propertyType);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
log.debug("Before adding property value to graph {}", propertyValueData);
- Either<InputValueData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyValueData, InputValueData.class);
+ Either<InputValueData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(propertyValueData, InputValueData.class);
log.debug("After adding property value to graph {}", propertyValueData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
return Either.right(operationStatus);
}
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(propertyValueData, propertyData, GraphEdgeLabels.INPUT_IMPL, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(propertyValueData, propertyData, GraphEdgeLabels.INPUT_IMPL, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate property value {} to property {} in graph. status is {}", uniqueId, propertyId, operationStatus);
return Either.right(operationStatus);
}
@@ -525,10 +538,11 @@
properties1.put(GraphEdgePropertiesDictionary.NAME.getProperty(), resourceInstanceData.getComponentInstDataDefinition().getName());
properties1.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), resourceInstanceData.getComponentInstDataDefinition().getUniqueId());
- createRelResult = titanGenericDao.createRelation(resourceInstanceData, propertyValueData, GraphEdgeLabels.INPUT_VALUE, properties1);
+ createRelResult = janusGraphGenericDao
+ .createRelation(resourceInstanceData, propertyValueData, GraphEdgeLabels.INPUT_VALUE, properties1);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to associate resource instance {} property value {} in graph. status is {}", resourceInstanceId, uniqueId, operationStatus);
return Either.right(operationStatus);
@@ -537,7 +551,7 @@
return Either.left(createNodeResult.left().value());
} else {
log.error("property value already exists.");
- return Either.right(TitanOperationStatus.ALREADY_EXIST);
+ return Either.right(JanusGraphOperationStatus.ALREADY_EXIST);
}
}
@@ -548,11 +562,11 @@
try {
- Either<AttributeValueData, TitanOperationStatus> eitherStatus = this.addAttributeToResourceInstance(resourceInstanceAttribute, resourceInstanceId, index);
+ Either<AttributeValueData, JanusGraphOperationStatus> eitherStatus = this.addAttributeToResourceInstance(resourceInstanceAttribute, resourceInstanceId, index);
if (eitherStatus.isRight()) {
log.error("Failed to add attribute value {} to resource instance {} in Graph. status is {}", resourceInstanceAttribute, resourceInstanceId, eitherStatus.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
return result;
} else {
AttributeValueData attributeValueData = eitherStatus.left().value();
@@ -582,11 +596,11 @@
Either<ComponentInstanceProperty, StorageOperationStatus> result = null;
try {
- Either<AttributeValueData, TitanOperationStatus> eitherAttributeValue = updateAttributeOfResourceInstance(resourceInstanceAttribute, resourceInstanceId);
+ Either<AttributeValueData, JanusGraphOperationStatus> eitherAttributeValue = updateAttributeOfResourceInstance(resourceInstanceAttribute, resourceInstanceId);
if (eitherAttributeValue.isRight()) {
log.error("Failed to add attribute value {} to resource instance {} in Graph. status is {}", resourceInstanceAttribute, resourceInstanceId, eitherAttributeValue.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherAttributeValue.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherAttributeValue.right().value()));
return result;
} else {
AttributeValueData attributeValueData = eitherAttributeValue.left().value();
@@ -618,11 +632,11 @@
try {
- Either<InputValueData, TitanOperationStatus> eitherStatus = addInputToResourceInstance(resourceInstanceInput, resourceInstanceId, index);
+ Either<InputValueData, JanusGraphOperationStatus> eitherStatus = addInputToResourceInstance(resourceInstanceInput, resourceInstanceId, index);
if (eitherStatus.isRight()) {
log.error("Failed to add input value {} to resource instance {} in Graph. status is {}", resourceInstanceInput, resourceInstanceId, eitherStatus.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
return result;
} else {
InputValueData propertyValueData = eitherStatus.left().value();
@@ -630,9 +644,9 @@
ComponentInstanceInput propertyValueResult = inputOperation.buildResourceInstanceInput(propertyValueData, resourceInstanceInput);
log.debug("The returned ResourceInstanceProperty is {}", propertyValueResult);
- Either<String, TitanOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(resourceInstanceInput.getPath(), resourceInstanceInput.getUniqueId(), resourceInstanceInput.getDefaultValue());
+ Either<String, JanusGraphOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(resourceInstanceInput.getPath(), resourceInstanceInput.getUniqueId(), resourceInstanceInput.getDefaultValue());
if (findDefaultValue.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findDefaultValue.right().value()));
return result;
}
String defaultValue = findDefaultValue.left().value();
@@ -648,10 +662,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -665,13 +679,13 @@
@Override
public StorageOperationStatus updateCustomizationUUID(String componentInstanceId) {
- Either<TitanVertex, TitanOperationStatus> vertexByProperty = titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), componentInstanceId);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexByProperty = janusGraphGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), componentInstanceId);
if (vertexByProperty.isRight()) {
log.debug("Failed to fetch component instance by id {} error {}", componentInstanceId, vertexByProperty.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(vertexByProperty.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexByProperty.right().value());
}
UUID uuid = UUID.randomUUID();
- TitanVertex ciVertex = vertexByProperty.left().value();
+ JanusGraphVertex ciVertex = vertexByProperty.left().value();
ciVertex.property(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty(), uuid.toString());
return StorageOperationStatus.OK;
@@ -686,10 +700,11 @@
ComponentInstanceData componentData = new ComponentInstanceData(componentInstance, componentInstance.getGroupInstances().size());
componentData.getComponentInstDataDefinition().setModificationTime(modificationTime);
componentData.getComponentInstDataDefinition().setCustomizationUUID(UUID.randomUUID().toString());
- Either<ComponentInstanceData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(componentData, ComponentInstanceData.class);
+ Either<ComponentInstanceData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(componentData, ComponentInstanceData.class);
if (updateNode.isRight()) {
log.error("Failed to update resource {}. status is {}", componentInstance.getUniqueId(), updateNode.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateNode.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateNode.right().value()));
}else{
result = Either.left(updateNode.left().value());
}
@@ -700,10 +715,10 @@
if(!inTransaction){
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ConsumerOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ConsumerOperation.java
index c173b59..b429071 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ConsumerOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ConsumerOperation.java
@@ -21,9 +21,9 @@
package org.openecomp.sdc.be.model.operations.impl;
import fj.data.Either;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
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.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.operations.api.IConsumerOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -38,23 +38,25 @@
@Component("consumer-operation")
public class ConsumerOperation implements IConsumerOperation {
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
private static final Logger log = Logger.getLogger(ConsumerOperation.class.getName());
- public ConsumerOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public ConsumerOperation(@Qualifier("janusgraph-generic-dao")
+ JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@Override
public Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName) {
Either<ConsumerData, StorageOperationStatus> result = null;
log.debug("retriving Credentials for: {}", consumerName);
- Either<ConsumerData, TitanOperationStatus> getNode = titanGenericDao.getNode(GraphPropertiesDictionary.CONSUMER_NAME.getProperty(), consumerName, ConsumerData.class);
+ Either<ConsumerData, JanusGraphOperationStatus> getNode = janusGraphGenericDao
+ .getNode(GraphPropertiesDictionary.CONSUMER_NAME.getProperty(), consumerName, ConsumerData.class);
if (getNode.isRight()) {
- TitanOperationStatus status = getNode.right().value();
+ JanusGraphOperationStatus status = getNode.right().value();
log.error("Error returned after get Consumer Data node {}. status returned is {}", consumerName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
ConsumerData consumerData = getNode.left().value();
@@ -64,8 +66,9 @@
@Override
public Either<List<ConsumerData>, StorageOperationStatus> getAll() {
log.debug("retrieving all consumers");
- return titanGenericDao.getByCriteria(NodeTypeEnum.ConsumerCredentials, Collections.emptyMap(), ConsumerData.class)
- .right().map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ return janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.ConsumerCredentials, Collections.emptyMap(), ConsumerData.class)
+ .right().map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
@Override
@@ -78,11 +81,12 @@
Either<ConsumerData, StorageOperationStatus> result = null;
try {
log.debug("creating Credentials for: {}", consumerData.getUniqueId());
- Either<ConsumerData, TitanOperationStatus> createNode = titanGenericDao.createNode(consumerData, ConsumerData.class);
+ Either<ConsumerData, JanusGraphOperationStatus> createNode = janusGraphGenericDao
+ .createNode(consumerData, ConsumerData.class);
if (createNode.isRight()) {
- TitanOperationStatus status = createNode.right().value();
+ JanusGraphOperationStatus status = createNode.right().value();
log.error("Error returned after creating Consumer Data node {}. status returned is {}", consumerData.getUniqueId(), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
ConsumerData createdConsumerData = createNode.left().value();
@@ -103,11 +107,12 @@
Either<ConsumerData, StorageOperationStatus> result = null;
try {
log.debug("delete Credentials for: {}", consumerName);
- Either<ConsumerData, TitanOperationStatus> deleteNode = titanGenericDao.deleteNode(GraphPropertiesDictionary.CONSUMER_NAME.getProperty(), consumerName, ConsumerData.class);
+ Either<ConsumerData, JanusGraphOperationStatus> deleteNode = janusGraphGenericDao
+ .deleteNode(GraphPropertiesDictionary.CONSUMER_NAME.getProperty(), consumerName, ConsumerData.class);
if (deleteNode.isRight()) {
- TitanOperationStatus status = deleteNode.right().value();
+ JanusGraphOperationStatus status = deleteNode.right().value();
log.error("Error returned after delete Consumer Data node {}. status returned is {}", consumerName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
@@ -131,11 +136,12 @@
Either<ConsumerData, StorageOperationStatus> result = null;
try {
log.debug("update Credentials for: {}", consumerData.getUniqueId());
- Either<ConsumerData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(consumerData, ConsumerData.class);
+ Either<ConsumerData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(consumerData, ConsumerData.class);
if (updateNode.isRight()) {
- TitanOperationStatus status = updateNode.right().value();
+ JanusGraphOperationStatus status = updateNode.right().value();
log.error("Error returned after delete Consumer Data node {}. status returned is {}", consumerData.getUniqueId(), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
ConsumerData updatedConsumerData = updateNode.left().value();
@@ -150,10 +156,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
index a66dce1..bce7a2a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
@@ -21,18 +21,18 @@
package org.openecomp.sdc.be.model.operations.impl;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
public class DaoStatusConverter {
- public static StorageOperationStatus convertTitanStatusToStorageStatus(TitanOperationStatus titanStatus) {
+ public static StorageOperationStatus convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus janusGraphStatus) {
- if (titanStatus == null) {
+ if (janusGraphStatus == null) {
return StorageOperationStatus.GENERAL_ERROR;
}
- switch (titanStatus) {
+ switch (janusGraphStatus) {
case OK:
return StorageOperationStatus.OK;
@@ -54,7 +54,7 @@
case ALREADY_LOCKED:
return StorageOperationStatus.FAILED_TO_LOCK_ELEMENT;
- case TITAN_SCHEMA_VIOLATION:
+ case JANUSGRAPH_SCHEMA_VIOLATION:
return StorageOperationStatus.SCHEMA_VIOLATION;
case INVALID_ID:
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java
index 6f95558..e39f4b8 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java
@@ -6,10 +6,10 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.operations.api.DerivedFromOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -24,27 +24,28 @@
public class DefaultDerivedFromOperation implements DerivedFromOperation {
private static final Logger log = Logger.getLogger(DefaultDerivedFromOperation.class.getName());
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public DefaultDerivedFromOperation(TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public DefaultDerivedFromOperation(JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@Override
public Either<GraphRelation, StorageOperationStatus> addDerivedFromRelation(String parentUniqueId, String derivedFromUniqueId, NodeTypeEnum nodeType) {
UniqueIdData from = new UniqueIdData(nodeType, parentUniqueId);
UniqueIdData to = new UniqueIdData(nodeType, derivedFromUniqueId);
- return titanGenericDao.createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null)
+ return janusGraphGenericDao.createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
@Override
public <T extends GraphNode> Either<T, StorageOperationStatus> getDerivedFromChild(String uniqueId, NodeTypeEnum nodeType, Class<T> clazz) {
log.debug("#getDerivedFromChild - fetching derived from entity for node type {} with id {}", nodeType, uniqueId);
- return titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.DERIVED_FROM, nodeType, clazz)
+ return janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.DERIVED_FROM, nodeType, clazz)
.bimap(Pair::getKey,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
@Override
@@ -53,19 +54,19 @@
UniqueIdData to = new UniqueIdData(nodeType, derivedFromUniqueId);
return isDerivedFromExists(from, to)
.either(isRelationExist -> isRelationExist ? deleteDerivedFrom(from, to) : StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private StorageOperationStatus deleteDerivedFrom(UniqueIdData from, UniqueIdData to) {
- return titanGenericDao.deleteRelation(from, to, GraphEdgeLabels.DERIVED_FROM)
+ return janusGraphGenericDao.deleteRelation(from, to, GraphEdgeLabels.DERIVED_FROM)
.either(deletedRelation -> StorageOperationStatus.OK,
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
- private Either<Boolean, TitanOperationStatus> isDerivedFromExists(UniqueIdData from, UniqueIdData to) {
- return titanGenericDao.isRelationExist(from, to, GraphEdgeLabels.DERIVED_FROM);
+ private Either<Boolean, JanusGraphOperationStatus> isDerivedFromExists(UniqueIdData from, UniqueIdData to) {
+ return janusGraphGenericDao.isRelationExist(from, to, GraphEdgeLabels.DERIVED_FROM);
}
@Override
@@ -74,11 +75,14 @@
Map<String, Object> propertiesToMatch = new HashMap<>();
propertiesToMatch.put(GraphPropertiesDictionary.TYPE.getProperty(), childCandidateType);
- Either<List<T>, TitanOperationStatus> getResponse = titanGenericDao.getByCriteria(nodeType, propertiesToMatch, clazz);
+ Either<List<T>, JanusGraphOperationStatus> getResponse = janusGraphGenericDao
+ .getByCriteria(nodeType, propertiesToMatch, clazz);
if (getResponse.isRight()) {
- TitanOperationStatus titanOperationStatus = getResponse.right().value();
- log.debug("Couldn't fetch type {}, error: {}", childCandidateType, titanOperationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ JanusGraphOperationStatus janusGraphOperationStatus = getResponse.right().value();
+ log.debug("Couldn't fetch type {}, error: {}", childCandidateType,
+ janusGraphOperationStatus);
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
}
T node = getResponse.left().value().get(0);
String childUniqueId = node.getUniqueId();
@@ -91,13 +95,16 @@
do {
travelledTypes.add(childType);
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), childUniqueId, GraphEdgeLabels.DERIVED_FROM,
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), childUniqueId, GraphEdgeLabels.DERIVED_FROM,
nodeType, clazz);
if (childrenNodes.isRight()) {
- if (childrenNodes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus titanOperationStatus = getResponse.right().value();
- log.debug("Couldn't fetch derived from node for type {}, error: {}", childCandidateType, titanOperationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ if (childrenNodes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = getResponse.right().value();
+ log.debug("Couldn't fetch derived from node for type {}, error: {}", childCandidateType,
+ janusGraphOperationStatus);
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
} else {
log.debug("Derived from node is not found for type {} - this is OK for root capability.", childCandidateType);
return Either.left(false);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
index fd455bc..ce9d320 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -31,10 +31,10 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.category.CategoryDataDefinition;
import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition;
import org.openecomp.sdc.be.datatypes.category.SubCategoryDataDefinition;
@@ -62,13 +62,14 @@
@Component("element-operation")
public class ElementOperation implements IElementOperation {
- private static final String COULDN_T_FETCH_TITAN_GRAPH = "Couldn't fetch titan graph";
+ private static final String COULDN_T_FETCH_janusGraph_GRAPH = "Couldn't fetch janusgraph graph";
private static final String UNKNOWN_CATEGORY_TYPE = "Unknown category type {}";
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public ElementOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) {
+ public ElementOperation(@Qualifier("janusgraph-generic-dao")
+ JanusGraphGenericDao janusGraphGenericDao) {
super();
- this.titanGenericDao = titanGenericDao;
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
private static final Logger log = Logger.getLogger(ElementOperation.class.getName());
@@ -109,12 +110,13 @@
CategoryData categoryData = new CategoryData(nodeType, category);
try {
- Either<CategoryData, TitanOperationStatus> createNode = titanGenericDao.createNode(categoryData, CategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> createNode = janusGraphGenericDao
+ .createNode(categoryData, CategoryData.class);
if (createNode.isRight()) {
- TitanOperationStatus value = createNode.right().value();
+ JanusGraphOperationStatus value = createNode.right().value();
ActionStatus actionStatus = ActionStatus.GENERAL_ERROR;
log.debug("Problem while creating category, reason {}", value);
- if (value == TitanOperationStatus.TITAN_SCHEMA_VIOLATION) {
+ if (value == JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION) {
actionStatus = ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS;
}
result = Either.right(actionStatus);
@@ -126,9 +128,9 @@
} finally {
if (!inTransaction) {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
}
@@ -146,12 +148,13 @@
try {
// create edge from category to sub-category
- Either<CategoryData, TitanOperationStatus> categoryNode = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> categoryNode = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
ActionStatus actionStatus = ActionStatus.GENERAL_ERROR;
if (categoryNode.isRight()) {
- TitanOperationStatus titanOperationStatus = categoryNode.right().value();
- log.debug("Problem while fetching category, reason {}", titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = categoryNode.right().value();
+ log.debug("Problem while fetching category, reason {}", janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
actionStatus = ActionStatus.COMPONENT_CATEGORY_NOT_FOUND;
}
result = Either.right(actionStatus);
@@ -162,18 +165,20 @@
subCategory.setUniqueId(UniqueIdBuilder.buildSubCategoryUid(categoryDataDefinition.getUniqueId(), subCategory.getNormalizedName()));
SubCategoryData subCategoryData = new SubCategoryData(nodeType, subCategory);
- Either<SubCategoryData, TitanOperationStatus> subCategoryNode = titanGenericDao.createNode(subCategoryData, SubCategoryData.class);
+ Either<SubCategoryData, JanusGraphOperationStatus> subCategoryNode = janusGraphGenericDao
+ .createNode(subCategoryData, SubCategoryData.class);
if (subCategoryNode.isRight()) {
- TitanOperationStatus titanOperationStatus = subCategoryNode.right().value();
- log.debug("Problem while creating category, reason {}", titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.TITAN_SCHEMA_VIOLATION) {
+ JanusGraphOperationStatus janusGraphOperationStatus = subCategoryNode.right().value();
+ log.debug("Problem while creating category, reason {}", janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION) {
actionStatus = ActionStatus.COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY;
}
result = Either.right(actionStatus);
return result;
}
- Either<GraphRelation, TitanOperationStatus> relation = titanGenericDao.createRelation(categoryNode.left().value(), subCategoryNode.left().value(), GraphEdgeLabels.SUB_CATEGORY, null);
+ Either<GraphRelation, JanusGraphOperationStatus> relation = janusGraphGenericDao
+ .createRelation(categoryNode.left().value(), subCategoryNode.left().value(), GraphEdgeLabels.SUB_CATEGORY, null);
if (relation.isRight()) {
log.debug("Problem while create relation between category and sub-category ", relation.right().value());
result = Either.right(actionStatus);
@@ -185,9 +190,9 @@
} finally {
if (!inTransaction) {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
}
@@ -200,12 +205,13 @@
try {
// create edge from sub-category to grouping
- Either<SubCategoryData, TitanOperationStatus> subCategoryNode = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
+ Either<SubCategoryData, JanusGraphOperationStatus> subCategoryNode = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
ActionStatus actionStatus = ActionStatus.GENERAL_ERROR;
if (subCategoryNode.isRight()) {
- TitanOperationStatus titanOperationStatus = subCategoryNode.right().value();
- log.debug("Problem while fetching category, reason {}", titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.TITAN_SCHEMA_VIOLATION) {
+ JanusGraphOperationStatus janusGraphOperationStatus = subCategoryNode.right().value();
+ log.debug("Problem while fetching category, reason {}", janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION) {
actionStatus = ActionStatus.COMPONENT_CATEGORY_NOT_FOUND;
}
result = Either.right(actionStatus);
@@ -216,18 +222,20 @@
grouping.setUniqueId(UniqueIdBuilder.buildGroupingUid(subCatData.getUniqueId(), grouping.getNormalizedName()));
GroupingData groupingData = new GroupingData(nodeType, grouping);
- Either<GroupingData, TitanOperationStatus> groupingNode = titanGenericDao.createNode(groupingData, GroupingData.class);
+ Either<GroupingData, JanusGraphOperationStatus> groupingNode = janusGraphGenericDao
+ .createNode(groupingData, GroupingData.class);
if (groupingNode.isRight()) {
- TitanOperationStatus titanOperationStatus = groupingNode.right().value();
- log.debug("Problem while creating grouping, reason {}", titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = groupingNode.right().value();
+ log.debug("Problem while creating grouping, reason {}", janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
actionStatus = ActionStatus.COMPONENT_GROUPING_EXISTS_FOR_SUB_CATEGORY;
}
result = Either.right(actionStatus);
return result;
}
- Either<GraphRelation, TitanOperationStatus> relation = titanGenericDao.createRelation(subCategoryNode.left().value(), groupingNode.left().value(), GraphEdgeLabels.GROUPING, null);
+ Either<GraphRelation, JanusGraphOperationStatus> relation = janusGraphGenericDao
+ .createRelation(subCategoryNode.left().value(), groupingNode.left().value(), GraphEdgeLabels.GROUPING, null);
if (relation.isRight()) {
log.debug("Problem while create relation between sub-category and grouping", relation.right().value());
result = Either.right(actionStatus);
@@ -238,9 +246,9 @@
return result;
} finally {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
}
@@ -253,8 +261,9 @@
return Either.right(ActionStatus.GENERAL_ERROR);
}
- Either<List<org.openecomp.sdc.be.resources.data.category.CategoryData>, TitanOperationStatus> either = titanGenericDao.getAll(nodeType, org.openecomp.sdc.be.resources.data.category.CategoryData.class);
- if (either.isRight() && (either.right().value() != TitanOperationStatus.NOT_FOUND)) {
+ Either<List<org.openecomp.sdc.be.resources.data.category.CategoryData>, JanusGraphOperationStatus> either = janusGraphGenericDao
+ .getAll(nodeType, org.openecomp.sdc.be.resources.data.category.CategoryData.class);
+ if (either.isRight() && (either.right().value() != JanusGraphOperationStatus.NOT_FOUND)) {
log.debug("Problem while get all categories. reason - {}", either.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -267,8 +276,9 @@
CategoryDefinition categoryDefinition = new CategoryDefinition(categoryDataDefinition);
String categoryName = categoryDataDefinition.getName();
log.trace("Found category {}, category type {}", categoryName, nodeType);
- TitanOperationStatus setSubCategories = setSubCategories(nodeType, categoryDefinition);
- if (setSubCategories != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ setSubCategories = setSubCategories(nodeType, categoryDefinition);
+ if (setSubCategories != JanusGraphOperationStatus.OK) {
log.debug("Failed to set sub-categories for category {}, category type {}, error {}", categoryName, nodeType, setSubCategories);
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -278,25 +288,26 @@
return Either.left(categoryList);
} finally {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
- private TitanOperationStatus setSubCategories(NodeTypeEnum parentNodeType, CategoryDefinition parentCategory) {
+ private JanusGraphOperationStatus setSubCategories(NodeTypeEnum parentNodeType, CategoryDefinition parentCategory) {
NodeTypeEnum childNodeType = getChildNodeType(parentNodeType);
if (childNodeType != null) {
String categoryName = parentCategory.getName();
log.trace("Getting sub-categories for category {}, category type {}", categoryName, parentNodeType);
- Either<List<ImmutablePair<SubCategoryData, GraphEdge>>, TitanOperationStatus> parentNode = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentCategory.getUniqueId(), GraphEdgeLabels.SUB_CATEGORY,
+ Either<List<ImmutablePair<SubCategoryData, GraphEdge>>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentCategory.getUniqueId(), GraphEdgeLabels.SUB_CATEGORY,
childNodeType, SubCategoryData.class);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
log.trace("Didn't find subcategories for category {}, category type {}", categoryName, parentNodeType);
- titanOperationStatus = TitanOperationStatus.OK;
+ janusGraphOperationStatus = JanusGraphOperationStatus.OK;
}
- return titanOperationStatus;
+ return janusGraphOperationStatus;
}
List<ImmutablePair<SubCategoryData, GraphEdge>> subsCategoriesData = parentNode.left().value();
List<SubCategoryDefinition> subCategoriesDefinitions = new ArrayList<>();
@@ -305,32 +316,34 @@
SubCategoryDefinition subCategoryDefinition = new SubCategoryDefinition(subCategoryDataDefinition);
log.trace("Found sub-category {} for category {}, category type {}", subCategoryDataDefinition.getName(), categoryName, parentNodeType);
- TitanOperationStatus setGroupings = setGroupings(childNodeType, subCategoryDefinition);
- if (setGroupings != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ setGroupings = setGroupings(childNodeType, subCategoryDefinition);
+ if (setGroupings != JanusGraphOperationStatus.OK) {
log.debug("Failed to set groupings for sub-category {}, sub-category type {}, error {}", subCategoryDataDefinition.getName(), childNodeType, setGroupings);
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
subCategoriesDefinitions.add(subCategoryDefinition);
}
parentCategory.setSubcategories(subCategoriesDefinitions);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus setGroupings(NodeTypeEnum parentNodeType, SubCategoryDefinition parentSubCategory) {
+ private JanusGraphOperationStatus setGroupings(NodeTypeEnum parentNodeType, SubCategoryDefinition parentSubCategory) {
NodeTypeEnum childNodeType = getChildNodeType(parentNodeType);
if (childNodeType != null) {
String subCategoryName = parentSubCategory.getName();
log.trace("Getting groupings for subcategory {}, subcategory type {}", subCategoryName, parentNodeType);
- Either<List<ImmutablePair<GroupingData, GraphEdge>>, TitanOperationStatus> parentNode = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentSubCategory.getUniqueId(), GraphEdgeLabels.GROUPING,
+ Either<List<ImmutablePair<GroupingData, GraphEdge>>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentSubCategory.getUniqueId(), GraphEdgeLabels.GROUPING,
childNodeType, GroupingData.class);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
log.trace("Didn't find groupings for subcategory {}, subcategory type {}", subCategoryName, parentNodeType);
- titanOperationStatus = TitanOperationStatus.OK;
+ janusGraphOperationStatus = JanusGraphOperationStatus.OK;
}
- return titanOperationStatus;
+ return janusGraphOperationStatus;
}
List<ImmutablePair<GroupingData, GraphEdge>> groupingData = parentNode.left().value();
List<GroupingDefinition> groupingDefinitions = new ArrayList<>();
@@ -341,7 +354,7 @@
}
parentSubCategory.setGroupings(groupingDefinitions);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private static NodeTypeEnum getChildNodeType(NodeTypeEnum parentTypeEnum) {
@@ -370,11 +383,13 @@
return Either.right(ActionStatus.GENERAL_ERROR);
}
- Either<CategoryData, TitanOperationStatus> categoryDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> categoryDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
if (categoryDataEither.isRight()) {
- TitanOperationStatus titanOperationStatus = categoryDataEither.right().value();
- log.debug("Problem while get category by id {}. reason {}", categoryId, titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = categoryDataEither.right().value();
+ log.debug("Problem while get category by id {}. reason {}", categoryId,
+ janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(ActionStatus.COMPONENT_CATEGORY_NOT_FOUND);
}
return Either.right(ActionStatus.GENERAL_ERROR);
@@ -382,7 +397,7 @@
CategoryDataDefinition categoryDataDefinition = categoryDataEither.left().value().getCategoryDataDefinition();
return Either.left(new CategoryDefinition(categoryDataDefinition));
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -394,11 +409,13 @@
return Either.right(ActionStatus.GENERAL_ERROR);
}
- Either<SubCategoryData, TitanOperationStatus> subCategoryDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
+ Either<SubCategoryData, JanusGraphOperationStatus> subCategoryDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
if (subCategoryDataEither.isRight()) {
- TitanOperationStatus titanOperationStatus = subCategoryDataEither.right().value();
- log.debug("Problem while get sub-category by id {}. reason {}", subCategoryId, titanOperationStatus);
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = subCategoryDataEither.right().value();
+ log.debug("Problem while get sub-category by id {}. reason {}", subCategoryId,
+ janusGraphOperationStatus);
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(ActionStatus.COMPONENT_CATEGORY_NOT_FOUND);
}
return Either.right(ActionStatus.GENERAL_ERROR);
@@ -406,7 +423,7 @@
SubCategoryDataDefinition subCategoryDataDefinition = subCategoryDataEither.left().value().getSubCategoryDataDefinition();
return Either.left(new SubCategoryDefinition(subCategoryDataDefinition));
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -419,24 +436,25 @@
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<CategoryData, TitanOperationStatus> categoryDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> categoryDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId, CategoryData.class);
if (categoryDataEither.isRight()) {
log.debug("Failed to retrieve category for id {} ", categoryId);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
- log.debug(COULDN_T_FETCH_TITAN_GRAPH);
+ log.debug(COULDN_T_FETCH_janusGraph_GRAPH);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- Iterable<TitanVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId).vertices();
- Iterator<TitanVertex> iterator = verticesArtifact.iterator();
+ Iterable<JanusGraphVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), categoryId).vertices();
+ Iterator<JanusGraphVertex> iterator = verticesArtifact.iterator();
if (!iterator.hasNext()) {
log.debug("No category node for id = {}", categoryId);
result = Either.right(ActionStatus.GENERAL_ERROR);
@@ -449,9 +467,9 @@
return result;
} finally {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
}
@@ -465,24 +483,25 @@
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<SubCategoryData, TitanOperationStatus> subCategoryDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
+ Either<SubCategoryData, JanusGraphOperationStatus> subCategoryDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
if (subCategoryDataEither.isRight()) {
log.debug("Failed to retrieve sub-category for id {}", subCategoryId);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
- log.debug(COULDN_T_FETCH_TITAN_GRAPH);
+ log.debug(COULDN_T_FETCH_janusGraph_GRAPH);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- Iterable<TitanVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId).vertices();
- Iterator<TitanVertex> iterator = verticesArtifact.iterator();
+ Iterable<JanusGraphVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId).vertices();
+ Iterator<JanusGraphVertex> iterator = verticesArtifact.iterator();
if (!iterator.hasNext()) {
log.debug("No sub-category node for id {}", subCategoryId);
result = Either.right(ActionStatus.GENERAL_ERROR);
@@ -496,9 +515,9 @@
return result;
} finally {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
@@ -513,24 +532,25 @@
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<GroupingData, TitanOperationStatus> groupingDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId, GroupingData.class);
+ Either<GroupingData, JanusGraphOperationStatus> groupingDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId, GroupingData.class);
if (groupingDataEither.isRight()) {
log.debug("Failed to retrieve grouping for id {}", groupingId);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
- log.debug(COULDN_T_FETCH_TITAN_GRAPH);
+ log.debug(COULDN_T_FETCH_janusGraph_GRAPH);
result = Either.right(ActionStatus.GENERAL_ERROR);
return result;
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
- Iterable<TitanVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId).vertices();
- Iterator<TitanVertex> iterator = verticesArtifact.iterator();
+ Iterable<JanusGraphVertex> verticesArtifact = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId).vertices();
+ Iterator<JanusGraphVertex> iterator = verticesArtifact.iterator();
if (!iterator.hasNext()) {
log.debug("No grouping node for id {}", groupingId);
result = Either.right(ActionStatus.GENERAL_ERROR);
@@ -544,9 +564,9 @@
return result;
} finally {
if (result != null && result.isLeft()) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
} else {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
}
}
@@ -557,8 +577,9 @@
Map<String, Object> properties = new HashMap<>();
properties.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), normalizedName);
try {
- Either<List<CategoryData>, TitanOperationStatus> categoryEither = titanGenericDao.getByCriteria(nodeType, properties, CategoryData.class);
- if (categoryEither.isRight() && categoryEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<CategoryData>, JanusGraphOperationStatus> categoryEither = janusGraphGenericDao
+ .getByCriteria(nodeType, properties, CategoryData.class);
+ if (categoryEither.isRight() && categoryEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get categories, nodeType {}, normalizedName {}, error {}", nodeType, normalizedName, categoryEither.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -575,7 +596,7 @@
return Either.left(true);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -584,8 +605,9 @@
String subCategoryId = UniqueIdBuilder.buildSubCategoryUid(parentCategoryId, subCategoryNormName);
try {
- Either<SubCategoryData, TitanOperationStatus> subCategoryDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
- if (subCategoryDataEither.isRight() && subCategoryDataEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<SubCategoryData, JanusGraphOperationStatus> subCategoryDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), subCategoryId, SubCategoryData.class);
+ if (subCategoryDataEither.isRight() && subCategoryDataEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get sub-category with id {}, error {}", subCategoryId, subCategoryDataEither.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -598,7 +620,7 @@
return Either.left(true);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -607,8 +629,9 @@
String groupingId = UniqueIdBuilder.buildGroupingUid(parentSubCategoryId, groupingNormName);
try {
- Either<GroupingData, TitanOperationStatus> groupingDataEither = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId, GroupingData.class);
- if (groupingDataEither.isRight() && groupingDataEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<GroupingData, JanusGraphOperationStatus> groupingDataEither = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), groupingId, GroupingData.class);
+ if (groupingDataEither.isRight() && groupingDataEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get grouping with id {}, error {}", groupingId, groupingDataEither.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -621,7 +644,7 @@
return Either.left(true);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -630,8 +653,9 @@
Map<String, Object> properties = new HashMap<>();
properties.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), normalizedName);
try {
- Either<List<SubCategoryData>, TitanOperationStatus> subCategoryEither = titanGenericDao.getByCriteria(nodeType, properties, SubCategoryData.class);
- if (subCategoryEither.isRight() && subCategoryEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<SubCategoryData>, JanusGraphOperationStatus> subCategoryEither = janusGraphGenericDao
+ .getByCriteria(nodeType, properties, SubCategoryData.class);
+ if (subCategoryEither.isRight() && subCategoryEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get sub-categories, nodeType {}, normalizedName {}, error {}", nodeType, normalizedName, subCategoryEither.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -646,7 +670,7 @@
return Either.left(null);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -655,8 +679,9 @@
Map<String, Object> properties = new HashMap<>();
properties.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), groupingNormalizedName);
try {
- Either<List<GroupingData>, TitanOperationStatus> groupingEither = titanGenericDao.getByCriteria(nodeType, properties, GroupingData.class);
- if (groupingEither.isRight() && groupingEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GroupingData>, JanusGraphOperationStatus> groupingEither = janusGraphGenericDao
+ .getByCriteria(nodeType, properties, GroupingData.class);
+ if (groupingEither.isRight() && groupingEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to get grouping, nodeType {}, normalizedName {}, error {}", nodeType, groupingNormalizedName, groupingEither.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
}
@@ -671,7 +696,7 @@
return Either.left(null);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -682,7 +707,8 @@
@Override
public Either<List<Tag>, ActionStatus> getAllTags() {
try {
- Either<List<TagData>, TitanOperationStatus> either = titanGenericDao.getAll(NodeTypeEnum.Tag, TagData.class);
+ Either<List<TagData>, JanusGraphOperationStatus> either = janusGraphGenericDao
+ .getAll(NodeTypeEnum.Tag, TagData.class);
if (either.isRight()) {
log.debug("Problem while get all tags. reason - {}", either.right().value());
return Either.right(ActionStatus.GENERAL_ERROR);
@@ -691,7 +717,7 @@
List<Tag> tagList = convertToListOfTag(tagDataList);
return Either.left(tagList);
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -708,12 +734,14 @@
} else {
categoryUid = UniqueIdBuilder.buildServiceCategoryUid(name, type);
}
- Either<T, TitanOperationStatus> either = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(type), categoryUid, clazz);
+ Either<T, JanusGraphOperationStatus> either = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(type), categoryUid, clazz);
if (either.isRight()) {
- TitanOperationStatus titanOperationStatus = either.right().value();
- log.debug("Problem while geting category with id {}. reason - {}", categoryUid, titanOperationStatus.name());
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = either.right().value();
+ log.debug("Problem while geting category with id {}. reason - {}", categoryUid, janusGraphOperationStatus
+ .name());
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND);
} else {
return Either.right(StorageOperationStatus.GENERAL_ERROR);
@@ -804,12 +832,14 @@
String categoryUid = UniqueIdBuilder.buildServiceCategoryUid(name, type);
Map props = new HashMap<>();
props.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), ValidationUtils.normalizeCategoryName4Uniqueness(name));
- Either<List<T>, TitanOperationStatus> either = titanGenericDao.getByCriteria(type, props, clazz);
+ Either<List<T>, JanusGraphOperationStatus> either = janusGraphGenericDao
+ .getByCriteria(type, props, clazz);
if (either.isRight()) {
- TitanOperationStatus titanOperationStatus = either.right().value();
- log.debug("Problem while geting category with id {}. reason - {}", categoryUid, titanOperationStatus.name());
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = either.right().value();
+ log.debug("Problem while geting category with id {}. reason - {}", categoryUid, janusGraphOperationStatus
+ .name());
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND);
} else {
return Either.right(StorageOperationStatus.GENERAL_ERROR);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
index b87da5a..009f375 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.model.operations.impl;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -33,7 +33,7 @@
private static final Logger log = Logger.getLogger(GraphLockOperation.class.getName());
@javax.annotation.Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
public GraphLockOperation() {
super();
@@ -47,15 +47,15 @@
@Override
public StorageOperationStatus lockComponent(String componentId, NodeTypeEnum nodeType) {
log.info("lock resource with id {}", componentId);
- TitanOperationStatus lockElementStatus = null;
+ JanusGraphOperationStatus lockElementStatus = null;
try {
- lockElementStatus = titanGenericDao.lockElement(componentId, nodeType);
+ lockElementStatus = janusGraphGenericDao.lockElement(componentId, nodeType);
} catch (Exception e) {
- lockElementStatus = TitanOperationStatus.ALREADY_LOCKED;
+ lockElementStatus = JanusGraphOperationStatus.ALREADY_LOCKED;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(lockElementStatus);
}
@@ -66,30 +66,32 @@
*/
@Override
public StorageOperationStatus unlockComponent(String componentId, NodeTypeEnum nodeType) {
- TitanOperationStatus lockElementStatus = titanGenericDao.releaseElement(componentId, nodeType);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
+ JanusGraphOperationStatus lockElementStatus = janusGraphGenericDao
+ .releaseElement(componentId, nodeType);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(lockElementStatus);
}
@Override
public StorageOperationStatus unlockComponentByName(String name, String componentId, NodeTypeEnum nodeType) {
- TitanOperationStatus lockElementStatus = titanGenericDao.releaseElement(name, nodeType);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
+ JanusGraphOperationStatus
+ lockElementStatus = janusGraphGenericDao.releaseElement(name, nodeType);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(lockElementStatus);
}
@Override
public StorageOperationStatus lockComponentByName(String name, NodeTypeEnum nodeType) {
log.info("lock resource with name {}", name);
- TitanOperationStatus lockElementStatus = null;
+ JanusGraphOperationStatus lockElementStatus = null;
try {
- lockElementStatus = titanGenericDao.lockElement(name, nodeType);
+ lockElementStatus = janusGraphGenericDao.lockElement(name, nodeType);
} catch (Exception e) {
- lockElementStatus = TitanOperationStatus.ALREADY_LOCKED;
+ lockElementStatus = JanusGraphOperationStatus.ALREADY_LOCKED;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(lockElementStatus);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
index 4c86af4..39d4c73 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -31,9 +31,9 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
@@ -74,37 +74,38 @@
Either<List<GroupInstance>, StorageOperationStatus> result = null;
List<GroupInstance> groupInstanceRes = new ArrayList<>();
- Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphGenericDao.getGraph();
if (graph.isRight()) {
log.debug("Failed to work with graph {}", graph.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graph.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(graph.right().value()));
}
- TitanGraph tGraph = graph.left().value();
+ JanusGraph tGraph = graph.left().value();
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(parentType), parentId).vertices();
+ Iterable<JanusGraphVertex> vertices = tGraph.query().has(UniqueIdBuilder.getKeyByNodeType(parentType), parentId).vertices();
if (vertices == null || vertices.iterator() == null || !vertices.iterator().hasNext()) {
log.debug("No nodes for type {} for id = {}", parentType, parentId);
result = Either.right(StorageOperationStatus.NOT_FOUND);
return result;
}
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
Vertex vertex = iterator.next();
Map<String, Object> edgeProperties = null;
- Either<List<ImmutablePair<GroupInstanceData, GraphEdge>>, TitanOperationStatus> childrenByEdgeCriteria = titanGenericDao.getChildrenByEdgeCriteria(vertex, parentId, GraphEdgeLabels.GROUP_INST, NodeTypeEnum.GroupInstance,
+ Either<List<ImmutablePair<GroupInstanceData, GraphEdge>>, JanusGraphOperationStatus> childrenByEdgeCriteria = janusGraphGenericDao
+ .getChildrenByEdgeCriteria(vertex, parentId, GraphEdgeLabels.GROUP_INST, NodeTypeEnum.GroupInstance,
GroupInstanceData.class, edgeProperties);
if (childrenByEdgeCriteria.isRight()) {
- TitanOperationStatus status = childrenByEdgeCriteria.right().value();
+ JanusGraphOperationStatus status = childrenByEdgeCriteria.right().value();
log.debug("Failed to find group instance {} on graph", childrenByEdgeCriteria.right().value());
- if (status == TitanOperationStatus.NOT_FOUND) {
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(groupInstanceRes);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
List<ImmutablePair<GroupInstanceData, GraphEdge>> list = childrenByEdgeCriteria.left().value();
@@ -120,16 +121,16 @@
}
GroupDefinition groupDefinition = groupRes.left().value();
- Either<Map<String, PropertyValueData>, TitanOperationStatus> groupInstancePropertyValuesRes = getAllGroupInstancePropertyValuesData(groupInstData);
+ Either<Map<String, PropertyValueData>, JanusGraphOperationStatus> groupInstancePropertyValuesRes = getAllGroupInstancePropertyValuesData(groupInstData);
if(groupInstancePropertyValuesRes.isRight()){
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(groupInstancePropertyValuesRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(groupInstancePropertyValuesRes.right().value()));
}
buildGroupInstanceFromGroup(groupInstance, groupDefinition, groupInstancePropertyValuesRes.left().value());
- Either<List<ImmutablePair<String, String>>, TitanOperationStatus> artifactsRes = getGroupArtifactsPairs(groupInstance.getUniqueId());
+ Either<List<ImmutablePair<String, String>>, JanusGraphOperationStatus> artifactsRes = getGroupArtifactsPairs(groupInstance.getUniqueId());
if (artifactsRes.isRight()) {
- TitanOperationStatus status = artifactsRes.right().value();
- if (status != TitanOperationStatus.OK) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ JanusGraphOperationStatus status = artifactsRes.right().value();
+ if (status != JanusGraphOperationStatus.OK) {
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
} else {
@@ -175,11 +176,11 @@
try {
- Either<PropertyValueData, TitanOperationStatus> eitherStatus = addPropertyToGroupInstance(groupInstanceProperty, groupInstanceId, index);
+ Either<PropertyValueData, JanusGraphOperationStatus> eitherStatus = addPropertyToGroupInstance(groupInstanceProperty, groupInstanceId, index);
if (eitherStatus.isRight()) {
log.error("Failed to add property value {} to resource instance {} in Graph. status is {}", groupInstanceProperty, groupInstanceId, eitherStatus.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
return result;
} else {
PropertyValueData propertyValueData = eitherStatus.left().value();
@@ -187,9 +188,9 @@
ComponentInstanceProperty propertyValueResult = propertyOperation.buildResourceInstanceProperty(propertyValueData, groupInstanceProperty);
log.debug("The returned GroupInstanceProperty is {}", propertyValueResult);
- Either<String, TitanOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(groupInstanceProperty.getPath(), groupInstanceProperty.getUniqueId(), groupInstanceProperty.getDefaultValue());
+ Either<String, JanusGraphOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(groupInstanceProperty.getPath(), groupInstanceProperty.getUniqueId(), groupInstanceProperty.getDefaultValue());
if (findDefaultValue.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findDefaultValue.right().value()));
return result;
}
String defaultValue = findDefaultValue.left().value();
@@ -205,10 +206,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -233,25 +234,27 @@
* @param index
* @return
*/
- public Either<PropertyValueData, TitanOperationStatus> addPropertyToGroupInstance(ComponentInstanceProperty groupInstanceProperty, String groupInstanceId, Integer index) {
+ public Either<PropertyValueData, JanusGraphOperationStatus> addPropertyToGroupInstance(ComponentInstanceProperty groupInstanceProperty, String groupInstanceId, Integer index) {
- Either<GroupInstanceData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupInstance), groupInstanceId, GroupInstanceData.class);
+ Either<GroupInstanceData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupInstance), groupInstanceId, GroupInstanceData.class);
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
String propertyId = groupInstanceProperty.getUniqueId();
- Either<PropertyData, TitanOperationStatus> findPropertyDefRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
+ Either<PropertyData, JanusGraphOperationStatus> findPropertyDefRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
if (findPropertyDefRes.isRight()) {
- TitanOperationStatus status = findPropertyDefRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findPropertyDefRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -262,11 +265,11 @@
PropertyData propertyData = findPropertyDefRes.left().value();
GroupInstanceData resourceInstanceData = findResInstanceRes.left().value();
- ImmutablePair<TitanOperationStatus, String> isPropertyValueExists = propertyOperation.findPropertyValue(groupInstanceId, propertyId);
- if (isPropertyValueExists.getLeft() == TitanOperationStatus.ALREADY_EXIST) {
+ ImmutablePair<JanusGraphOperationStatus, String> isPropertyValueExists = propertyOperation.findPropertyValue(groupInstanceId, propertyId);
+ if (isPropertyValueExists.getLeft() == JanusGraphOperationStatus.ALREADY_EXIST) {
log.debug("The property {} already added to the resource instance {}", propertyId, groupInstanceId);
groupInstanceProperty.setValueUniqueUid(isPropertyValueExists.getRight());
- Either<PropertyValueData, TitanOperationStatus> updatePropertyOfResourceInstance = updatePropertyOfGroupInstance(groupInstanceProperty, groupInstanceId);
+ Either<PropertyValueData, JanusGraphOperationStatus> updatePropertyOfResourceInstance = updatePropertyOfGroupInstance(groupInstanceProperty, groupInstanceId);
if (updatePropertyOfResourceInstance.isRight()) {
BeEcompErrorManager.getInstance().logInternalFlowError(UPDATE_PROPERTY_VALUE_ON_COMPONENT_INSTANCE, FAILED_TO_UPDATE_PROPERTY_VALUE_ON_INSTANCE_STATUS_IS + updatePropertyOfResourceInstance.right().value(), ErrorSeverity.ERROR);
return Either.right(updatePropertyOfResourceInstance.right().value());
@@ -274,7 +277,7 @@
return Either.left(updatePropertyOfResourceInstance.left().value());
}
- if (isPropertyValueExists.getLeft() != TitanOperationStatus.NOT_FOUND) {
+ if (isPropertyValueExists.getLeft() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("After finding property value of {} on componenet instance {}", propertyId, groupInstanceId);
return Either.right(isPropertyValueExists.getLeft());
}
@@ -290,20 +293,20 @@
SchemaDefinition def = propDataDef.getSchema();
if (def == null) {
log.debug("Schema doesn't exists for property of type {}", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
PropertyDataDefinition propDef = def.getProperty();
if (propDef == null) {
log.debug("Property in Schema Definition inside property of type {} doesn't exist", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
innerType = propDef.getType();
}
log.debug("Before validateAndUpdatePropertyValue");
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError(UPDATE_PROPERTY_VALUE_ON_COMPONENT_INSTANCE, FAILED_TO_UPDATE_PROPERTY_VALUE_ON_INSTANCE_STATUS_IS + status, ErrorSeverity.ERROR);
return Either.right(status);
}
@@ -314,7 +317,7 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (!res) {
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
} else {
Object object = isValid.left().value();
@@ -333,32 +336,35 @@
log.debug("After validateAndUpdateRules. pair = {}", pair);
if (pair.getRight() != null && !pair.getRight()) {
BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), groupInstanceProperty.getName(), propertyType);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
propertyOperation.addRulesToNewPropertyValue(propertyValueData, groupInstanceProperty, groupInstanceId);
log.debug("Before adding property value to graph {}", propertyValueData);
- Either<PropertyValueData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyValueData, PropertyValueData.class);
+ Either<PropertyValueData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(propertyValueData, PropertyValueData.class);
log.debug("After adding property value to graph {}", propertyValueData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
return Either.right(operationStatus);
}
propertyValueData = createNodeResult.left().value();
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(propertyValueData, propertyData, GraphEdgeLabels.PROPERTY_IMPL, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(propertyValueData, propertyData, GraphEdgeLabels.PROPERTY_IMPL, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate property value {} to property {} in graph. status is {}", uniqueId, propertyId, operationStatus);
return Either.right(operationStatus);
}
- createRelResult = titanGenericDao.createRelation(resourceInstanceData, propertyValueData, GraphEdgeLabels.PROPERTY_VALUE, null);
+ createRelResult = janusGraphGenericDao
+ .createRelation(resourceInstanceData, propertyValueData, GraphEdgeLabels.PROPERTY_VALUE, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate resource instance {} property value {} in graph. status is {}", groupInstanceId, uniqueId, operationStatus);
return Either.right(operationStatus);
}
@@ -366,7 +372,7 @@
return Either.left(propertyValueData);
} else {
log.error("property value already exists.");
- return Either.right(TitanOperationStatus.ALREADY_EXIST);
+ return Either.right(JanusGraphOperationStatus.ALREADY_EXIST);
}
}
@@ -376,9 +382,9 @@
*
* @return
*/
- public Either<PropertyValueData, TitanOperationStatus> updatePropertyOfGroupInstance(ComponentInstanceProperty groupInstanceProerty, String groupInstanceId) {
+ public Either<PropertyValueData, JanusGraphOperationStatus> updatePropertyOfGroupInstance(ComponentInstanceProperty groupInstanceProerty, String groupInstanceId) {
- Wrapper<TitanOperationStatus> errorWrapper = new Wrapper<>();
+ Wrapper<JanusGraphOperationStatus> errorWrapper = new Wrapper<>();
UpdateDataContainer<PropertyData, PropertyValueData> updateDataContainer = new UpdateDataContainer<>(GraphEdgeLabels.PROPERTY_IMPL, (() -> PropertyData.class), (() -> PropertyValueData.class), NodeTypeEnum.Property,
NodeTypeEnum.PropertyValue);
@@ -403,19 +409,19 @@
SchemaDefinition def = propDataDef.getSchema();
if (def == null) {
log.debug("Schema doesn't exists for property of type {}", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
PropertyDataDefinition propDef = def.getProperty();
if (propDef == null) {
log.debug("Property in Schema Definition inside property of type {} doesn't exist", type);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
innerType = propDef.getType();
}
// Specific Update Logic
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
BeEcompErrorManager.getInstance().logInternalFlowError(UPDATE_PROPERTY_VALUE_ON_COMPONENT_INSTANCE, FAILED_TO_UPDATE_PROPERTY_VALUE_ON_INSTANCE_STATUS_IS + status, ErrorSeverity.ERROR);
return Either.right(status);
}
@@ -425,7 +431,7 @@
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (!res) {
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
} else {
Object object = isValid.left().value();
@@ -440,13 +446,14 @@
ImmutablePair<String, Boolean> pair = propertyOperation.validateAndUpdateRules(propertyType, groupInstanceProerty.getRules(), innerType, allDataTypes.left().value(), true);
if (pair.getRight() != null && !pair.getRight()) {
BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), groupInstanceProerty.getName(), propertyType);
- return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT);
+ return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT);
}
propertyOperation.updateRulesInPropertyValue(propertyValueData, groupInstanceProerty, groupInstanceId);
- Either<PropertyValueData, TitanOperationStatus> updateRes = titanGenericDao.updateNode(propertyValueData, PropertyValueData.class);
+ Either<PropertyValueData, JanusGraphOperationStatus> updateRes = janusGraphGenericDao
+ .updateNode(propertyValueData, PropertyValueData.class);
if (updateRes.isRight()) {
- TitanOperationStatus status = updateRes.right().value();
+ JanusGraphOperationStatus status = updateRes.right().value();
return Either.right(status);
} else {
return Either.left(updateRes.left().value());
@@ -505,7 +512,7 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void preUpdateElementOfResourceInstanceValidations(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer, IComponentInstanceConnectedElement resourceInstanceProerty,
- String resourceInstanceId, Wrapper<TitanOperationStatus> errorWrapper) {
+ String resourceInstanceId, Wrapper<JanusGraphOperationStatus> errorWrapper) {
if (errorWrapper.isEmpty()) {
// Verify VFC instance Exist
@@ -529,14 +536,15 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void validateElementConnectedToInstance(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer, IComponentInstanceConnectedElement resourceInstanceProerty,
- Wrapper<TitanOperationStatus> errorWrapper) {
- Either<ImmutablePair<SomeData, GraphEdge>, TitanOperationStatus> child = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), resourceInstanceProerty.getValueUniqueUid(),
+ Wrapper<JanusGraphOperationStatus> errorWrapper) {
+ Either<ImmutablePair<SomeData, GraphEdge>, JanusGraphOperationStatus> child = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), resourceInstanceProerty.getValueUniqueUid(),
updateDataContainer.getGraphEdge(), updateDataContainer.getNodeType(), updateDataContainer.getSomeDataClassGen().get());
if (child.isRight()) {
- TitanOperationStatus status = child.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = child.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
@@ -546,16 +554,17 @@
}
private <SomeValueData extends GraphNode, SomeData extends GraphNode> void validateElementConnectedToComponentInstanceExist(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer,
- IComponentInstanceConnectedElement resourceInstanceProerty, Wrapper<TitanOperationStatus> errorWrapper) {
+ IComponentInstanceConnectedElement resourceInstanceProerty, Wrapper<JanusGraphOperationStatus> errorWrapper) {
String valueUniqueUid = resourceInstanceProerty.getValueUniqueUid();
if (valueUniqueUid == null) {
- errorWrapper.setInnerElement(TitanOperationStatus.INVALID_ID);
+ errorWrapper.setInnerElement(JanusGraphOperationStatus.INVALID_ID);
} else {
- Either<SomeValueData, TitanOperationStatus> findPropertyValueRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), valueUniqueUid, updateDataContainer.getSomeValueDataClassGen().get());
+ Either<SomeValueData, JanusGraphOperationStatus> findPropertyValueRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeTypeValue()), valueUniqueUid, updateDataContainer.getSomeValueDataClassGen().get());
if (findPropertyValueRes.isRight()) {
- TitanOperationStatus status = findPropertyValueRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findPropertyValueRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
} else {
@@ -565,31 +574,33 @@
}
private <SomeData extends GraphNode, SomeValueData extends GraphNode> void validateElementConnectedToComponentExist(UpdateDataContainer<SomeData, SomeValueData> updateDataContainer,
- IComponentInstanceConnectedElement resourceInstanceElementConnected, Wrapper<TitanOperationStatus> errorWrapper) {
+ IComponentInstanceConnectedElement resourceInstanceElementConnected, Wrapper<JanusGraphOperationStatus> errorWrapper) {
String uniqueId = resourceInstanceElementConnected.getUniqueId();
- Either<SomeData, TitanOperationStatus> findPropertyDefRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeType()), uniqueId, updateDataContainer.getSomeDataClassGen().get());
+ Either<SomeData, JanusGraphOperationStatus> findPropertyDefRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(updateDataContainer.getNodeType()), uniqueId, updateDataContainer.getSomeDataClassGen().get());
if (findPropertyDefRes.isRight()) {
- TitanOperationStatus status = findPropertyDefRes.right().value();
+ JanusGraphOperationStatus status = findPropertyDefRes.right().value();
errorWrapper.setInnerElement(status);
}
}
- private void validateGIExist(String resourceInstanceId, Wrapper<TitanOperationStatus> errorWrapper) {
+ private void validateGIExist(String resourceInstanceId, Wrapper<JanusGraphOperationStatus> errorWrapper) {
validateGIExist(resourceInstanceId, null, errorWrapper);
}
- private void validateGIExist(String resourceInstanceId, Wrapper<GroupInstanceData> compInsDataWrapper, Wrapper<TitanOperationStatus> errorWrapper) {
+ private void validateGIExist(String resourceInstanceId, Wrapper<GroupInstanceData> compInsDataWrapper, Wrapper<JanusGraphOperationStatus> errorWrapper) {
validateElementExistInGraph(resourceInstanceId, NodeTypeEnum.GroupInstance, () -> GroupInstanceData.class, compInsDataWrapper, errorWrapper);
}
public <ElementData extends GraphNode> void validateElementExistInGraph(String elementUniqueId, NodeTypeEnum elementNodeType, Supplier<Class<ElementData>> elementClassGen, Wrapper<ElementData> elementDataWrapper,
- Wrapper<TitanOperationStatus> errorWrapper) {
- Either<ElementData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(elementNodeType), elementUniqueId, elementClassGen.get());
+ Wrapper<JanusGraphOperationStatus> errorWrapper) {
+ Either<ElementData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(elementNodeType), elementUniqueId, elementClassGen.get());
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
errorWrapper.setInnerElement(status);
} else {
@@ -627,16 +638,17 @@
return updatedProperty;
}
- private Either<List<ImmutablePair<String, String>>, TitanOperationStatus> getGroupArtifactsPairs(String groupUniqueId) {
+ private Either<List<ImmutablePair<String, String>>, JanusGraphOperationStatus> getGroupArtifactsPairs(String groupUniqueId) {
- Either<List<ImmutablePair<String, String>>, TitanOperationStatus> result = null;
+ Either<List<ImmutablePair<String, String>>, JanusGraphOperationStatus> result = null;
- Either<List<ImmutablePair<ArtifactData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupInstance), groupUniqueId, GraphEdgeLabels.GROUP_ARTIFACT_REF,
+ Either<List<ImmutablePair<ArtifactData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupInstance), groupUniqueId, GraphEdgeLabels.GROUP_ARTIFACT_REF,
NodeTypeEnum.ArtifactRef, ArtifactData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus status = childrenNodes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childrenNodes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
result = Either.right(status);
@@ -696,24 +708,26 @@
for (GroupInstance groupDefinition : associatedGroups) {
UniqueIdData groupData = new UniqueIdData(NodeTypeEnum.GroupInstance, groupDefinition.getUniqueId());
- Either<GraphRelation, TitanOperationStatus> deleteRelation = titanGenericDao.deleteRelation(groupData, oldArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF);
+ Either<GraphRelation, JanusGraphOperationStatus> deleteRelation = janusGraphGenericDao
+ .deleteRelation(groupData, oldArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF);
log.trace("After dissociate group {} from artifact {}", groupDefinition.getName(), oldArtifactId);
if (deleteRelation.isRight()) {
- TitanOperationStatus status = deleteRelation.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = deleteRelation.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
- Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(groupData, newArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphGenericDao
+ .createRelation(groupData, newArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF, props);
log.trace("After associate group {} to artifact {}", groupDefinition.getName(), newArtifact.getUniqueIdKey());
if (createRelation.isRight()) {
- TitanOperationStatus status = createRelation.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = createRelation.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
@@ -721,17 +735,17 @@
return StorageOperationStatus.OK;
}
- private Either<Map<String, PropertyValueData>, TitanOperationStatus> getAllGroupInstancePropertyValuesData(GroupInstanceData groupInstData) {
+ private Either<Map<String, PropertyValueData>, JanusGraphOperationStatus> getAllGroupInstancePropertyValuesData(GroupInstanceData groupInstData) {
- Either<Map<String, PropertyValueData>, TitanOperationStatus> result = null;
+ Either<Map<String, PropertyValueData>, JanusGraphOperationStatus> result = null;
try{
- Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, TitanOperationStatus> getPropertyValueChildrenRes =
- titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), groupInstData.getUniqueId(), GraphEdgeLabels.PROPERTY_VALUE,
+ Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, JanusGraphOperationStatus> getPropertyValueChildrenRes =
+ janusGraphGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), groupInstData.getUniqueId(), GraphEdgeLabels.PROPERTY_VALUE,
NodeTypeEnum.PropertyValue, PropertyValueData.class, true);
if(getPropertyValueChildrenRes.isRight()){
- TitanOperationStatus status = getPropertyValueChildrenRes.right().value();
+ JanusGraphOperationStatus status = getPropertyValueChildrenRes.right().value();
log.debug("Failed to fetch property value nodes for group instance {}. Status is {}. ", groupInstData.getName(), status);
- if(status == TitanOperationStatus.NOT_FOUND){
+ if(status == JanusGraphOperationStatus.NOT_FOUND){
result = Either.left(null);
}else{
result = Either.right(status);
@@ -743,7 +757,7 @@
} catch(Exception e){
log.debug("The Exception occured during fetch group instance () property values. The message is {}. ", groupInstData.getName(), e.getMessage(), e);
if(result == null){
- result = Either.right(TitanOperationStatus.GENERAL_ERROR);
+ result = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
}
return result;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java
index 1187837..c8135ad 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java
@@ -25,19 +25,19 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.IGroupOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -58,14 +58,14 @@
private static final Logger log = Logger.getLogger(GroupOperation.class.getName());
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
private final TopologyTemplateOperation topologyTemplateOperation;
private final PropertyOperation propertyOperation;
private final GroupTypeOperation groupTypeOperation;
private final ApplicationDataTypeCache dataTypeCache;
- public GroupOperation(TitanDao titanDao, TopologyTemplateOperation topologyTemplateOperation, PropertyOperation propertyOperation, GroupTypeOperation groupTypeOperation, ApplicationDataTypeCache dataTypeCache) {
- this.titanDao = titanDao;
+ public GroupOperation(JanusGraphDao janusGraphDao, TopologyTemplateOperation topologyTemplateOperation, PropertyOperation propertyOperation, GroupTypeOperation groupTypeOperation, ApplicationDataTypeCache dataTypeCache) {
+ this.janusGraphDao = janusGraphDao;
this.topologyTemplateOperation = topologyTemplateOperation;
this.propertyOperation = propertyOperation;
this.groupTypeOperation = groupTypeOperation;
@@ -83,17 +83,18 @@
* @param groupUniqueId
* @return
*/
- private Either<Map<String, String>, TitanOperationStatus> getGroupMembers(String groupUniqueId) {
+ private Either<Map<String, String>, JanusGraphOperationStatus> getGroupMembers(String groupUniqueId) {
- Either<Map<String, String>, TitanOperationStatus> result = null;
+ Either<Map<String, String>, JanusGraphOperationStatus> result = null;
- Either<List<ImmutablePair<ComponentInstanceData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.GROUP_MEMBER,
+ Either<List<ImmutablePair<ComponentInstanceData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.GROUP_MEMBER,
NodeTypeEnum.ResourceInstance, ComponentInstanceData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus status = childrenNodes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childrenNodes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
result = Either.right(status);
@@ -119,10 +120,11 @@
private Either<GroupTypeDefinition, StorageOperationStatus> getGroupTypeOfGroup(String groupUniqueId) {
- Either<ImmutablePair<GroupTypeData, GraphEdge>, StorageOperationStatus> groupTypeRes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.TYPE_OF, NodeTypeEnum.GroupType,
+ Either<ImmutablePair<GroupTypeData, GraphEdge>, StorageOperationStatus> groupTypeRes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.TYPE_OF, NodeTypeEnum.GroupType,
GroupTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (groupTypeRes.isRight()) {
StorageOperationStatus status = groupTypeRes.right().value();
@@ -169,10 +171,11 @@
Map<String, PropertyDefinition> uidToPropDefMap = groupTypeProperties.stream().collect(Collectors.toMap(PropertyDefinition::getUniqueId, Function.identity()));
// Find all properties values on the group
- Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, StorageOperationStatus> propertyImplNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUid, GraphEdgeLabels.PROPERTY_VALUE,
+ Either<List<ImmutablePair<PropertyValueData, GraphEdge>>, StorageOperationStatus> propertyImplNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUid, GraphEdgeLabels.PROPERTY_VALUE,
NodeTypeEnum.PropertyValue, PropertyValueData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (propertyImplNodes.isRight()) {
StorageOperationStatus status = propertyImplNodes.right().value();
@@ -197,10 +200,11 @@
String propertyValueUid = propertyValueData.getUniqueId();
String value = propertyValueData.getValue();
- Either<ImmutablePair<PropertyData, GraphEdge>, StorageOperationStatus> propertyDefRes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueUid, GraphEdgeLabels.PROPERTY_IMPL,
+ Either<ImmutablePair<PropertyData, GraphEdge>, StorageOperationStatus> propertyDefRes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueUid, GraphEdgeLabels.PROPERTY_IMPL,
NodeTypeEnum.Property, PropertyData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (propertyDefRes.isRight()) {
StorageOperationStatus status = propertyDefRes.right().value();
if (status == StorageOperationStatus.NOT_FOUND) {
@@ -262,9 +266,10 @@
UniqueIdData artifactData = new UniqueIdData(NodeTypeEnum.ArtifactRef, artifactId);
for (GroupDefinition groupDefinition : associatedGroups) {
UniqueIdData groupData = new UniqueIdData(NodeTypeEnum.Group, groupDefinition.getUniqueId());
- Either<GraphRelation, StorageOperationStatus> deleteRelation = titanGenericDao.deleteRelation(groupData, artifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF)
+ Either<GraphRelation, StorageOperationStatus> deleteRelation = janusGraphGenericDao
+ .deleteRelation(groupData, artifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (deleteRelation.isRight()) {
StorageOperationStatus status = deleteRelation.right().value();
if (status == StorageOperationStatus.NOT_FOUND) {
@@ -289,9 +294,10 @@
Either<GroupDefinition, StorageOperationStatus> result = null;
- Either<GroupData, StorageOperationStatus> groupRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), uniqueId, GroupData.class)
+ Either<GroupData, StorageOperationStatus> groupRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), uniqueId, GroupData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (groupRes.isRight()) {
StorageOperationStatus status = groupRes.right().value();
log.debug("Failed to retrieve group {} from graph. Status is {}", uniqueId, status);
@@ -321,7 +327,7 @@
if (!skipMembers) {
Either<Map<String, String>, StorageOperationStatus> membersRes = getGroupMembers(uniqueId)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (membersRes.isRight()) {
StorageOperationStatus status = membersRes.right().value();
if (status != StorageOperationStatus.OK) {
@@ -351,7 +357,7 @@
if (!skipArtifacts) {
Either<List<ImmutablePair<String, String>>, StorageOperationStatus> artifactsRes = getGroupArtifactsPairs(uniqueId)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (artifactsRes.isRight()) {
StorageOperationStatus status = artifactsRes.right().value();
if (status != StorageOperationStatus.OK) {
@@ -384,12 +390,13 @@
@Override
public boolean isGroupExist(String groupName, boolean inTransaction) {
- Either<List<GroupData>, TitanOperationStatus> eitherGroup = null;
+ Either<List<GroupData>, JanusGraphOperationStatus> eitherGroup = null;
try {
Map<String, Object> properties = new HashMap<>();
properties.put(GraphPropertiesDictionary.NAME.getProperty(), groupName);
- eitherGroup = titanGenericDao.getByCriteria(NodeTypeEnum.Group, properties, GroupData.class);
+ eitherGroup = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.Group, properties, GroupData.class);
return eitherGroup.isLeft() && !eitherGroup.left().value().isEmpty();
} finally {
@@ -401,10 +408,11 @@
List<GroupDefinition> groups = new ArrayList<>();
- Either<List<ImmutablePair<GroupData, GraphEdge>>, StorageOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(componentTypeEnum), componentId, GraphEdgeLabels.GROUP, NodeTypeEnum.Group,
+ Either<List<ImmutablePair<GroupData, GraphEdge>>, StorageOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(componentTypeEnum), componentId, GraphEdgeLabels.GROUP, NodeTypeEnum.Group,
GroupData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (childrenNodes.isRight()) {
StorageOperationStatus status = childrenNodes.right().value();
@@ -467,9 +475,10 @@
for (GroupDefinition groupDefinition : associatedGroups) {
UniqueIdData groupData = new UniqueIdData(NodeTypeEnum.Group, groupDefinition.getUniqueId());
- Either<GraphRelation, StorageOperationStatus> deleteRelation = titanGenericDao.deleteRelation(groupData, oldArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF)
+ Either<GraphRelation, StorageOperationStatus> deleteRelation = janusGraphGenericDao
+ .deleteRelation(groupData, oldArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
log.trace("After dissociate group {} from artifact {}" , groupDefinition.getName(), oldArtifactId);
if (deleteRelation.isRight()) {
StorageOperationStatus status = deleteRelation.right().value();
@@ -479,9 +488,10 @@
return status;
}
- Either<GraphRelation, StorageOperationStatus> createRelation = titanGenericDao.createRelation(groupData, newArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF, props)
+ Either<GraphRelation, StorageOperationStatus> createRelation = janusGraphGenericDao
+ .createRelation(groupData, newArtifactData, GraphEdgeLabels.GROUP_ARTIFACT_REF, props)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
log.trace("After associate group {} to artifact {}" , groupDefinition.getName(), newArtifact.getUniqueIdKey());
if (createRelation.isRight()) {
StorageOperationStatus status = createRelation.right().value();
@@ -516,25 +526,26 @@
if (result == null || result != StorageOperationStatus.OK) {
log.debug("Going to execute rollback on graph.");
BeEcompErrorManager.getInstance().logBeExecuteRollbackError("Rollback on graph");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
}
- private Either<List<ImmutablePair<String, String>>, TitanOperationStatus> getGroupArtifactsPairs(String groupUniqueId) {
+ private Either<List<ImmutablePair<String, String>>, JanusGraphOperationStatus> getGroupArtifactsPairs(String groupUniqueId) {
- Either<List<ImmutablePair<String, String>>, TitanOperationStatus> result = null;
+ Either<List<ImmutablePair<String, String>>, JanusGraphOperationStatus> result = null;
- Either<List<ImmutablePair<ArtifactData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.GROUP_ARTIFACT_REF,
+ Either<List<ImmutablePair<ArtifactData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Group), groupUniqueId, GraphEdgeLabels.GROUP_ARTIFACT_REF,
NodeTypeEnum.ArtifactRef, ArtifactData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus status = childrenNodes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childrenNodes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
result = Either.right(status);
@@ -565,12 +576,12 @@
StorageOperationStatus result = null;
String innerType = property.getSchema() == null ? null : property.getSchema().getProperty() == null ? null : property.getSchema().getProperty().getType();
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll();
Either<Object, Boolean> isValid = null;
if (allDataTypes.isRight()) {
- TitanOperationStatus status = allDataTypes.right().value();
+ JanusGraphOperationStatus status = allDataTypes.right().value();
log.debug("Failed to fetch data types from cache. Status is {}. ", status);
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if(result == null){
isValid = propertyOperation.validateAndUpdatePropertyValue(property.getType(), property.getValue(), innerType, allDataTypes.left().value());
@@ -591,9 +602,9 @@
log.debug("#updateGroupProperties - updating the properties of group {} in component {}", groupId, containerComponent.getUniqueId());
Optional<GroupDefinition> group = containerComponent.getGroupById(groupId);
if (group.isPresent()){
- return titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.NoParse)
.either(containerVertex -> updateGroupProperties(containerVertex, group.get(), propertiesToUpdate),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
} else {
throw new StorageException(StorageOperationStatus.NOT_FOUND, groupId);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
index 1817868..430ba59 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
@@ -21,7 +21,7 @@
package org.openecomp.sdc.be.model.operations.impl;
import com.google.common.base.Strings;
-import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
+import org.janusgraph.graphdb.query.JanusGraphPredicate;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@@ -30,11 +30,11 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.GraphEdgePropertiesDictionary;
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.datatypes.elements.GroupTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityDefinition;
@@ -54,7 +54,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;
-import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate;
+import static org.openecomp.sdc.be.dao.janusgraph.JanusGraphUtils.buildNotInPredicate;
@Component("group-type-operation")
public class GroupTypeOperation implements IGroupTypeOperation {
@@ -63,19 +63,19 @@
private static final String CREATE_FLOW_CONTEXT = "CreateGroupType";
private final PropertyOperation propertyOperation;
- private final TitanGenericDao titanGenericDao;
+ private final JanusGraphGenericDao janusGraphGenericDao;
private final CapabilityTypeOperation capabilityTypeOperation;
private final CapabilityOperation capabilityOperation;
private final DerivedFromOperation derivedFromOperation;
private final OperationUtils operationUtils;
- public GroupTypeOperation(TitanGenericDao titanGenericDao,
+ public GroupTypeOperation(JanusGraphGenericDao janusGraphGenericDao,
PropertyOperation propertyOperation,
CapabilityTypeOperation capabilityTypeOperation,
CapabilityOperation capabilityOperation,
DerivedFromOperation derivedFromOperation, OperationUtils operationUtils) {
- this.titanGenericDao = titanGenericDao;
+ this.janusGraphGenericDao = janusGraphGenericDao;
this.propertyOperation = propertyOperation;
this.capabilityTypeOperation = capabilityTypeOperation;
this.capabilityOperation = capabilityOperation;
@@ -101,11 +101,11 @@
try {
- Either<GroupTypeData, TitanOperationStatus> eitherStatus = addGroupTypeToGraph(groupTypeDefinition);
+ Either<GroupTypeData, JanusGraphOperationStatus> eitherStatus = addGroupTypeToGraph(groupTypeDefinition);
if (eitherStatus.isRight()) {
BeEcompErrorManager.getInstance().logBeFailedCreateNodeError(CREATE_FLOW_CONTEXT, groupTypeDefinition.getType(), eitherStatus.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
}
else {
result = getGroupType(eitherStatus.left().value().getUniqueId(), inTransaction);
@@ -114,7 +114,7 @@
return result;
} finally {
- titanGenericDao.handleTransactionCommitRollback(inTransaction, result);
+ janusGraphGenericDao.handleTransactionCommitRollback(inTransaction, result);
}
}
@@ -127,16 +127,17 @@
public Either<GroupTypeDefinition, StorageOperationStatus> validateUpdateProperties(GroupTypeDefinition groupTypeDefinition) {
- TitanOperationStatus error = null;
+ JanusGraphOperationStatus error = null;
if (CollectionUtils.isNotEmpty(groupTypeDefinition.getProperties()) && !Strings.isNullOrEmpty(groupTypeDefinition.getDerivedFrom())) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> allPropertiesRes =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> allPropertiesRes =
getAllGroupTypePropertiesFromAllDerivedFrom(groupTypeDefinition.getDerivedFrom());
- if (allPropertiesRes.isRight() && !allPropertiesRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (allPropertiesRes.isRight() && !allPropertiesRes.right().value().equals(
+ JanusGraphOperationStatus.NOT_FOUND)) {
error = allPropertiesRes.right().value();
log.debug("Couldn't fetch derived from property nodes for group type {}, error: {}", groupTypeDefinition.getType(), error);
}
if (error == null && !allPropertiesRes.left().value().isEmpty()) {
- Either<List<PropertyDefinition>, TitanOperationStatus> validatePropertiesRes = propertyOperation.validatePropertiesUniqueness(allPropertiesRes.left().value(),
+ Either<List<PropertyDefinition>, JanusGraphOperationStatus> validatePropertiesRes = propertyOperation.validatePropertiesUniqueness(allPropertiesRes.left().value(),
groupTypeDefinition.getProperties());
if (validatePropertiesRes.isRight()) {
error = validatePropertiesRes.right().value();
@@ -146,11 +147,12 @@
if (error == null) {
return Either.left(groupTypeDefinition);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
- private Either<Map<String, PropertyDefinition>, TitanOperationStatus> getAllGroupTypePropertiesFromAllDerivedFrom(String firstParentType) {
- return titanGenericDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), firstParentType, GroupTypeData.class)
+ private Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllGroupTypePropertiesFromAllDerivedFrom(String firstParentType) {
+ return janusGraphGenericDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), firstParentType, GroupTypeData.class)
.left()
.bind(parentGroup -> propertyOperation.getAllTypePropertiesFromAllDerivedFrom(parentGroup.getUniqueId(), NodeTypeEnum.GroupType, GroupTypeData.class));
}
@@ -185,8 +187,8 @@
}
}
- TitanOperationStatus createCapResult = createCapabilities(new GroupTypeData(groupTypeDef), newGroupTypeCapabilities);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(createCapResult);
+ JanusGraphOperationStatus createCapResult = createCapabilities(new GroupTypeData(groupTypeDef), newGroupTypeCapabilities);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createCapResult);
}
/**
@@ -239,9 +241,9 @@
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue) ): null;
}
- private TitanOperationStatus createCapabilities(GroupTypeData groupTypeData, Map<String, CapabilityDefinition> groupCapabilities) {
+ private JanusGraphOperationStatus createCapabilities(GroupTypeData groupTypeData, Map<String, CapabilityDefinition> groupCapabilities) {
if (MapUtils.isEmpty(groupCapabilities)) {
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
return groupCapabilities.values().stream()
@@ -249,11 +251,11 @@
.filter(Either::isRight)
.findFirst()
.map(either -> either.right().value())
- .orElse(TitanOperationStatus.OK);
+ .orElse(JanusGraphOperationStatus.OK);
}
- private Either<GraphRelation, TitanOperationStatus> createCapability(GroupTypeData groupTypeData, CapabilityDefinition capabilityDef) {
- Either<CapabilityTypeDefinition, TitanOperationStatus> eitherCapData = capabilityTypeOperation.getCapabilityTypeByType(capabilityDef.getType());
+ private Either<GraphRelation, JanusGraphOperationStatus> createCapability(GroupTypeData groupTypeData, CapabilityDefinition capabilityDef) {
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> eitherCapData = capabilityTypeOperation.getCapabilityTypeByType(capabilityDef.getType());
return eitherCapData
.left()
.map(CapabilityTypeData::new)
@@ -270,15 +272,15 @@
* @return
*/
private Either<List<CapabilityDefinition>, StorageOperationStatus> getCapablities(String groupTypeId) {
- Either<List<ImmutablePair<CapabilityData, GraphEdge>>, TitanOperationStatus> groupCapabilitiesOnGraph =
- titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), groupTypeId, GraphEdgeLabels.GROUP_TYPE_CAPABILITY, NodeTypeEnum.Capability, CapabilityData.class, true);
+ Either<List<ImmutablePair<CapabilityData, GraphEdge>>, JanusGraphOperationStatus> groupCapabilitiesOnGraph =
+ janusGraphGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), groupTypeId, GraphEdgeLabels.GROUP_TYPE_CAPABILITY, NodeTypeEnum.Capability, CapabilityData.class, true);
if (groupCapabilitiesOnGraph.isRight()) {
- TitanOperationStatus capabilityStatus = groupCapabilitiesOnGraph.right().value();
- if (capabilityStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus capabilityStatus = groupCapabilitiesOnGraph.right().value();
+ if (capabilityStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(Collections.emptyList());
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(capabilityStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(capabilityStatus));
}
List<ImmutablePair<CapabilityData, GraphEdge>> groupCapabilites = groupCapabilitiesOnGraph.left().value();
@@ -286,26 +288,27 @@
return capabilityOperation.getCapabilitiesWithProps(groupCapabilites)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private void fillCapabilityName(ImmutablePair<CapabilityData, GraphEdge> pair) {
pair.getLeft().getCapabilityDataDefinition().setName((String)pair.getRight().getProperties().get(GraphEdgePropertiesDictionary.NAME.getProperty()));
}
- private Either<GraphRelation, TitanOperationStatus> connectToCapability(GroupTypeData groupTypeData, CapabilityData capabilityData, String capabilityName) {
+ private Either<GraphRelation, JanusGraphOperationStatus> connectToCapability(GroupTypeData groupTypeData, CapabilityData capabilityData, String capabilityName) {
Map<String, Object> properties = new HashMap<>();
properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), capabilityName);
- return titanGenericDao.createRelation(groupTypeData, capabilityData, GraphEdgeLabels.GROUP_TYPE_CAPABILITY, properties);
+ return janusGraphGenericDao.createRelation(groupTypeData, capabilityData, GraphEdgeLabels.GROUP_TYPE_CAPABILITY, properties);
}
public List<GroupTypeDefinition> getAllGroupTypes(Set<String> excludedGroupTypes) {
- Map<String, Map.Entry<TitanPredicate, Object>> predicateCriteria = buildNotInPredicate(GraphPropertiesDictionary.TYPE.getProperty(), excludedGroupTypes);
- List<GroupTypeData> groupTypes = titanGenericDao.getByCriteriaWithPredicate(NodeTypeEnum.GroupType, predicateCriteria, GroupTypeData.class)
+ Map<String, Map.Entry<JanusGraphPredicate, Object>> predicateCriteria = buildNotInPredicate(GraphPropertiesDictionary.TYPE.getProperty(), excludedGroupTypes);
+ List<GroupTypeData> groupTypes = janusGraphGenericDao
+ .getByCriteriaWithPredicate(NodeTypeEnum.GroupType, predicateCriteria, GroupTypeData.class)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
return convertGroupTypesToDefinition(groupTypes);
}
@@ -319,9 +322,10 @@
public Either<GroupTypeDefinition, StorageOperationStatus> getGroupTypeByUid(String uniqueId) {
log.debug("#getGroupTypeByUid - fetching group type with id {}", uniqueId);
- return titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), uniqueId, GroupTypeData.class)
+ return janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), uniqueId, GroupTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(groupType -> buildGroupTypeDefinition(uniqueId, groupType));
}
@@ -346,7 +350,7 @@
return result;
} finally {
- titanGenericDao.handleTransactionCommitRollback(inTransaction, result);
+ janusGraphGenericDao.handleTransactionCommitRollback(inTransaction, result);
}
}
@@ -375,9 +379,10 @@
return result;
}
- Either<List<GroupTypeData>, StorageOperationStatus> groupTypeEither = titanGenericDao.getByCriteria(NodeTypeEnum.GroupType, properties, GroupTypeData.class)
+ Either<List<GroupTypeData>, StorageOperationStatus> groupTypeEither = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.GroupType, properties, GroupTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (groupTypeEither.isRight()) {
result = Either.right(groupTypeEither.right().value());
} else {
@@ -391,7 +396,7 @@
return result;
} finally {
- titanGenericDao.handleTransactionCommitRollback(inTransaction, result);
+ janusGraphGenericDao.handleTransactionCommitRollback(inTransaction, result);
}
}
@@ -432,11 +437,11 @@
.bind(propsMap -> fillDerivedFromProperties(groupType, derivedFromNode, new ArrayList<>(propsMap.values())));
}
- Either<Map<String, PropertyDefinition>, StorageOperationStatus> handleGroupTypeHasNoProperties(TitanOperationStatus err) {
- if (err == TitanOperationStatus.NOT_FOUND) {
+ Either<Map<String, PropertyDefinition>, StorageOperationStatus> handleGroupTypeHasNoProperties(JanusGraphOperationStatus err) {
+ if (err == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(new HashMap<>());
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(err));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(err));
}
private Either<List<PropertyDefinition>, StorageOperationStatus> fillDerivedFromProperties(GroupTypeDefinition groupType, GroupTypeData derivedFromNode, List<PropertyDefinition> groupTypeDirectProperties) {
@@ -493,7 +498,7 @@
* @param groupTypeDefinition
* @return
*/
- private Either<GroupTypeData, TitanOperationStatus> addGroupTypeToGraph(GroupTypeDefinition groupTypeDefinition) {
+ private Either<GroupTypeData, JanusGraphOperationStatus> addGroupTypeToGraph(GroupTypeDefinition groupTypeDefinition) {
log.debug("Got group type {}", groupTypeDefinition);
@@ -503,18 +508,19 @@
log.debug("Before adding group type to graph. groupTypeData = {}", groupTypeData);
- Either<GroupTypeData, TitanOperationStatus> createGTResult = titanGenericDao.createNode(groupTypeData, GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> createGTResult = janusGraphGenericDao
+ .createNode(groupTypeData, GroupTypeData.class);
log.debug("After adding group type to graph. status is = {}", createGTResult);
if (createGTResult.isRight()) {
- TitanOperationStatus operationStatus = createGTResult.right().value();
+ JanusGraphOperationStatus operationStatus = createGTResult.right().value();
log.error("Failed to add group type {} to graph. status is {}", groupTypeDefinition.getType(), operationStatus);
return Either.right(operationStatus);
}
GroupTypeData resultCTD = createGTResult.left().value();
List<PropertyDefinition> properties = groupTypeDefinition.getProperties();
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToCapablityType = propertyOperation.addPropertiesToElementType(resultCTD.getUniqueId(), NodeTypeEnum.GroupType, properties);
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToCapablityType = propertyOperation.addPropertiesToElementType(resultCTD.getUniqueId(), NodeTypeEnum.GroupType, properties);
if (addPropertiesToCapablityType.isRight()) {
log.error("Failed add properties {} to capability {}", properties, groupTypeDefinition.getType());
return Either.right(addPropertiesToCapablityType.right().value());
@@ -522,7 +528,7 @@
String derivedFrom = groupTypeDefinition.getDerivedFrom();
if (derivedFrom != null) {
- Either<GraphRelation, TitanOperationStatus> createRelation = connectToDerivedFrom(ctUniqueId, derivedFrom);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = connectToDerivedFrom(ctUniqueId, derivedFrom);
if (createRelation.isRight()) {
return Either.right(createRelation.right().value());
}
@@ -530,8 +536,8 @@
Map<String, CapabilityDefinition> groupCapTypes = groupTypeDefinition.getCapabilities();
if (!MapUtils.isEmpty(groupCapTypes)) {
- TitanOperationStatus status = createCapabilities(groupTypeData, groupCapTypes);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = createCapabilities(groupTypeData, groupCapTypes);
+ if (status != JanusGraphOperationStatus.OK) {
return Either.right(status);
}
}
@@ -541,21 +547,23 @@
}
- private Either<GraphRelation, TitanOperationStatus> connectToDerivedFrom(String ctUniqueId, String derivedFrom) {
+ private Either<GraphRelation, JanusGraphOperationStatus> connectToDerivedFrom(String ctUniqueId, String derivedFrom) {
log.debug("Before creating relation between Group Type with id {} to its parent {}", ctUniqueId, derivedFrom);
- Either<GroupTypeData, TitanOperationStatus> derivedFromGroupTypeResult =
- titanGenericDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), derivedFrom, GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> derivedFromGroupTypeResult =
+ janusGraphGenericDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), derivedFrom, GroupTypeData.class);
if (derivedFromGroupTypeResult.isLeft()) {
UniqueIdData from = new UniqueIdData(NodeTypeEnum.GroupType, ctUniqueId);
GroupTypeData to = derivedFromGroupTypeResult.left().value();
- Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphGenericDao
+ .createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null);
log.debug("After create relation between Group Type with id {} to its parent {}, status is {}.", ctUniqueId, derivedFrom, createRelation);
return createRelation;
} else {
- TitanOperationStatus status = derivedFromGroupTypeResult.right().value();
+ JanusGraphOperationStatus status = derivedFromGroupTypeResult.right().value();
log.debug("Failed to found parent Group Type {}, stauts is {}.", derivedFrom, status);
return Either.right(status);
}
@@ -579,23 +587,29 @@
public Either<Boolean, StorageOperationStatus> isCapabilityTypeDerivedFrom(String childCandidateType, String parentCandidateType) {
Map<String, Object> propertiesToMatch = new HashMap<>();
propertiesToMatch.put(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), childCandidateType);
- Either<List<CapabilityTypeData>, TitanOperationStatus> getResponse = titanGenericDao.getByCriteria(NodeTypeEnum.CapabilityType, propertiesToMatch, CapabilityTypeData.class);
+ Either<List<CapabilityTypeData>, JanusGraphOperationStatus> getResponse = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.CapabilityType, propertiesToMatch, CapabilityTypeData.class);
if (getResponse.isRight()) {
- TitanOperationStatus titanOperationStatus = getResponse.right().value();
- log.debug("Couldn't fetch capability type {}, error: {}", childCandidateType, titanOperationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ JanusGraphOperationStatus janusGraphOperationStatus = getResponse.right().value();
+ log.debug("Couldn't fetch capability type {}, error: {}", childCandidateType,
+ janusGraphOperationStatus);
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
}
String childUniqueId = getResponse.left().value().get(0).getUniqueId();
Set<String> travelledTypes = new HashSet<>();
do {
travelledTypes.add(childUniqueId);
- Either<List<ImmutablePair<CapabilityTypeData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), childUniqueId, GraphEdgeLabels.DERIVED_FROM,
+ Either<List<ImmutablePair<CapabilityTypeData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), childUniqueId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
if (childrenNodes.isRight()) {
- if (childrenNodes.right().value() != TitanOperationStatus.NOT_FOUND) {
- TitanOperationStatus titanOperationStatus = getResponse.right().value();
- log.debug("Couldn't fetch derived from node for capability type {}, error: {}", childCandidateType, titanOperationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ if (childrenNodes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = getResponse.right().value();
+ log.debug("Couldn't fetch derived from node for capability type {}, error: {}", childCandidateType,
+ janusGraphOperationStatus);
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
} else {
log.debug("Derived from node is not found for type {} - this is OK for root capability.", childCandidateType);
return Either.left(false);
@@ -627,9 +641,9 @@
private Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeOnGraph(GroupTypeDefinition updatedGroupType, GroupTypeDefinition currGroupType) {
updateGroupTypeData(updatedGroupType, currGroupType);
- return titanGenericDao.updateNode(new GroupTypeData(updatedGroupType), GroupTypeData.class)
+ return janusGraphGenericDao.updateNode(new GroupTypeData(updatedGroupType), GroupTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(updatedNode -> updateGroupProperties(updatedGroupType.getUniqueId(), updatedGroupType.getProperties()))
.left()
@@ -649,7 +663,7 @@
.collect(Collectors.toMap(PropertyDefinition::getName, Function.identity())): null;
return propertyOperation.mergePropertiesAssociatedToNode(NodeTypeEnum.GroupType, groupId, mapProperties)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
index 6d050af..823c33a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
@@ -25,10 +25,10 @@
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
import org.openecomp.sdc.be.model.heat.HeatParameterType;
@@ -55,27 +55,28 @@
private static final Logger log = Logger.getLogger(HeatParametersOperation.class.getName());
@javax.annotation.Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public TitanGenericDao getTitanGenericDao() {
- return titanGenericDao;
+ public JanusGraphGenericDao getJanusGraphGenericDao() {
+ return janusGraphGenericDao;
}
- public void setTitanGenericDao(TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
public StorageOperationStatus getHeatParametersOfNode(NodeTypeEnum nodeType, String uniqueId, List<HeatParameterDefinition> properties) {
- Either<List<ImmutablePair<HeatParameterData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.HEAT_PARAMETER, NodeTypeEnum.HeatParameter,
+ Either<List<ImmutablePair<HeatParameterData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.HEAT_PARAMETER, NodeTypeEnum.HeatParameter,
HeatParameterData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus status = childrenNodes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childrenNodes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
List<ImmutablePair<HeatParameterData, GraphEdge>> values = childrenNodes.left().value();
@@ -103,15 +104,16 @@
public StorageOperationStatus getParametersValueNodes(NodeTypeEnum parentNodeType, String parentUniqueId, List<HeatParameterValueData> heatValues) {
- Either<List<ImmutablePair<HeatParameterValueData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentUniqueId, GraphEdgeLabels.PARAMETER_VALUE,
+ Either<List<ImmutablePair<HeatParameterValueData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(parentNodeType), parentUniqueId, GraphEdgeLabels.PARAMETER_VALUE,
NodeTypeEnum.HeatParameterValue, HeatParameterValueData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus status = childrenNodes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = childrenNodes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
List<ImmutablePair<HeatParameterValueData, GraphEdge>> values = childrenNodes.left().value();
@@ -144,14 +146,14 @@
for (HeatParameterDefinition propertyDefinition : heatParams) {
String propertyUid = propertyDefinition.getUniqueId();
- Either<HeatParameterData, TitanOperationStatus> deletePropertyRes = deleteHeatParameterFromGraph(propertyUid);
+ Either<HeatParameterData, JanusGraphOperationStatus> deletePropertyRes = deleteHeatParameterFromGraph(propertyUid);
if (deletePropertyRes.isRight()) {
log.error("Failed to delete heat parameter with id {}", propertyUid);
- TitanOperationStatus status = deletePropertyRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = deletePropertyRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
@@ -173,14 +175,14 @@
for (HeatParameterValueData propertyDefinition : heatValues) {
String propertyUid = (String) propertyDefinition.getUniqueId();
- Either<HeatParameterValueData, TitanOperationStatus> deletePropertyRes = deleteHeatParameterValueFromGraph(propertyUid);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> deletePropertyRes = deleteHeatParameterValueFromGraph(propertyUid);
if (deletePropertyRes.isRight()) {
log.error("Failed to delete heat parameter value with id {}", propertyUid);
- TitanOperationStatus status = deletePropertyRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = deletePropertyRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
}
@@ -189,14 +191,15 @@
return StorageOperationStatus.OK;
}
- private Either<HeatParameterData, TitanOperationStatus> deleteHeatParameterFromGraph(String propertyId) {
+ private Either<HeatParameterData, JanusGraphOperationStatus> deleteHeatParameterFromGraph(String propertyId) {
log.debug("Before deleting heat parameter from graph {}" , propertyId);
- return titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.HeatParameter), propertyId, HeatParameterData.class);
+ return janusGraphGenericDao
+ .deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.HeatParameter), propertyId, HeatParameterData.class);
}
- private Either<HeatParameterValueData, TitanOperationStatus> deleteHeatParameterValueFromGraph(String propertyId) {
+ private Either<HeatParameterValueData, JanusGraphOperationStatus> deleteHeatParameterValueFromGraph(String propertyId) {
log.debug("Before deleting heat parameter from graph {}" , propertyId);
- return titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.HeatParameterValue), propertyId, HeatParameterValueData.class);
+ return janusGraphGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.HeatParameterValue), propertyId, HeatParameterValueData.class);
}
@Override
@@ -207,10 +210,10 @@
String propertyName = propertyDefinition.getName();
- Either<HeatParameterData, TitanOperationStatus> addPropertyToGraph = addPropertyToGraph(propertyName, propertyDefinition, parentId, nodeType);
+ Either<HeatParameterData, JanusGraphOperationStatus> addPropertyToGraph = addPropertyToGraph(propertyName, propertyDefinition, parentId, nodeType);
if (addPropertyToGraph.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyToGraph.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertyToGraph.right().value());
}
}
}
@@ -228,17 +231,18 @@
for (HeatParameterDefinition property : properties) {
HeatParameterData heatParameterData = new HeatParameterData(property);
- Either<HeatParameterData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(heatParameterData, HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(heatParameterData, HeatParameterData.class);
if (updateNode.isRight()) {
log.debug("failed to update heat parameter in graph. id = {}", property.getUniqueId());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateNode.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateNode.right().value());
}
}
return StorageOperationStatus.OK;
}
- public Either<HeatParameterData, TitanOperationStatus> addPropertyToGraph(String propertyName, HeatParameterDefinition propertyDefinition, String parentId, NodeTypeEnum nodeType) {
+ public Either<HeatParameterData, JanusGraphOperationStatus> addPropertyToGraph(String propertyName, HeatParameterDefinition propertyDefinition, String parentId, NodeTypeEnum nodeType) {
UniqueIdData parentNode = new UniqueIdData(nodeType, parentId);
@@ -246,19 +250,21 @@
HeatParameterData propertyData = new HeatParameterData(propertyDefinition);
log.debug("Before adding property to graph {}" , propertyData);
- Either<HeatParameterData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyData, HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(propertyData, HeatParameterData.class);
log.debug("After adding property to graph {}" , propertyData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add property {} to graph. status is {}", propertyName, operationStatus);
return Either.right(operationStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), propertyName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(parentNode, propertyData, GraphEdgeLabels.HEAT_PARAMETER, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(parentNode, propertyData, GraphEdgeLabels.HEAT_PARAMETER, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate {} {} to heat parameter {} in graph. status is {}", nodeType.getName(), parentId, propertyName, operationStatus);
return Either.right(operationStatus);
}
@@ -371,7 +377,8 @@
@Override
public Either<HeatParameterValueData, StorageOperationStatus> updateHeatParameterValue(HeatParameterDefinition heatParam, String artifactId, String resourceInstanceId, String artifactLabel) {
String heatEnvId = UniqueIdBuilder.buildHeatParameterValueUniqueId(resourceInstanceId, artifactLabel, heatParam.getName());
- Either<HeatParameterValueData, TitanOperationStatus> getNode = titanGenericDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), heatEnvId, HeatParameterValueData.class);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> getNode = janusGraphGenericDao
+ .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), heatEnvId, HeatParameterValueData.class);
if (getNode.isRight() || getNode.left().value() == null) {
if (heatParam.getCurrentValue() == null || (heatParam.getDefaultValue() != null && heatParam.getCurrentValue().equals(heatParam.getDefaultValue()))) {
log.debug("Updated heat parameter value equals default value. No need to create heat parameter value for heat parameter {}", heatParam.getUniqueId());
@@ -388,15 +395,17 @@
HeatParameterValueData heatParameterValue = new HeatParameterValueData();
heatParameterValue.setUniqueId(heatParam.getUniqueId());
if (heatParam.getCurrentValue() == null || (heatParam.getDefaultValue() != null && heatParam.getCurrentValue().equals(heatParam.getDefaultValue()))) {
- Either<GraphRelation, TitanOperationStatus> deleteParameterValueIncomingRelation = titanGenericDao.deleteIncomingRelationByCriteria(heatParameterValue, GraphEdgeLabels.PARAMETER_VALUE, null);
+ Either<GraphRelation, JanusGraphOperationStatus> deleteParameterValueIncomingRelation = janusGraphGenericDao
+ .deleteIncomingRelationByCriteria(heatParameterValue, GraphEdgeLabels.PARAMETER_VALUE, null);
if (deleteParameterValueIncomingRelation.isRight()) {
log.debug("Failed to delete heat parameter value incoming relation on graph. id = {}", heatParameterValue.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(deleteParameterValueIncomingRelation.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteParameterValueIncomingRelation.right().value()));
}
- Either<Edge, TitanOperationStatus> getOutgoingRelation = titanGenericDao.getOutgoingEdgeByCriteria(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) heatParameterValue.getUniqueId(), GraphEdgeLabels.PARAMETER_IMPL, null);
+ Either<Edge, JanusGraphOperationStatus> getOutgoingRelation = janusGraphGenericDao
+ .getOutgoingEdgeByCriteria(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) heatParameterValue.getUniqueId(), GraphEdgeLabels.PARAMETER_IMPL, null);
if (getOutgoingRelation.isRight()) {
log.debug("Failed to get heat parameter value outgoing relation from graph. id = {}", heatParameterValue.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getOutgoingRelation.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getOutgoingRelation.right().value()));
}
Edge edge = getOutgoingRelation.left().value();
if (edge == null) {
@@ -405,33 +414,35 @@
}
edge.remove();
- Either<HeatParameterValueData, TitanOperationStatus> deleteNode = titanGenericDao.deleteNode(heatParameterValue, HeatParameterValueData.class);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> deleteNode = janusGraphGenericDao
+ .deleteNode(heatParameterValue, HeatParameterValueData.class);
if (deleteNode.isRight()) {
log.debug("Failed to delete heat parameter value on graph. id = {}", heatParameterValue.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(deleteNode.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(deleteNode.right().value()));
}
return Either.left(deleteNode.left().value());
}
heatParameterValue.setValue(heatParam.getCurrentValue());
- Either<HeatParameterValueData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(heatParameterValue, HeatParameterValueData.class);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(heatParameterValue, HeatParameterValueData.class);
if (updateNode.isRight()) {
log.debug("Failed to update heat parameter value in graph. id = {}", heatParameterValue.getUniqueId());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateNode.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateNode.right().value()));
}
return Either.left(updateNode.left().value());
}
public Either<HeatParameterValueData, StorageOperationStatus> createHeatParameterValue(HeatParameterDefinition heatParam, String artifactId, String resourceInstanceId, String artifactLabel) {
- Either<HeatParameterValueData, TitanOperationStatus> addHeatValueToGraph = addHeatValueToGraph(heatParam, artifactLabel, artifactId, resourceInstanceId);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> addHeatValueToGraph = addHeatValueToGraph(heatParam, artifactLabel, artifactId, resourceInstanceId);
if (addHeatValueToGraph.isRight()) {
log.debug("Failed to create heat parameters value on graph for artifact {}", artifactId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addHeatValueToGraph.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addHeatValueToGraph.right().value()));
}
return Either.left(addHeatValueToGraph.left().value());
}
- public Either<HeatParameterValueData, TitanOperationStatus> addHeatValueToGraph(HeatParameterDefinition heatParameter, String artifactLabel, String artifactId, String resourceInstanceId) {
+ public Either<HeatParameterValueData, JanusGraphOperationStatus> addHeatValueToGraph(HeatParameterDefinition heatParameter, String artifactLabel, String artifactId, String resourceInstanceId) {
UniqueIdData heatEnvNode = new UniqueIdData(NodeTypeEnum.ArtifactRef, artifactId);
HeatParameterValueData heatValueData = new HeatParameterValueData();
@@ -439,26 +450,29 @@
heatValueData.setValue(heatParameter.getCurrentValue());
log.debug("Before adding property to graph {}", heatValueData);
- Either<HeatParameterValueData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(heatValueData, HeatParameterValueData.class);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(heatValueData, HeatParameterValueData.class);
log.debug("After adding property to graph {}", heatValueData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add heat value {} to graph. status is {}", heatValueData.getUniqueId(), operationStatus);
return Either.right(operationStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), heatParameter.getName());
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(heatEnvNode, heatValueData, GraphEdgeLabels.PARAMETER_VALUE, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(heatEnvNode, heatValueData, GraphEdgeLabels.PARAMETER_VALUE, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate heat value {} to heat env artifact {} in graph. status is {}", heatValueData.getUniqueId(), artifactId, operationStatus);
return Either.right(operationStatus);
}
UniqueIdData heatParameterNode = new UniqueIdData(NodeTypeEnum.HeatParameter, heatParameter.getUniqueId());
- Either<GraphRelation, TitanOperationStatus> createRel2Result = titanGenericDao.createRelation(heatValueData, heatParameterNode, GraphEdgeLabels.PARAMETER_IMPL, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRel2Result = janusGraphGenericDao
+ .createRelation(heatValueData, heatParameterNode, GraphEdgeLabels.PARAMETER_IMPL, null);
if (createRel2Result.isRight()) {
- TitanOperationStatus operationStatus = createRel2Result.right().value();
+ JanusGraphOperationStatus operationStatus = createRel2Result.right().value();
log.error("Failed to associate heat value {} to heat parameter {} in graph. status is {}", heatValueData.getUniqueId(), heatParameter.getName(), operationStatus);
return Either.right(operationStatus);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java
index 9c5445a..b9a4c7f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java
@@ -26,10 +26,10 @@
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.operations.api.IInputsOperation;
@@ -48,20 +48,22 @@
@Autowired
PropertyOperation propertyOperation;
- public <ElementDefinition> TitanOperationStatus findAllResourceElementsDefinitionRecursively(String resourceId, List<ElementDefinition> elements, NodeElementFetcher<ElementDefinition> singleNodeFetcher) {
+ public <ElementDefinition> JanusGraphOperationStatus findAllResourceElementsDefinitionRecursively(String resourceId, List<ElementDefinition> elements, NodeElementFetcher<ElementDefinition> singleNodeFetcher) {
log.trace("Going to fetch elements under resource {}" , resourceId);
- TitanOperationStatus resourceAttributesStatus = singleNodeFetcher.findAllNodeElements(resourceId, elements);
+ JanusGraphOperationStatus
+ resourceAttributesStatus = singleNodeFetcher.findAllNodeElements(resourceId, elements);
- if (resourceAttributesStatus != TitanOperationStatus.OK) {
+ if (resourceAttributesStatus != JanusGraphOperationStatus.OK) {
return resourceAttributesStatus;
}
- Either<ImmutablePair<ResourceMetadataData, GraphEdge>, TitanOperationStatus> parentNodes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource, ResourceMetadataData.class);
+ Either<ImmutablePair<ResourceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource, ResourceMetadataData.class);
if (parentNodes.isRight()) {
- TitanOperationStatus parentNodesStatus = parentNodes.right().value();
- if (parentNodesStatus != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus parentNodesStatus = parentNodes.right().value();
+ if (parentNodesStatus != JanusGraphOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance().logInternalFlowError("findAllResourceElementsDefinitionRecursively", "Failed to find parent elements of resource " + resourceId + ". status is " + parentNodesStatus, ErrorSeverity.ERROR);
return parentNodesStatus;
}
@@ -70,26 +72,26 @@
if (parentNodes.isLeft()) {
ImmutablePair<ResourceMetadataData, GraphEdge> parnetNodePair = parentNodes.left().value();
String parentUniqueId = parnetNodePair.getKey().getMetadataDataDefinition().getUniqueId();
- TitanOperationStatus addParentIntStatus = findAllResourceElementsDefinitionRecursively(parentUniqueId, elements, singleNodeFetcher);
+ JanusGraphOperationStatus addParentIntStatus = findAllResourceElementsDefinitionRecursively(parentUniqueId, elements, singleNodeFetcher);
- if (addParentIntStatus != TitanOperationStatus.OK) {
+ if (addParentIntStatus != JanusGraphOperationStatus.OK) {
BeEcompErrorManager.getInstance().logInternalFlowError("findAllResourceElementsDefinitionRecursively", "Failed to find all resource elements of resource " + parentUniqueId, ErrorSeverity.ERROR);
return addParentIntStatus;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
@Override
- public ImmutablePair<TitanOperationStatus, String> findInputValue(String resourceInstanceId, String propertyId) {
+ public ImmutablePair<JanusGraphOperationStatus, String> findInputValue(String resourceInstanceId, String propertyId) {
log.debug("Going to check whether the property {} already added to resource instance {}", propertyId, resourceInstanceId);
- Either<List<ComponentInstanceInput>, TitanOperationStatus> getAllRes = getAllInputsOfResourceInstanceOnlyInputDefId(resourceInstanceId);
+ Either<List<ComponentInstanceInput>, JanusGraphOperationStatus> getAllRes = getAllInputsOfResourceInstanceOnlyInputDefId(resourceInstanceId);
if (getAllRes.isRight()) {
- TitanOperationStatus status = getAllRes.right().value();
+ JanusGraphOperationStatus status = getAllRes.right().value();
log.trace("After fetching all properties of resource instance {}. Status is {}" ,resourceInstanceId, status);
return new ImmutablePair<>(status, null);
}
@@ -102,12 +104,12 @@
log.trace("Go over property {} under resource instance {}. valueUniqueId = {}" ,propertyUniqueId, resourceInstanceId, valueUniqueUid);
if (propertyId.equals(propertyUniqueId) && valueUniqueUid != null) {
log.debug("The property {} already created under resource instance {}", propertyId, resourceInstanceId);
- return new ImmutablePair<>(TitanOperationStatus.ALREADY_EXIST, valueUniqueUid);
+ return new ImmutablePair<>(JanusGraphOperationStatus.ALREADY_EXIST, valueUniqueUid);
}
}
}
- return new ImmutablePair<>(TitanOperationStatus.NOT_FOUND, null);
+ return new ImmutablePair<>(JanusGraphOperationStatus.NOT_FOUND, null);
}
/**
@@ -116,34 +118,36 @@
* @param resourceInstanceUid
* @return
*/
- public Either<List<ComponentInstanceInput>, TitanOperationStatus> getAllInputsOfResourceInstanceOnlyInputDefId(String resourceInstanceUid) {
+ public Either<List<ComponentInstanceInput>, JanusGraphOperationStatus> getAllInputsOfResourceInstanceOnlyInputDefId(String resourceInstanceUid) {
return getAllInputsOfResourceInstanceOnlyInputDefId(resourceInstanceUid, NodeTypeEnum.ResourceInstance);
}
- public Either<List<ComponentInstanceInput>, TitanOperationStatus> getAllInputsOfResourceInstanceOnlyInputDefId(String resourceInstanceUid, NodeTypeEnum instanceNodeType) {
+ public Either<List<ComponentInstanceInput>, JanusGraphOperationStatus> getAllInputsOfResourceInstanceOnlyInputDefId(String resourceInstanceUid, NodeTypeEnum instanceNodeType) {
- Either<ComponentInstanceData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, ComponentInstanceData.class);
+ Either<ComponentInstanceData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, ComponentInstanceData.class);
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
- Either<List<ImmutablePair<InputValueData, GraphEdge>>, TitanOperationStatus> propertyImplNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, GraphEdgeLabels.INPUT_VALUE, NodeTypeEnum.InputValue, InputValueData.class);
+ Either<List<ImmutablePair<InputValueData, GraphEdge>>, JanusGraphOperationStatus> propertyImplNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, GraphEdgeLabels.INPUT_VALUE, NodeTypeEnum.InputValue, InputValueData.class);
if (propertyImplNodes.isRight()) {
- TitanOperationStatus status = propertyImplNodes.right().value();
+ JanusGraphOperationStatus status = propertyImplNodes.right().value();
return Either.right(status);
}
List<ImmutablePair<InputValueData, GraphEdge>> list = propertyImplNodes.left().value();
if (list == null || list.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
List<ComponentInstanceInput> result = new ArrayList<>();
@@ -155,7 +159,8 @@
String propertyValueUid = propertyValueData.getUniqueId();
String value = propertyValueData.getValue();
- Either<ImmutablePair<InputsData, GraphEdge>, TitanOperationStatus> inputNodes = titanGenericDao.getParentNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), propertyValueData.getUniqueId(), GraphEdgeLabels.GET_INPUT, NodeTypeEnum.Input, InputsData.class);
+ Either<ImmutablePair<InputsData, GraphEdge>, JanusGraphOperationStatus> inputNodes = janusGraphGenericDao
+ .getParentNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), propertyValueData.getUniqueId(), GraphEdgeLabels.GET_INPUT, NodeTypeEnum.Input, InputsData.class);
if (inputNodes.isRight()) {
@@ -165,25 +170,28 @@
InputsData input = inputNodes.left().value().left;
String inputId = input.getPropertyDataDefinition().getUniqueId();
- Either<ImmutablePair<PropertyData, GraphEdge>, TitanOperationStatus> propertyDefRes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.InputValue), propertyValueUid, GraphEdgeLabels.INPUT_IMPL, NodeTypeEnum.Property, PropertyData.class);
+ Either<ImmutablePair<PropertyData, GraphEdge>, JanusGraphOperationStatus> propertyDefRes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.InputValue), propertyValueUid, GraphEdgeLabels.INPUT_IMPL, NodeTypeEnum.Property, PropertyData.class);
if (propertyDefRes.isRight()) {
- TitanOperationStatus status = propertyDefRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = propertyDefRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
ImmutablePair<PropertyData, GraphEdge> propertyDefPair = propertyDefRes.left().value();
PropertyData propertyData = propertyDefPair.left;
- Either<Edge, TitanOperationStatus> inputsEges = titanGenericDao.getIncomingEdgeByCriteria(propertyData, GraphEdgeLabels.INPUT, null);
+ Either<Edge, JanusGraphOperationStatus> inputsEges = janusGraphGenericDao
+ .getIncomingEdgeByCriteria(propertyData, GraphEdgeLabels.INPUT, null);
if (inputsEges.isRight()) {
- TitanOperationStatus status = inputsEges.right().value();
+ JanusGraphOperationStatus status = inputsEges.right().value();
return Either.right(status);
}
Edge edge = inputsEges.left().value();
- String inputName = (String) titanGenericDao.getProperty(edge, GraphEdgePropertiesDictionary.NAME.getProperty());
+ String inputName = (String) janusGraphGenericDao
+ .getProperty(edge, GraphEdgePropertiesDictionary.NAME.getProperty());
ComponentInstanceInput resourceInstanceProperty = new ComponentInstanceInput(propertyData.getPropertyDataDefinition(), inputId, value, propertyValueUid);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
index ab2eb03..b9e95c5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
@@ -24,10 +24,10 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -63,7 +63,7 @@
private ArtifactOperation artifactOperation;
@javax.annotation.Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Override
public Either<InterfaceDefinition, StorageOperationStatus> addInterfaceToResource(InterfaceDefinition interf, String resourceId, String interfaceName, boolean inTransaction) {
@@ -72,27 +72,29 @@
}
- private Either<OperationData, TitanOperationStatus> addOperationToGraph(InterfaceDefinition interf, String opName, Operation op, InterfaceData interfaceData) {
+ private Either<OperationData, JanusGraphOperationStatus> addOperationToGraph(InterfaceDefinition interf, String opName, Operation op, InterfaceData interfaceData) {
op.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId((String) interfaceData.getUniqueId(), opName));
OperationData operationData = new OperationData(op);
log.debug("Before adding operation to graph {}", operationData);
- Either<OperationData, TitanOperationStatus> createOpNodeResult = titanGenericDao.createNode(operationData, OperationData.class);
+ Either<OperationData, JanusGraphOperationStatus> createOpNodeResult = janusGraphGenericDao
+ .createNode(operationData, OperationData.class);
log.debug("After adding operation to graph {}", operationData);
if (createOpNodeResult.isRight()) {
- TitanOperationStatus opStatus = createOpNodeResult.right().value();
+ JanusGraphOperationStatus opStatus = createOpNodeResult.right().value();
log.error("Failed to add operation {} to graph. status is {}", opName, opStatus);
return Either.right(opStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), opName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(interfaceData, operationData, GraphEdgeLabels.INTERFACE_OPERATION, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(interfaceData, operationData, GraphEdgeLabels.INTERFACE_OPERATION, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createOpNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createOpNodeResult.right().value();
log.error("Failed to associate operation {} to property {} in graph. status is {}", interfaceData.getUniqueId(), opName, operationStatus);
return Either.right(operationStatus);
@@ -118,7 +120,7 @@
}
- private Either<InterfaceData, TitanOperationStatus> addInterfaceToGraph(InterfaceDefinition interfaceInfo, String interfaceName, String resourceId) {
+ private Either<InterfaceData, JanusGraphOperationStatus> addInterfaceToGraph(InterfaceDefinition interfaceInfo, String interfaceName, String resourceId) {
InterfaceData interfaceData = new InterfaceData(interfaceInfo);
@@ -129,33 +131,36 @@
interfaceInfo.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(resourceId, interfaceNameSplitted));
- Either<InterfaceData, TitanOperationStatus> existInterface = titanGenericDao.getNode(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> existInterface = janusGraphGenericDao
+ .getNode(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), InterfaceData.class);
if (existInterface.isRight()) {
return createInterfaceNodeAndRelation(interfaceNameSplitted, resourceId, interfaceData, resourceData);
} else {
log.debug("Interface {} already exist", interfaceData.getUniqueId());
- return Either.right(TitanOperationStatus.ALREADY_EXIST);
+ return Either.right(JanusGraphOperationStatus.ALREADY_EXIST);
}
}
- private Either<InterfaceData, TitanOperationStatus> createInterfaceNodeAndRelation(String interfaceName, String resourceId, InterfaceData interfaceData, ResourceMetadataData resourceData) {
+ private Either<InterfaceData, JanusGraphOperationStatus> createInterfaceNodeAndRelation(String interfaceName, String resourceId, InterfaceData interfaceData, ResourceMetadataData resourceData) {
log.debug("Before adding interface to graph {}", interfaceData);
- Either<InterfaceData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(interfaceData, InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(interfaceData, InterfaceData.class);
log.debug("After adding property to graph {}", interfaceData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add interface {} to graph. status is {}", interfaceName, operationStatus);
return Either.right(operationStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), interfaceName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(resourceData, interfaceData, GraphEdgeLabels.INTERFACE, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(resourceData, interfaceData, GraphEdgeLabels.INTERFACE, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to associate resource {} to property {} in graph. status is {}", resourceId, interfaceName, operationStatus);
return Either.right(operationStatus);
@@ -164,22 +169,24 @@
return Either.left(createNodeResult.left().value());
}
- private Either<OperationData, TitanOperationStatus> createOperationNodeAndRelation(String operationName, OperationData operationData, InterfaceData interfaceData) {
+ private Either<OperationData, JanusGraphOperationStatus> createOperationNodeAndRelation(String operationName, OperationData operationData, InterfaceData interfaceData) {
log.debug("Before adding operation to graph {}", operationData);
- Either<OperationData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(operationData, OperationData.class);
+ Either<OperationData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(operationData, OperationData.class);
log.debug("After adding operation to graph {}", interfaceData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add interfoperationce {} to graph. status is {}", operationName, operationStatus);
return Either.right(operationStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), operationName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(interfaceData, operationData, GraphEdgeLabels.INTERFACE_OPERATION, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(interfaceData, operationData, GraphEdgeLabels.INTERFACE_OPERATION, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to associate operation {} to interface {} in graph. status is {}", operationName, interfaceData.getUniqueId(), operationStatus);
return Either.right(operationStatus);
@@ -205,15 +212,15 @@
return result;
}
- TitanOperationStatus findInterfacesRes = TitanOperationStatus.GENERAL_ERROR;
+ JanusGraphOperationStatus findInterfacesRes = JanusGraphOperationStatus.GENERAL_ERROR;
if (recursively) {
findInterfacesRes = findAllInterfacesRecursively(resourceId, interfaces);
} else {
findInterfacesRes = findAllInterfacesNotRecursively(resourceId, interfaces);
}
- if (!findInterfacesRes.equals(TitanOperationStatus.OK)) {
+ if (!findInterfacesRes.equals(JanusGraphOperationStatus.OK)) {
log.error("Failed to get all interfaces of resource {}. status is {}", resourceId, findInterfacesRes);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(findInterfacesRes));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findInterfacesRes));
return result;
}
result = Either.left(interfaces);
@@ -222,23 +229,24 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
}
- private TitanOperationStatus findAllInterfacesNotRecursively(String resourceId, Map<String, InterfaceDefinition> interfaces) {
+ private JanusGraphOperationStatus findAllInterfacesNotRecursively(String resourceId, Map<String, InterfaceDefinition> interfaces) {
- Either<List<ImmutablePair<InterfaceData, GraphEdge>>, TitanOperationStatus> interfaceNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.INTERFACE,
+ Either<List<ImmutablePair<InterfaceData, GraphEdge>>, JanusGraphOperationStatus> interfaceNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.INTERFACE,
NodeTypeEnum.Interface, InterfaceData.class);
if (interfaceNodes.isRight()) {
- TitanOperationStatus status = interfaceNodes.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = interfaceNodes.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return status;
}
} else {
@@ -246,15 +254,15 @@
if (interfaceList != null) {
for (ImmutablePair<InterfaceData, GraphEdge> interfacePair : interfaceList) {
String interfaceUniqueId = (String) interfacePair.getKey().getUniqueId();
- Either<String, TitanOperationStatus> interfaceNameRes = getPropertyValueFromEdge(interfacePair.getValue(), GraphPropertiesDictionary.NAME);
+ Either<String, JanusGraphOperationStatus> interfaceNameRes = getPropertyValueFromEdge(interfacePair.getValue(), GraphPropertiesDictionary.NAME);
if (interfaceNameRes.isRight()) {
log.error("The requirement name is missing on the edge of requirement {}", interfaceUniqueId);
return interfaceNameRes.right().value();
}
String interfaceName = interfaceNameRes.left().value();
- Either<InterfaceDefinition, TitanOperationStatus> interfaceDefRes = getNonRecursiveInterface(interfacePair.getKey());
+ Either<InterfaceDefinition, JanusGraphOperationStatus> interfaceDefRes = getNonRecursiveInterface(interfacePair.getKey());
if (interfaceDefRes.isRight()) {
- TitanOperationStatus status = interfaceDefRes.right().value();
+ JanusGraphOperationStatus status = interfaceDefRes.right().value();
log.error("Failed to get interface actions of interface {}", interfaceUniqueId);
return status;
}
@@ -271,24 +279,26 @@
}
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- public TitanOperationStatus findAllInterfacesRecursively(String resourceId, Map<String, InterfaceDefinition> interfaces) {
+ public JanusGraphOperationStatus findAllInterfacesRecursively(String resourceId, Map<String, InterfaceDefinition> interfaces) {
- TitanOperationStatus findAllInterfacesNotRecursively = findAllInterfacesNotRecursively(resourceId, interfaces);
- if (!findAllInterfacesNotRecursively.equals(TitanOperationStatus.OK)) {
+ JanusGraphOperationStatus
+ findAllInterfacesNotRecursively = findAllInterfacesNotRecursively(resourceId, interfaces);
+ if (!findAllInterfacesNotRecursively.equals(JanusGraphOperationStatus.OK)) {
log.error("failed to get interfaces for resource {}. status is {}", resourceId, findAllInterfacesNotRecursively);
}
- Either<ImmutablePair<ResourceMetadataData, GraphEdge>, TitanOperationStatus> parentNodes = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
+ Either<ImmutablePair<ResourceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
ResourceMetadataData.class);
if (parentNodes.isRight()) {
- TitanOperationStatus parentNodesStatus = parentNodes.right().value();
- if (parentNodesStatus == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus parentNodesStatus = parentNodes.right().value();
+ if (parentNodesStatus == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Finish to lookup for parnet interfaces");
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
} else {
log.error("Failed to find parent interfaces of resource {}. status is {}", resourceId, parentNodesStatus);
return parentNodesStatus;
@@ -296,42 +306,44 @@
}
ImmutablePair<ResourceMetadataData, GraphEdge> parnetNodePair = parentNodes.left().value();
String parentUniqueId = parnetNodePair.getKey().getMetadataDataDefinition().getUniqueId();
- TitanOperationStatus addParentIntStatus = findAllInterfacesRecursively(parentUniqueId, interfaces);
+ JanusGraphOperationStatus
+ addParentIntStatus = findAllInterfacesRecursively(parentUniqueId, interfaces);
- if (addParentIntStatus != TitanOperationStatus.OK) {
+ if (addParentIntStatus != JanusGraphOperationStatus.OK) {
log.error("Failed to fetch all interfaces of resource {}", parentUniqueId);
return addParentIntStatus;
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private Either<String, TitanOperationStatus> getPropertyValueFromEdge(GraphEdge edge, GraphPropertiesDictionary property) {
+ private Either<String, JanusGraphOperationStatus> getPropertyValueFromEdge(GraphEdge edge, GraphPropertiesDictionary property) {
Map<String, Object> edgeProps = edge.getProperties();
String interfaceName = null;
if (edgeProps != null) {
interfaceName = (String) edgeProps.get(property.getProperty());
if (interfaceName == null) {
- return Either.right(TitanOperationStatus.INVALID_ELEMENT);
+ return Either.right(JanusGraphOperationStatus.INVALID_ELEMENT);
}
} else {
- return Either.right(TitanOperationStatus.INVALID_ELEMENT);
+ return Either.right(JanusGraphOperationStatus.INVALID_ELEMENT);
}
return Either.left(interfaceName);
}
- private Either<InterfaceDefinition, TitanOperationStatus> getNonRecursiveInterface(InterfaceData interfaceData) {
+ private Either<InterfaceDefinition, JanusGraphOperationStatus> getNonRecursiveInterface(InterfaceData interfaceData) {
log.debug("Going to fetch the operations associate to interface {}", interfaceData.getUniqueId());
InterfaceDefinition interfaceDefinition = new InterfaceDefinition(interfaceData.getInterfaceDataDefinition());
String interfaceId = interfaceData.getUniqueId();
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> operationsRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), interfaceId, GraphEdgeLabels.INTERFACE_OPERATION,
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> operationsRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), interfaceId, GraphEdgeLabels.INTERFACE_OPERATION,
NodeTypeEnum.InterfaceOperation, OperationData.class);
if (operationsRes.isRight()) {
- TitanOperationStatus status = operationsRes.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = operationsRes.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(status);
} else {
return Either.left(interfaceDefinition);
@@ -342,7 +354,7 @@
if (operationList != null && !operationList.isEmpty()) {
for (ImmutablePair<OperationData, GraphEdge> operationPair : operationList) {
Operation operation = new Operation(operationPair.getKey().getOperationDataDefinition());
- Either<String, TitanOperationStatus> operationNameRes = getPropertyValueFromEdge(operationPair.getValue(), GraphPropertiesDictionary.NAME);
+ Either<String, JanusGraphOperationStatus> operationNameRes = getPropertyValueFromEdge(operationPair.getValue(), GraphPropertiesDictionary.NAME);
if (operationNameRes.isRight()) {
log.error("The operation name is missing on the edge of operation {}", operationPair.getKey().getUniqueId());
return Either.right(operationNameRes.right().value());
@@ -401,7 +413,8 @@
private Either<Operation, StorageOperationStatus> updateOperationOnGraph(Operation operation, String resourceId, String interfaceName, String operationName) {
- Either<List<ImmutablePair<InterfaceData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.INTERFACE, NodeTypeEnum.Interface,
+ Either<List<ImmutablePair<InterfaceData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.INTERFACE, NodeTypeEnum.Interface,
InterfaceData.class);
if (childrenNodes.isRight()) {
@@ -415,7 +428,7 @@
}
private Either<Operation, StorageOperationStatus> updateExistingOperation(String resourceId, Operation operation, String interfaceName, String operationName,
- Either<List<ImmutablePair<InterfaceData, GraphEdge>>, TitanOperationStatus> childrenNodes) {
+ Either<List<ImmutablePair<InterfaceData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes) {
Operation newOperation = null;
StorageOperationStatus storageOperationStatus = StorageOperationStatus.GENERAL_ERROR;
@@ -426,11 +439,12 @@
InterfaceData interfaceData = interfaceDataNode.getKey();
if (interfaceEdgeProp.get(GraphPropertiesDictionary.NAME.getProperty()).equals(interfaceName)) {
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> operationRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceDataNode.getLeft().getUniqueId(),
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> operationRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceDataNode.getLeft().getUniqueId(),
GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
if (operationRes.isRight()) {
log.error("Failed to find operation {} on interface {}", operationName, interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationRes.right().value()));
} else {
List<ImmutablePair<OperationData, GraphEdge>> operations = operationRes.left().value();
for (ImmutablePair<OperationData, GraphEdge> operationPairEdge : operations) {
@@ -439,7 +453,8 @@
Map<String, Object> opEdgeProp = opEdge.getProperties();
if (opEdgeProp.get(GraphPropertiesDictionary.NAME.getProperty()).equals(operationName)) {
ArtifactDefinition artifact = operation.getImplementationArtifact();
- Either<ImmutablePair<ArtifactData, GraphEdge>, TitanOperationStatus> artifactRes = titanGenericDao.getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) opData.getUniqueId(), GraphEdgeLabels.ARTIFACT_REF,
+ Either<ImmutablePair<ArtifactData, GraphEdge>, JanusGraphOperationStatus> artifactRes = janusGraphGenericDao
+ .getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) opData.getUniqueId(), GraphEdgeLabels.ARTIFACT_REF,
NodeTypeEnum.ArtifactRef, ArtifactData.class);
Either<ArtifactDefinition, StorageOperationStatus> artStatus;
if (artifactRes.isRight()) {
@@ -448,7 +463,7 @@
artStatus = artifactOperation.updateArifactOnResource(artifact, (String) operationPairEdge.getLeft().getUniqueId(), (String) artifactRes.left().value().getLeft().getUniqueId(), NodeTypeEnum.InterfaceOperation, true);
}
if (artStatus.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add artifact {} to interface {}", operationName, interfaceName);
return Either.right(artStatus.right().value());
} else {
@@ -461,18 +476,19 @@
}
if (newOperation == null) {
- Either<InterfaceData, TitanOperationStatus> parentInterfaceStatus = findInterfaceOnParentNode(resourceId, interfaceName);
+ Either<InterfaceData, JanusGraphOperationStatus> parentInterfaceStatus = findInterfaceOnParentNode(resourceId, interfaceName);
if (parentInterfaceStatus.isRight()) {
log.debug("Interface {} not exist", interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentInterfaceStatus.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentInterfaceStatus.right().value()));
}
InterfaceData parentInterfaceData = parentInterfaceStatus.left().value();
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> opRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) parentInterfaceData.getUniqueId(),
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> opRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) parentInterfaceData.getUniqueId(),
GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
if (opRes.isRight()) {
log.error("Failed to find operation {} on interface {}", operationName, interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationRes.right().value()));
} else {
List<ImmutablePair<OperationData, GraphEdge>> parentOperations = opRes.left().value();
@@ -503,21 +519,21 @@
}
private Either<Operation, StorageOperationStatus> copyAndCreateNewOperation(Operation operation, String interfaceName, String operationName, Operation newOperation, InterfaceData interfaceData,
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> operationRes, OperationData opData) {
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> operationRes, OperationData opData) {
OperationDataDefinition opDataInfo = opData.getOperationDataDefinition();
OperationDataDefinition newOperationInfo = new OperationDataDefinition(opDataInfo);
newOperationInfo.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(interfaceData.getUniqueId(), operationName.toLowerCase()));
OperationData newopData = new OperationData(newOperationInfo);
- Either<OperationData, TitanOperationStatus> operationStatus = createOperationNodeAndRelation(operationName, newopData, interfaceData);
+ Either<OperationData, JanusGraphOperationStatus> operationStatus = createOperationNodeAndRelation(operationName, newopData, interfaceData);
if (operationStatus.isRight()) {
log.error("Failed to create operation {} on interface {}", operationName, interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationRes.right().value()));
}
ArtifactDefinition artifact = operation.getImplementationArtifact();
if (artifact != null) {
Either<ArtifactDefinition, StorageOperationStatus> artStatus = artifactOperation.addArifactToComponent(artifact, (String) operationStatus.left().value().getUniqueId(), NodeTypeEnum.InterfaceOperation, true, true);
if (artStatus.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add artifact {} to interface {}", operationName, interfaceName);
} else {
newOperation = this.convertOperationDataToOperation(opData);
@@ -532,10 +548,10 @@
// Operation newOperation = null;
ResourceMetadataData resourceData = new ResourceMetadataData();
resourceData.getMetadataDataDefinition().setUniqueId(resourceId);
- Either<InterfaceData, TitanOperationStatus> parentInterfaceStatus = findInterfaceOnParentNode(resourceId, interfaceName);
+ Either<InterfaceData, JanusGraphOperationStatus> parentInterfaceStatus = findInterfaceOnParentNode(resourceId, interfaceName);
if (parentInterfaceStatus.isRight()) {
log.debug("Interface {} not exist", interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentInterfaceStatus.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentInterfaceStatus.right().value()));
}
InterfaceData interfaceData = parentInterfaceStatus.left().value();
@@ -546,25 +562,27 @@
newInterfaceInfo.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(resourceId, interfaceNameSplitted));
InterfaceData updatedInterfaceData = new InterfaceData(newInterfaceInfo);
- Either<InterfaceData, TitanOperationStatus> createStatus = createInterfaceNodeAndRelation(interfaceName, resourceId, updatedInterfaceData, resourceData);
+ Either<InterfaceData, JanusGraphOperationStatus> createStatus = createInterfaceNodeAndRelation(interfaceName, resourceId, updatedInterfaceData, resourceData);
if (createStatus.isRight()) {
log.debug("failed to create interface node {} on resource {}", interfaceName, resourceId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createStatus.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createStatus.right().value()));
}
InterfaceData newInterfaceNode = createStatus.left().value();
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(newInterfaceNode, interfaceData, GraphEdgeLabels.DERIVED_FROM, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(newInterfaceNode, interfaceData, GraphEdgeLabels.DERIVED_FROM, null);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createRelResult.right().value();
+ JanusGraphOperationStatus operationStatus = createRelResult.right().value();
log.error("Failed to associate interface {} to interface {} in graph. status is {}", interfaceData.getUniqueId(), newInterfaceNode.getUniqueId(), operationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
}
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> operationRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceData.getUniqueId(),
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> operationRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceData.getUniqueId(),
GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
if (operationRes.isRight()) {
log.error("Failed to find operation {} on interface {}", operationName, interfaceName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationRes.right().value()));
} else {
List<ImmutablePair<OperationData, GraphEdge>> operations = operationRes.left().value();
@@ -585,9 +603,10 @@
return Either.right(StorageOperationStatus.GENERAL_ERROR);
}
- private Either<InterfaceData, TitanOperationStatus> findInterfaceOnParentNode(String resourceId, String interfaceName) {
+ private Either<InterfaceData, JanusGraphOperationStatus> findInterfaceOnParentNode(String resourceId, String interfaceName) {
- Either<ImmutablePair<ResourceMetadataData, GraphEdge>, TitanOperationStatus> parentRes = titanGenericDao.getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
+ Either<ImmutablePair<ResourceMetadataData, GraphEdge>, JanusGraphOperationStatus> parentRes = janusGraphGenericDao
+ .getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Resource,
ResourceMetadataData.class);
if (parentRes.isRight()) {
log.debug("interface {} not found ", interfaceName);
@@ -595,7 +614,8 @@
}
ImmutablePair<ResourceMetadataData, GraphEdge> parenNode = parentRes.left().value();
- Either<List<ImmutablePair<InterfaceData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), parenNode.getKey().getMetadataDataDefinition().getUniqueId(),
+ Either<List<ImmutablePair<InterfaceData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), parenNode.getKey().getMetadataDataDefinition().getUniqueId(),
GraphEdgeLabels.INTERFACE, NodeTypeEnum.Interface, InterfaceData.class);
if (childrenNodes.isRight()) {
return findInterfaceOnParentNode(parenNode.getKey().getMetadataDataDefinition().getUniqueId(), interfaceName);
@@ -619,16 +639,16 @@
@Override
public Either<InterfaceDefinition, StorageOperationStatus> createInterfaceOnResource(InterfaceDefinition interf, String resourceId, String interfaceName, boolean failIfExist, boolean inTransaction) {
- Either<InterfaceData, TitanOperationStatus> status = addInterfaceToGraph(interf, interfaceName, resourceId);
+ Either<InterfaceData, JanusGraphOperationStatus> status = addInterfaceToGraph(interf, interfaceName, resourceId);
if (status.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add interface {} to resource {}", interfaceName, resourceId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status.right().value()));
} else {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
InterfaceData interfaceData = status.left().value();
@@ -640,13 +660,13 @@
for (String operationName : opNames) {
Operation op = operations.get(operationName);
- Either<OperationData, TitanOperationStatus> opStatus = addOperationToGraph(interf, operationName, op, interfaceData);
+ Either<OperationData, JanusGraphOperationStatus> opStatus = addOperationToGraph(interf, operationName, op, interfaceData);
if (status.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add operation {} to interface {}", operationName, interfaceName);
} else if (status.isLeft()) {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
OperationData opData = opStatus.left().value();
Operation newOperation = this.convertOperationDataToOperation(opData);
@@ -655,7 +675,7 @@
if (art != null) {
Either<ArtifactDefinition, StorageOperationStatus> artRes = artifactOperation.addArifactToComponent(art, (String) opData.getUniqueId(), NodeTypeEnum.InterfaceOperation, failIfExist, true);
if (artRes.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add artifact {} to interface {}", operationName, interfaceName);
} else {
newOperation.setImplementation(artRes.left().value());
@@ -675,16 +695,16 @@
@Override
public Either<Operation, StorageOperationStatus> deleteInterfaceOperation(String resourceId, String interfaceName, String operationId, boolean inTransaction) {
- Either<Operation, TitanOperationStatus> status = removeOperationOnGraph(resourceId, interfaceName, operationId);
+ Either<Operation, JanusGraphOperationStatus> status = removeOperationOnGraph(resourceId, interfaceName, operationId);
if (status.isRight()) {
if (!inTransaction) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
log.error("Failed to delete operation {} of interface {} resource {}", operationId, interfaceName, resourceId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status.right().value()));
} else {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
Operation opDefResult = status.left().value();// convertOperationDataToOperation(operationData);
@@ -694,10 +714,11 @@
}
- private Either<Operation, TitanOperationStatus> removeOperationOnGraph(String resourceId, String interfaceName, String operationId) {
+ private Either<Operation, JanusGraphOperationStatus> removeOperationOnGraph(String resourceId, String interfaceName, String operationId) {
log.debug("Before deleting operation from graph {}", operationId);
- Either<List<ImmutablePair<InterfaceData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.INTERFACE, NodeTypeEnum.Interface,
+ Either<List<ImmutablePair<InterfaceData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId, GraphEdgeLabels.INTERFACE, NodeTypeEnum.Interface,
InterfaceData.class);
if (childrenNodes.isRight()) {
@@ -713,7 +734,8 @@
String interfaceSplitedName = splitType(interfaceName);
if (interfaceEdgeProp.get(GraphPropertiesDictionary.NAME.getProperty()).equals(interfaceSplitedName)) {
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> operationRes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceDataNode.getLeft().getUniqueId(),
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> operationRes = janusGraphGenericDao
+ .getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) interfaceDataNode.getLeft().getUniqueId(),
GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
if (operationRes.isRight()) {
log.error("Failed to find operation {} on interface {}", operationId, interfaceName);
@@ -726,7 +748,8 @@
opData = operationPairEdge.getLeft();
if (opData.getUniqueId().equals(operationId)) {
- Either<ImmutablePair<ArtifactData, GraphEdge>, TitanOperationStatus> artifactRes = titanGenericDao.getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) operationPairEdge.getLeft().getUniqueId(),
+ Either<ImmutablePair<ArtifactData, GraphEdge>, JanusGraphOperationStatus> artifactRes = janusGraphGenericDao
+ .getChild(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), (String) operationPairEdge.getLeft().getUniqueId(),
GraphEdgeLabels.ARTIFACT_REF, NodeTypeEnum.ArtifactRef, ArtifactData.class);
Either<ArtifactDefinition, StorageOperationStatus> arStatus = null;
if (artifactRes.isLeft()) {
@@ -734,13 +757,14 @@
arStatus = artifactOperation.removeArifactFromResource((String) operationPairEdge.getLeft().getUniqueId(), (String) arData.getUniqueId(), NodeTypeEnum.InterfaceOperation, true, true);
if (arStatus.isRight()) {
log.debug("failed to delete artifact {}", arData.getUniqueId());
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
}
- Either<OperationData, TitanOperationStatus> deleteOpStatus = titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.InterfaceOperation), opData.getUniqueId(), OperationData.class);
+ Either<OperationData, JanusGraphOperationStatus> deleteOpStatus = janusGraphGenericDao
+ .deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.InterfaceOperation), opData.getUniqueId(), OperationData.class);
if (deleteOpStatus.isRight()) {
log.debug("failed to delete operation {}", opData.getUniqueId());
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
opData = deleteOpStatus.left().value();
Operation operation = new Operation(opData.getOperationDataDefinition());
@@ -748,10 +772,11 @@
operation.setImplementation(arStatus.left().value());
}
if (operations.size() <= 1) {
- Either<InterfaceData, TitanOperationStatus> deleteInterfaceStatus = titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Interface), interfaceDataNode.left.getUniqueId(), InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> deleteInterfaceStatus = janusGraphGenericDao
+ .deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Interface), interfaceDataNode.left.getUniqueId(), InterfaceData.class);
if (deleteInterfaceStatus.isRight()) {
log.debug("failed to delete interface {}", interfaceDataNode.left.getUniqueId());
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
}
@@ -764,7 +789,7 @@
}
log.debug("Not found operation {}", interfaceName);
- return Either.right(TitanOperationStatus.INVALID_ID);
+ return Either.right(JanusGraphOperationStatus.INVALID_ID);
}
private String splitType(String interfaceName) {
@@ -783,10 +808,10 @@
/**
* FOR TEST ONLY
*
- * @param titanGenericDao
+ * @param janusGraphGenericDao
*/
- public void setTitanGenericDao(TitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(JanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
public void setArtifactOperation(ArtifactOperation artifactOperation) {
@@ -801,7 +826,8 @@
InterfaceData interfaceData = new InterfaceData(interf);
interf.setUniqueId(interf.getType().toLowerCase());
- Either<InterfaceData, TitanOperationStatus> existInterface = titanGenericDao.getNode(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> existInterface = janusGraphGenericDao
+ .getNode(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), InterfaceData.class);
if (existInterface.isLeft()) {
// already exist
@@ -811,13 +837,14 @@
}
log.debug("Before adding interface type to graph {}", interfaceData);
- Either<InterfaceData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(interfaceData, InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(interfaceData, InterfaceData.class);
log.debug("After adding property type to graph {}", interfaceData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add interface {} to graph. status is {}", interf.getType(), operationStatus);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
return result;
}
@@ -828,12 +855,12 @@
Map<String, Operation> newOperations = new HashMap<>();
for (Map.Entry<String, Operation> operation : operations.entrySet()) {
- Either<OperationData, TitanOperationStatus> opStatus = addOperationToGraph(interf, operation.getKey(), operation.getValue(), interfaceData);
+ Either<OperationData, JanusGraphOperationStatus> opStatus = addOperationToGraph(interf, operation.getKey(), operation.getValue(), interfaceData);
if (opStatus.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
log.error("Failed to add operation {} to interface {}", operation.getKey(), interf.getType());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(opStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(opStatus.right().value()));
return result;
} else {
OperationData opData = opStatus.left().value();
@@ -849,10 +876,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error("Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -861,14 +888,15 @@
@Override
public Either<InterfaceDefinition, StorageOperationStatus> getInterface(String interfaceId) {
- Either<InterfaceData, TitanOperationStatus> getResult = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Interface), interfaceId, InterfaceData.class);
+ Either<InterfaceData, JanusGraphOperationStatus> getResult = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Interface), interfaceId, InterfaceData.class);
if (getResult.isLeft()) {
InterfaceData interfaceData = getResult.left().value();
return Either.left(convertInterfaceDataToInterfaceDefinition(interfaceData));
} else {
- TitanOperationStatus titanStatus = getResult.right().value();
- log.debug("Node with id {} was not found in the graph. status: {}", interfaceId, titanStatus);
- StorageOperationStatus storageOperationStatus = DaoStatusConverter.convertTitanStatusToStorageStatus(titanStatus);
+ JanusGraphOperationStatus janusGraphStatus = getResult.right().value();
+ log.debug("Node with id {} was not found in the graph. status: {}", interfaceId, janusGraphStatus);
+ StorageOperationStatus storageOperationStatus = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(janusGraphStatus);
return Either.right(storageOperationStatus);
}
}
@@ -894,10 +922,11 @@
@Override
public Either<Map<String, InterfaceDefinition>, StorageOperationStatus> getAllInterfaceLifecycleTypes() {
- Either<List<InterfaceData>, TitanOperationStatus> allInterfaceLifecycleTypes =
- titanGenericDao.getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(), InterfaceData.class);
+ Either<List<InterfaceData>, JanusGraphOperationStatus> allInterfaceLifecycleTypes =
+ janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(), InterfaceData.class);
if (allInterfaceLifecycleTypes.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus
(allInterfaceLifecycleTypes.right().value()));
}
@@ -909,8 +938,8 @@
.collect(Collectors.toList());
for (InterfaceDefinition interfaceDefinition : interfaceDefinitions) {
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus>
- childrenNodes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus>
+ childrenNodes = janusGraphGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),
interfaceDefinition.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
if (childrenNodes.isLeft()) {
Map<String, OperationDataDefinition> operationsDataDefinitionMap = new HashMap<>();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java
index a06d342..2266acf 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java
@@ -1,8 +1,8 @@
package org.openecomp.sdc.be.model.operations.impl;
import fj.data.Either;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.operations.StorageException;
@@ -14,32 +14,33 @@
@Component
public class OperationUtils {
- private final TitanDao titanDao;
+ private final JanusGraphDao janusGraphDao;
private static final Logger logger = Logger.getLogger(OperationUtils.class.getName());
- public OperationUtils(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public OperationUtils(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
- public <T> T onTitanOperationFailure(TitanOperationStatus status) {
- titanDao.rollback();
+ public <T> T onJanusGraphOperationFailure(JanusGraphOperationStatus status) {
+ janusGraphDao.rollback();
throw new StorageException(status);
}
- static Either<Map<String, PropertyDefinition>, TitanOperationStatus> fillProperties(String uniqueId,
- PropertyOperation propertyOperation,
- NodeTypeEnum nodeTypeEnum) {
+ static Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> fillProperties(String uniqueId,
+ PropertyOperation propertyOperation,
+ NodeTypeEnum nodeTypeEnum) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesOfNode =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode =
propertyOperation.findPropertiesOfNode(nodeTypeEnum, uniqueId);
if (findPropertiesOfNode.isRight()) {
- TitanOperationStatus titanOperationStatus = findPropertiesOfNode.right().value();
- logger.debug("After looking for properties of vertex {}. status is {}", uniqueId, titanOperationStatus);
- if (TitanOperationStatus.NOT_FOUND.equals(titanOperationStatus)) {
- return Either.right(TitanOperationStatus.OK);
+ JanusGraphOperationStatus janusGraphOperationStatus = findPropertiesOfNode.right().value();
+ logger.debug("After looking for properties of vertex {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(janusGraphOperationStatus)) {
+ return Either.right(JanusGraphOperationStatus.OK);
} else {
- return Either.right(titanOperationStatus);
+ return Either.right(janusGraphOperationStatus);
}
} else {
return Either.left(findPropertiesOfNode.left().value());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java
index 76652e1..e8a74fe 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java
@@ -20,12 +20,12 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
+import org.janusgraph.graphdb.query.JanusGraphPredicate;
import fj.data.Either;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.PolicyTypeDefinition;
@@ -42,7 +42,7 @@
import java.util.*;
import java.util.stream.Collectors;
-import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate;
+import static org.openecomp.sdc.be.dao.janusgraph.JanusGraphUtils.buildNotInPredicate;
@Component("policy-type-operation")
public class PolicyTypeOperation extends AbstractOperation implements IPolicyTypeOperation {
@@ -94,12 +94,13 @@
@Override
public List<PolicyTypeDefinition> getAllPolicyTypes(Set<String> excludedPolicyTypes) {
- Map<String, Map.Entry<TitanPredicate, Object>> predicateCriteria = buildNotInPredicate(GraphPropertiesDictionary.TYPE.getProperty(), excludedPolicyTypes);
- return titanGenericDao.getByCriteriaWithPredicate(NodeTypeEnum.PolicyType, predicateCriteria, PolicyTypeData.class)
+ Map<String, Map.Entry<JanusGraphPredicate, Object>> predicateCriteria = buildNotInPredicate(GraphPropertiesDictionary.TYPE.getProperty(), excludedPolicyTypes);
+ return janusGraphGenericDao
+ .getByCriteriaWithPredicate(NodeTypeEnum.PolicyType, predicateCriteria, PolicyTypeData.class)
.left()
.map(this::convertPolicyTypesToDefinition)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
}
private List<PolicyTypeDefinition> convertPolicyTypesToDefinition(List<PolicyTypeData> policiesTypes) {
@@ -113,18 +114,19 @@
String ptUniqueId = UniqueIdBuilder.buildPolicyTypeUid(policyTypeDef.getType(), policyTypeDef.getVersion(), "policytype");
PolicyTypeData policyTypeData = buildPolicyTypeData(policyTypeDef, ptUniqueId);
log.debug("Before adding policy type to graph. policyTypeData = {}", policyTypeData);
- Either<PolicyTypeData, TitanOperationStatus> eitherPolicyTypeData = titanGenericDao.createNode(policyTypeData, PolicyTypeData.class);
+ Either<PolicyTypeData, JanusGraphOperationStatus> eitherPolicyTypeData = janusGraphGenericDao
+ .createNode(policyTypeData, PolicyTypeData.class);
log.debug("After adding policy type to graph. status is = {}", eitherPolicyTypeData);
if (eitherPolicyTypeData.isRight()) {
- TitanOperationStatus operationStatus = eitherPolicyTypeData.right().value();
+ JanusGraphOperationStatus operationStatus = eitherPolicyTypeData.right().value();
log.error("Failed to add policy type {} to graph. status is {}", policyTypeDef.getType(), operationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
}
List<PropertyDefinition> properties = policyTypeDef.getProperties();
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToPolicyType = propertyOperation.addPropertiesToElementType(ptUniqueId, NodeTypeEnum.PolicyType, properties);
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToPolicyType = propertyOperation.addPropertiesToElementType(ptUniqueId, NodeTypeEnum.PolicyType, properties);
if (addPropertiesToPolicyType.isRight()) {
log.error("Failed add properties {} to policy {}", properties, policyTypeDef.getType());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertiesToPolicyType.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertiesToPolicyType.right().value()));
}
return addDerivedFromRelation(policyTypeDef, ptUniqueId)
.left()
@@ -139,9 +141,10 @@
return result;
}
- Either<List<PolicyTypeData>, TitanOperationStatus> eitherPolicyData = titanGenericDao.getByCriteria(NodeTypeEnum.PolicyType, properties, PolicyTypeData.class);
+ Either<List<PolicyTypeData>, JanusGraphOperationStatus> eitherPolicyData = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.PolicyType, properties, PolicyTypeData.class);
if (eitherPolicyData.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherPolicyData.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherPolicyData.right().value()));
} else {
PolicyTypeDataDefinition dataDefinition = eitherPolicyData.left().value().stream().map(PolicyTypeData::getPolicyTypeDataDefinition).findFirst().get();
result = getPolicyTypeByUid(dataDefinition.getUniqueId());
@@ -152,9 +155,10 @@
private Either<PolicyTypeDefinition, StorageOperationStatus> getPolicyTypeByUid(String uniqueId) {
log.debug("#getPolicyTypeByUid - fetching policy type with id {}", uniqueId);
- return titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), uniqueId, PolicyTypeData.class)
+ return janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), uniqueId, PolicyTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(policyType -> createPolicyTypeDefinition(uniqueId, policyType));
}
@@ -207,11 +211,11 @@
return Either.right(err);
}
- Either<Map<String, PropertyDefinition>, StorageOperationStatus> handlePolicyTypeHasNoProperties(TitanOperationStatus err) {
- if (err == TitanOperationStatus.NOT_FOUND) {
+ Either<Map<String, PropertyDefinition>, StorageOperationStatus> handlePolicyTypeHasNoProperties(JanusGraphOperationStatus err) {
+ if (err == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(new HashMap<>());
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(err));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(err));
}
private PolicyTypeData setDerivedFrom(PolicyTypeDefinition policyTypeDefinition, PolicyTypeData derivedFrom) {
@@ -238,9 +242,9 @@
private Either<PolicyTypeDefinition, StorageOperationStatus> updatePolicyTypeOnGraph(PolicyTypeDefinition updatedPolicyType, PolicyTypeDefinition currPolicyType) {
updatePolicyTypeData(updatedPolicyType, currPolicyType);
- return titanGenericDao.updateNode(new PolicyTypeData(updatedPolicyType), PolicyTypeData.class)
+ return janusGraphGenericDao.updateNode(new PolicyTypeData(updatedPolicyType), PolicyTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(updatedNode -> updatePolicyProperties(updatedPolicyType.getUniqueId(), updatedPolicyType.getProperties()))
.left()
@@ -291,7 +295,7 @@
log.debug("#addPropertiesToPolicy - adding policy type properties for policy type with id {}", policyTypeId);
return propertyOperation.addPropertiesToElementType(policyTypeId, NodeTypeEnum.PolicyType, properties)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private void updatePolicyTypeData(PolicyTypeDefinition updatedTypeDefinition, PolicyTypeDefinition currTypeDefinition) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
index fb023c7..54fea42 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
@@ -33,9 +33,9 @@
import com.google.gson.JsonParser;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
-import com.thinkaurelius.titan.core.TitanVertexProperty;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.janusgraph.core.JanusGraphVertexProperty;
import fj.data.Either;
import java.io.IOException;
import java.lang.reflect.Type;
@@ -66,11 +66,11 @@
import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
@@ -132,8 +132,8 @@
}
- public PropertyOperation(HealingTitanGenericDao titanGenericDao, DerivedFromOperation derivedFromOperation) {
- this.titanGenericDao = titanGenericDao;
+ public PropertyOperation(HealingJanusGraphGenericDao janusGraphGenericDao, DerivedFromOperation derivedFromOperation) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
this.derivedFromOperation = derivedFromOperation;
}
@@ -331,9 +331,9 @@
public Either<PropertyData, StorageOperationStatus> addProperty(String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
- Either<PropertyData, TitanOperationStatus> either = addPropertyToGraph(propertyName, propertyDefinition, resourceId);
+ Either<PropertyData, JanusGraphOperationStatus> either = addPropertyToGraph(propertyName, propertyDefinition, resourceId);
if (either.isRight()) {
- StorageOperationStatus storageStatus = DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value());
+ StorageOperationStatus storageStatus = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value());
return Either.right(storageStatus);
}
return Either.left(either.left().value());
@@ -366,7 +366,7 @@
}
String innerType = null;
- Either<String, TitanOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
+ Either<String, JanusGraphOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema);
if (checkInnerType.isRight()) {
return StorageOperationStatus.INVALID_TYPE;
}
@@ -392,7 +392,7 @@
return StorageOperationStatus.OK;
}
- public Either<PropertyData, TitanOperationStatus> addPropertyToGraph(String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
+ public Either<PropertyData, JanusGraphOperationStatus> addPropertyToGraph(String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
ResourceMetadataData resourceData = new ResourceMetadataData();
resourceData.getMetadataDataDefinition().setUniqueId(resourceId);
@@ -403,19 +403,21 @@
PropertyData propertyData = new PropertyData(propertyDefinition, convertConstraintsToString(constraints));
log.debug(BEFORE_ADDING_PROPERTY_TO_GRAPH, propertyData);
- Either<PropertyData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyData, PropertyData.class);
+ Either<PropertyData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(propertyData, PropertyData.class);
log.debug(AFTER_ADDING_PROPERTY_TO_GRAPH, propertyData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add property {} to graph. status is {}", propertyName, operationStatus);
return Either.right(operationStatus);
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), propertyName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(resourceData, propertyData, GraphEdgeLabels.PROPERTY, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(resourceData, propertyData, GraphEdgeLabels.PROPERTY, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error(FAILED_TO_ASSOCIATE_RESOURCE_TO_PROPERTY_IN_GRAPH_STATUS_IS, resourceId, propertyName, operationStatus);
return Either.right(operationStatus);
}
@@ -424,7 +426,7 @@
}
- public TitanOperationStatus addPropertyToGraphByVertex(TitanVertex metadataVertex, String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
+ public JanusGraphOperationStatus addPropertyToGraphByVertex(JanusGraphVertex metadataVertex, String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
List<PropertyConstraint> constraints = propertyDefinition.getConstraints();
@@ -432,19 +434,21 @@
PropertyData propertyData = new PropertyData(propertyDefinition, convertConstraintsToString(constraints));
log.debug(BEFORE_ADDING_PROPERTY_TO_GRAPH, propertyData);
- Either<TitanVertex, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyData);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao.createNode(propertyData);
log.debug(AFTER_ADDING_PROPERTY_TO_GRAPH, propertyData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add property {} to graph. status is ", propertyName, operationStatus);
return operationStatus;
}
Map<String, Object> props = new HashMap<>();
props.put(GraphPropertiesDictionary.NAME.getProperty(), propertyName);
- TitanVertex propertyVertex = createNodeResult.left().value();
- TitanOperationStatus createRelResult = titanGenericDao.createEdge(metadataVertex, propertyVertex, GraphEdgeLabels.PROPERTY, props);
- if (!createRelResult.equals(TitanOperationStatus.OK)) {
+ JanusGraphVertex propertyVertex = createNodeResult.left().value();
+ JanusGraphOperationStatus
+ createRelResult = janusGraphGenericDao
+ .createEdge(metadataVertex, propertyVertex, GraphEdgeLabels.PROPERTY, props);
+ if (!createRelResult.equals(JanusGraphOperationStatus.OK)) {
log.error(FAILED_TO_ASSOCIATE_RESOURCE_TO_PROPERTY_IN_GRAPH_STATUS_IS, resourceId, propertyName, createRelResult);
return createRelResult;
}
@@ -453,13 +457,14 @@
}
- public TitanGenericDao getTitanGenericDao() {
- return titanGenericDao;
+ public JanusGraphGenericDao getJanusGraphGenericDao() {
+ return janusGraphGenericDao;
}
- public Either<PropertyData, TitanOperationStatus> deletePropertyFromGraph(String propertyId) {
+ public Either<PropertyData, JanusGraphOperationStatus> deletePropertyFromGraph(String propertyId) {
log.debug("Before deleting property from graph {}", propertyId);
- return titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
+ return janusGraphGenericDao
+ .deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
}
public Either<PropertyData, StorageOperationStatus> updateProperty(String propertyId, PropertyDefinition newPropertyDefinition, Map<String, DataTypeDefinition> dataTypes) {
@@ -469,20 +474,21 @@
return Either.right(validateAndUpdateProperty);
}
- Either<PropertyData, TitanOperationStatus> either = updatePropertyFromGraph(propertyId, newPropertyDefinition);
+ Either<PropertyData, JanusGraphOperationStatus> either = updatePropertyFromGraph(propertyId, newPropertyDefinition);
if (either.isRight()) {
- StorageOperationStatus storageStatus = DaoStatusConverter.convertTitanStatusToStorageStatus(either.right().value());
+ StorageOperationStatus storageStatus = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(either.right().value());
return Either.right(storageStatus);
}
return Either.left(either.left().value());
}
- public Either<PropertyData, TitanOperationStatus> updatePropertyFromGraph(String propertyId, PropertyDefinition propertyDefinition) {
+ public Either<PropertyData, JanusGraphOperationStatus> updatePropertyFromGraph(String propertyId, PropertyDefinition propertyDefinition) {
if (log.isDebugEnabled())
log.debug("Before updating property on graph {}", propertyId);
// get the original property data
- Either<PropertyData, TitanOperationStatus> statusProperty = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
+ Either<PropertyData, JanusGraphOperationStatus> statusProperty = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Property), propertyId, PropertyData.class);
if (statusProperty.isRight()) {
log.debug("Problem while get property with id {}. Reason - {}", propertyId, statusProperty.right().value().name());
return Either.right(statusProperty.right().value());
@@ -518,19 +524,19 @@
}
orgPropertyDataDefinition.setSchema(newPropertyDataDefinition.getSchema());
- return titanGenericDao.updateNode(orgPropertyData, PropertyData.class);
+ return janusGraphGenericDao.updateNode(orgPropertyData, PropertyData.class);
}
/**
* FOR TEST ONLY
*
- * @param titanGenericDao
+ * @param janusGraphGenericDao
*/
- public void setTitanGenericDao(HealingTitanGenericDao titanGenericDao) {
- this.titanGenericDao = titanGenericDao;
+ public void setJanusGraphGenericDao(HealingJanusGraphGenericDao janusGraphGenericDao) {
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
- public Either<PropertyData, TitanOperationStatus> addPropertyToNodeType(String propertyName, PropertyDefinition propertyDefinition, NodeTypeEnum nodeType, String uniqueId) {
+ public Either<PropertyData, JanusGraphOperationStatus> addPropertyToNodeType(String propertyName, PropertyDefinition propertyDefinition, NodeTypeEnum nodeType, String uniqueId) {
List<PropertyConstraint> constraints = propertyDefinition.getConstraints();
@@ -539,11 +545,12 @@
if (log.isDebugEnabled())
log.debug(BEFORE_ADDING_PROPERTY_TO_GRAPH, propertyData);
- Either<PropertyData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyData, PropertyData.class);
+ Either<PropertyData, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao
+ .createNode(propertyData, PropertyData.class);
if (log.isDebugEnabled())
log.debug(AFTER_ADDING_PROPERTY_TO_GRAPH, propertyData);
if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error("Failed to add property {} to graph. status is {}", propertyName, operationStatus);
return Either.right(operationStatus);
}
@@ -553,9 +560,10 @@
UniqueIdData uniqueIdData = new UniqueIdData(nodeType, uniqueId);
log.debug("Before associating {} to property {}", uniqueIdData, propertyName);
- Either<GraphRelation, TitanOperationStatus> createRelResult = titanGenericDao.createRelation(uniqueIdData, propertyData, GraphEdgeLabels.PROPERTY, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelResult = janusGraphGenericDao
+ .createRelation(uniqueIdData, propertyData, GraphEdgeLabels.PROPERTY, props);
if (createRelResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createNodeResult.right().value();
log.error(FAILED_TO_ASSOCIATE_RESOURCE_TO_PROPERTY_IN_GRAPH_STATUS_IS, uniqueId, propertyName, operationStatus);
return Either.right(operationStatus);
}
@@ -564,15 +572,16 @@
}
- public Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesOfNode(NodeTypeEnum nodeType, String uniqueId) {
+ public Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode(NodeTypeEnum nodeType, String uniqueId) {
Map<String, PropertyDefinition> resourceProps = new HashMap<>();
- Either<List<ImmutablePair<PropertyData, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.PROPERTY, NodeTypeEnum.Property,
+ Either<List<ImmutablePair<PropertyData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.PROPERTY, NodeTypeEnum.Property,
PropertyData.class);
if (childrenNodes.isRight()) {
- TitanOperationStatus operationStatus = childrenNodes.right().value();
+ JanusGraphOperationStatus operationStatus = childrenNodes.right().value();
return Either.right(operationStatus);
}
@@ -600,15 +609,15 @@
.bind(err -> err == StorageOperationStatus.OK ? Either.left(Collections.emptyMap()) : Either.right(err));
}
- public Either<Map<String, PropertyData>, TitanOperationStatus> mergePropertiesAssociatedToNode(NodeTypeEnum nodeType, String uniqueId, Map<String, PropertyDefinition> newProperties) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> oldPropertiesRes = findPropertiesOfNode(nodeType, uniqueId);
+ public Either<Map<String, PropertyData>, JanusGraphOperationStatus> mergePropertiesAssociatedToNode(NodeTypeEnum nodeType, String uniqueId, Map<String, PropertyDefinition> newProperties) {
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> oldPropertiesRes = findPropertiesOfNode(nodeType, uniqueId);
Map<String, PropertyDefinition> reallyNewProperties;
Map<String, PropertyData> unchangedPropsData;
if (oldPropertiesRes.isRight()) {
- TitanOperationStatus err = oldPropertiesRes.right().value();
- if (err == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus err = oldPropertiesRes.right().value();
+ if (err == JanusGraphOperationStatus.NOT_FOUND) {
reallyNewProperties = newProperties;
unchangedPropsData = Collections.emptyMap();
}
@@ -625,8 +634,8 @@
PropertyDefinition newPropDef = newProperties != null? newProperties.get(key): null;
PropertyDefinition oldPropDef = oldEntry.getValue();
- TitanOperationStatus status = updateOldProperty(newPropDef, oldPropDef);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus status = updateOldProperty(newPropDef, oldPropDef);
+ if (status != JanusGraphOperationStatus.OK) {
return Either.right(status);
}
}
@@ -654,9 +663,9 @@
* @param newPropDef
* @param oldPropDef
*/
- private TitanOperationStatus updateOldProperty(PropertyDefinition newPropDef, PropertyDefinition oldPropDef) {
+ private JanusGraphOperationStatus updateOldProperty(PropertyDefinition newPropDef, PropertyDefinition oldPropDef) {
if (!isUpdateAllowed(newPropDef, oldPropDef)) {
- return TitanOperationStatus.MATCH_NOT_FOUND;
+ return JanusGraphOperationStatus.MATCH_NOT_FOUND;
}
if (isUpdateRequired(newPropDef, oldPropDef)) {
@@ -664,14 +673,15 @@
List<PropertyConstraint> constraints = oldPropDef.getConstraints();
PropertyData node = new PropertyData(oldPropDef, convertConstraintsToString(constraints));
- Either<PropertyData, TitanOperationStatus> updateResult = titanGenericDao.updateNode(node, PropertyData.class);
+ Either<PropertyData, JanusGraphOperationStatus> updateResult = janusGraphGenericDao
+ .updateNode(node, PropertyData.class);
if (updateResult.isRight()) {
return updateResult.right().value();
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
/**
@@ -703,7 +713,7 @@
oldPropDef.setDescription(newPropDef.getDescription());
oldPropDef.setRequired(newPropDef.isRequired());
- // Type is updated to fix possible null type issue in TITAN DB
+ // Type is updated to fix possible null type issue in janusGraph DB
oldPropDef.setType(newPropDef.getType());
}
@@ -723,7 +733,7 @@
* @param unchangedPropsData
* @return
*/
- private Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToElementType(NodeTypeEnum nodeType, String uniqueId, Map<String, PropertyDefinition> newProperties, Map<String, PropertyData> unchangedPropsData) {
+ private Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToElementType(NodeTypeEnum nodeType, String uniqueId, Map<String, PropertyDefinition> newProperties, Map<String, PropertyData> unchangedPropsData) {
return addPropertiesToElementType(uniqueId, nodeType, newProperties)
.left()
.map(m -> {
@@ -735,28 +745,28 @@
public Either<Map<String, PropertyDefinition>, StorageOperationStatus> deleteAllPropertiesAssociatedToNode(NodeTypeEnum nodeType, String uniqueId) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> propertiesOfNodeRes = findPropertiesOfNode(nodeType, uniqueId);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> propertiesOfNodeRes = findPropertiesOfNode(nodeType, uniqueId);
if (propertiesOfNodeRes.isRight()) {
- TitanOperationStatus status = propertiesOfNodeRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = propertiesOfNodeRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(StorageOperationStatus.OK);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
Map<String, PropertyDefinition> value = propertiesOfNodeRes.left().value();
for (PropertyDefinition propertyDefinition : value.values()) {
String propertyUid = propertyDefinition.getUniqueId();
- Either<PropertyData, TitanOperationStatus> deletePropertyRes = deletePropertyFromGraph(propertyUid);
+ Either<PropertyData, JanusGraphOperationStatus> deletePropertyRes = deletePropertyFromGraph(propertyUid);
if (deletePropertyRes.isRight()) {
log.error("Failed to delete property with id {}", propertyUid);
- TitanOperationStatus status = deletePropertyRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = deletePropertyRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
@@ -855,13 +865,13 @@
return rules;
}
- public ImmutablePair<TitanOperationStatus, String> findPropertyValue(String resourceInstanceId, String propertyId) {
+ public ImmutablePair<JanusGraphOperationStatus, String> findPropertyValue(String resourceInstanceId, String propertyId) {
log.debug("Going to check whether the property {} already added to resource instance {}", propertyId, resourceInstanceId);
- Either<List<ComponentInstanceProperty>, TitanOperationStatus> getAllRes = this.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceId);
+ Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> getAllRes = this.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceId);
if (getAllRes.isRight()) {
- TitanOperationStatus status = getAllRes.right().value();
+ JanusGraphOperationStatus status = getAllRes.right().value();
log.trace("After fetching all properties of resource instance {}. Status is {}", resourceInstanceId, status);
return new ImmutablePair<>(status, null);
}
@@ -874,12 +884,12 @@
log.trace("Go over property {} under resource instance {}. valueUniqueId = {}", propertyUniqueId, resourceInstanceId, valueUniqueUid);
if (propertyId.equals(propertyUniqueId) && valueUniqueUid != null) {
log.debug("The property {} already created under resource instance {}", propertyId, resourceInstanceId);
- return new ImmutablePair<>(TitanOperationStatus.ALREADY_EXIST, valueUniqueUid);
+ return new ImmutablePair<>(JanusGraphOperationStatus.ALREADY_EXIST, valueUniqueUid);
}
}
}
- return new ImmutablePair<>(TitanOperationStatus.NOT_FOUND, null);
+ return new ImmutablePair<>(JanusGraphOperationStatus.NOT_FOUND, null);
}
@@ -960,45 +970,49 @@
* @param resourceInstanceUid
* @return
*/
- public Either<List<ComponentInstanceProperty>, TitanOperationStatus> getAllPropertiesOfResourceInstanceOnlyPropertyDefId(String resourceInstanceUid) {
+ public Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> getAllPropertiesOfResourceInstanceOnlyPropertyDefId(String resourceInstanceUid) {
return getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid, NodeTypeEnum.ResourceInstance);
}
- public Either<PropertyValueData, TitanOperationStatus> removePropertyOfResourceInstance(String propertyValueUid, String resourceInstanceId) {
+ public Either<PropertyValueData, JanusGraphOperationStatus> removePropertyOfResourceInstance(String propertyValueUid, String resourceInstanceId) {
- Either<ComponentInstanceData, TitanOperationStatus> findResInstanceRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId, ComponentInstanceData.class);
+ Either<ComponentInstanceData, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId, ComponentInstanceData.class);
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
- Either<PropertyValueData, TitanOperationStatus> findPropertyDefRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueUid, PropertyValueData.class);
+ Either<PropertyValueData, JanusGraphOperationStatus> findPropertyDefRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PropertyValue), propertyValueUid, PropertyValueData.class);
if (findPropertyDefRes.isRight()) {
- TitanOperationStatus status = findPropertyDefRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findPropertyDefRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
- Either<GraphRelation, TitanOperationStatus> relation = titanGenericDao.getRelation(findResInstanceRes.left().value(), findPropertyDefRes.left().value(), GraphEdgeLabels.PROPERTY_VALUE);
+ Either<GraphRelation, JanusGraphOperationStatus> relation = janusGraphGenericDao
+ .getRelation(findResInstanceRes.left().value(), findPropertyDefRes.left().value(), GraphEdgeLabels.PROPERTY_VALUE);
if (relation.isRight()) {
// TODO: add error in case of error
- TitanOperationStatus status = relation.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = relation.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
- Either<PropertyValueData, TitanOperationStatus> deleteNode = titanGenericDao.deleteNode(findPropertyDefRes.left().value(), PropertyValueData.class);
+ Either<PropertyValueData, JanusGraphOperationStatus> deleteNode = janusGraphGenericDao
+ .deleteNode(findPropertyDefRes.left().value(), PropertyValueData.class);
if (deleteNode.isRight()) {
return Either.right(deleteNode.right().value());
}
@@ -1013,11 +1027,11 @@
try {
- Either<PropertyValueData, TitanOperationStatus> eitherStatus = this.removePropertyOfResourceInstance(propertyValueUid, resourceInstanceId);
+ Either<PropertyValueData, JanusGraphOperationStatus> eitherStatus = this.removePropertyOfResourceInstance(propertyValueUid, resourceInstanceId);
if (eitherStatus.isRight()) {
log.error("Failed to remove property value {} from resource instance {} in Graph. status is {}", propertyValueUid, resourceInstanceId, eitherStatus.right().value().name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
return result;
} else {
PropertyValueData propertyValueData = eitherStatus.left().value();
@@ -1036,10 +1050,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -1111,7 +1125,7 @@
if (ToscaPropertyType.isValidType(property.getType()) == null) {
- Either<Boolean, TitanOperationStatus> definedInDataTypes = isDefinedInDataTypes(property.getType());
+ Either<Boolean, JanusGraphOperationStatus> definedInDataTypes = isDefinedInDataTypes(property.getType());
if (definedInDataTypes.isRight()) {
return false;
@@ -1164,44 +1178,50 @@
}
- public Either<List<ComponentInstanceProperty>, TitanOperationStatus> getAllPropertiesOfResourceInstanceOnlyPropertyDefId(String resourceInstanceUid, NodeTypeEnum instanceNodeType) {
+ public Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> getAllPropertiesOfResourceInstanceOnlyPropertyDefId(String resourceInstanceUid, NodeTypeEnum instanceNodeType) {
- Either<TitanVertex, TitanOperationStatus> findResInstanceRes = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> findResInstanceRes = janusGraphGenericDao
+ .getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid);
if (findResInstanceRes.isRight()) {
- TitanOperationStatus status = findResInstanceRes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = findResInstanceRes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
- Either<List<ImmutablePair<TitanVertex, Edge>>, TitanOperationStatus> propertyImplNodes = titanGenericDao.getChildrenVertecies(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, GraphEdgeLabels.PROPERTY_VALUE);
+ Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> propertyImplNodes = janusGraphGenericDao
+ .getChildrenVertecies(UniqueIdBuilder.getKeyByNodeType(instanceNodeType), resourceInstanceUid, GraphEdgeLabels.PROPERTY_VALUE);
if (propertyImplNodes.isRight()) {
- TitanOperationStatus status = propertyImplNodes.right().value();
+ JanusGraphOperationStatus status = propertyImplNodes.right().value();
return Either.right(status);
}
- List<ImmutablePair<TitanVertex, Edge>> list = propertyImplNodes.left().value();
+ List<ImmutablePair<JanusGraphVertex, Edge>> list = propertyImplNodes.left().value();
if (list == null || list.isEmpty()) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
List<ComponentInstanceProperty> result = new ArrayList<>();
- for (ImmutablePair<TitanVertex, Edge> propertyValue : list) {
- TitanVertex propertyValueDataVertex = propertyValue.getLeft();
- String propertyValueUid = (String) titanGenericDao.getProperty(propertyValueDataVertex, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
- String value = (String) titanGenericDao.getProperty(propertyValueDataVertex, GraphPropertiesDictionary.VALUE.getProperty());
+ for (ImmutablePair<JanusGraphVertex, Edge> propertyValue : list) {
+ JanusGraphVertex propertyValueDataVertex = propertyValue.getLeft();
+ String propertyValueUid = (String) janusGraphGenericDao
+ .getProperty(propertyValueDataVertex, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
+ String value = (String) janusGraphGenericDao
+ .getProperty(propertyValueDataVertex, GraphPropertiesDictionary.VALUE.getProperty());
- ImmutablePair<TitanVertex, Edge> propertyDefPair = titanGenericDao.getChildVertex(propertyValueDataVertex, GraphEdgeLabels.PROPERTY_IMPL);
+ ImmutablePair<JanusGraphVertex, Edge> propertyDefPair = janusGraphGenericDao
+ .getChildVertex(propertyValueDataVertex, GraphEdgeLabels.PROPERTY_IMPL);
if (propertyDefPair == null) {
- return Either.right(TitanOperationStatus.NOT_FOUND);
+ return Either.right(JanusGraphOperationStatus.NOT_FOUND);
}
- Map<String, Object> properties = titanGenericDao.getProperties(propertyValueDataVertex);
+ Map<String, Object> properties = janusGraphGenericDao.getProperties(propertyValueDataVertex);
PropertyValueData propertyValueData = GraphElementFactory.createElement(NodeTypeEnum.PropertyValue.getName(), GraphElementTypeEnum.Node, properties, PropertyValueData.class);
- String propertyUniqueId = (String) titanGenericDao.getProperty(propertyDefPair.left, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
+ String propertyUniqueId = (String) janusGraphGenericDao
+ .getProperty(propertyDefPair.left, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
// set property original unique id
@@ -1230,7 +1250,7 @@
* @param defaultValue
* @return
*/
- public Either<String, TitanOperationStatus> findDefaultValueFromSecondPosition(List<String> pathOfComponentInstances, String propertyUniqueId, String defaultValue) {
+ public Either<String, JanusGraphOperationStatus> findDefaultValueFromSecondPosition(List<String> pathOfComponentInstances, String propertyUniqueId, String defaultValue) {
log.trace("In find default value: path= {} propertyUniqId={} defaultValue= {}", pathOfComponentInstances, propertyUniqueId, defaultValue);
@@ -1243,13 +1263,13 @@
for (int i = 1; i < pathOfComponentInstances.size(); i++) {
String compInstanceId = pathOfComponentInstances.get(i);
- Either<List<ComponentInstanceProperty>, TitanOperationStatus> propertyValuesResult = this.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(compInstanceId, NodeTypeEnum.ResourceInstance);
+ Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> propertyValuesResult = this.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(compInstanceId, NodeTypeEnum.ResourceInstance);
log.trace("After fetching properties values of component instance {}. {}", compInstanceId, propertyValuesResult);
if (propertyValuesResult.isRight()) {
- TitanOperationStatus status = propertyValuesResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = propertyValuesResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(status);
} else {
continue;
@@ -1459,7 +1479,7 @@
* @param dataTypeDefinition
* @return
*/
- private Either<DataTypeData, TitanOperationStatus> addDataTypeToGraph(DataTypeDefinition dataTypeDefinition) {
+ private Either<DataTypeData, JanusGraphOperationStatus> addDataTypeToGraph(DataTypeDefinition dataTypeDefinition) {
log.debug("Got data type {}", dataTypeDefinition);
@@ -1468,11 +1488,12 @@
DataTypeData dataTypeData = buildDataTypeData(dataTypeDefinition, dtUniqueId);
log.debug("Before adding data type to graph. dataTypeData = {}", dataTypeData);
- Either<DataTypeData, TitanOperationStatus> createDataTypeResult = titanGenericDao.createNode(dataTypeData, DataTypeData.class);
+ Either<DataTypeData, JanusGraphOperationStatus> createDataTypeResult = janusGraphGenericDao
+ .createNode(dataTypeData, DataTypeData.class);
log.debug("After adding data type to graph. status is = {}", createDataTypeResult);
if (createDataTypeResult.isRight()) {
- TitanOperationStatus operationStatus = createDataTypeResult.right().value();
+ JanusGraphOperationStatus operationStatus = createDataTypeResult.right().value();
log.debug("Failed to data type {} to graph. status is {}", dataTypeDefinition.getName(), operationStatus);
BeEcompErrorManager.getInstance().logBeFailedAddingNodeTypeError("AddDataType", NodeTypeEnum.DataType.getName());
return Either.right(operationStatus);
@@ -1480,7 +1501,7 @@
DataTypeData resultCTD = createDataTypeResult.left().value();
List<PropertyDefinition> properties = dataTypeDefinition.getProperties();
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToDataType = addPropertiesToDataType(resultCTD.getUniqueId(), properties);
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToDataType = addPropertiesToDataType(resultCTD.getUniqueId(), properties);
if (addPropertiesToDataType.isRight()) {
log.debug("Failed add properties {} to data type {}", properties, dataTypeDefinition.getName());
return Either.right(addPropertiesToDataType.right().value());
@@ -1493,7 +1514,8 @@
String deriveFromUid = UniqueIdBuilder.buildDataTypeUid(derivedFrom);
UniqueIdData to = new UniqueIdData(NodeTypeEnum.DataType, deriveFromUid);
- Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphGenericDao
+ .createRelation(from, to, GraphEdgeLabels.DERIVED_FROM, null);
log.debug("After create relation between capability type {} to its parent {}. status is {}", dtUniqueId, derivedFrom, createRelation);
if (createRelation.isRight()) {
return Either.right(createRelation.right().value());
@@ -1528,7 +1550,7 @@
* @param properties
* @return
*/
- private Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToDataType(String uniqueId, List<PropertyDefinition> properties) {
+ private Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToDataType(String uniqueId, List<PropertyDefinition> properties) {
Map<String, PropertyData> propertiesData = new HashMap<>();
@@ -1537,7 +1559,7 @@
String propertyName = propertyDefinition.getName();
String propertyType = propertyDefinition.getType();
- Either<Boolean, TitanOperationStatus> validPropertyType = isValidPropertyType(propertyType);
+ Either<Boolean, JanusGraphOperationStatus> validPropertyType = isValidPropertyType(propertyType);
if (validPropertyType.isRight()) {
log.debug("Data type {} contains invalid property type {}", uniqueId, propertyType);
return Either.right(validPropertyType.right().value());
@@ -1545,12 +1567,12 @@
Boolean isValid = validPropertyType.left().value();
if (isValid == null || !isValid.booleanValue()) {
log.debug("Data type {} contains invalid property type {}", uniqueId, propertyType);
- return Either.right(TitanOperationStatus.INVALID_TYPE);
+ return Either.right(JanusGraphOperationStatus.INVALID_TYPE);
}
- Either<PropertyData, TitanOperationStatus> addPropertyToNodeType = this.addPropertyToNodeType(propertyName, propertyDefinition, NodeTypeEnum.DataType, uniqueId);
+ Either<PropertyData, JanusGraphOperationStatus> addPropertyToNodeType = this.addPropertyToNodeType(propertyName, propertyDefinition, NodeTypeEnum.DataType, uniqueId);
if (addPropertyToNodeType.isRight()) {
- TitanOperationStatus operationStatus = addPropertyToNodeType.right().value();
+ JanusGraphOperationStatus operationStatus = addPropertyToNodeType.right().value();
log.debug("Failed to associate data type {} to property {} in graph. status is {}", uniqueId, propertyName, operationStatus);
BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToDataType", "Failed to associate property to data type. Status is " + operationStatus, ErrorSeverity.ERROR);
return Either.right(operationStatus);
@@ -1563,9 +1585,10 @@
long modificationTime = System.currentTimeMillis();
dataTypeData.getDataTypeDataDefinition().setModificationTime(modificationTime);
- Either<DataTypeData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(dataTypeData, DataTypeData.class);
+ Either<DataTypeData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao
+ .updateNode(dataTypeData, DataTypeData.class);
if (updateNode.isRight()) {
- TitanOperationStatus operationStatus = updateNode.right().value();
+ JanusGraphOperationStatus operationStatus = updateNode.right().value();
log.debug("Failed to update modification time data type {} from graph. status is {}", uniqueId, operationStatus);
BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToDataType", "Failed to fetch data type. Status is " + operationStatus, ErrorSeverity.ERROR);
return Either.right(operationStatus);
@@ -1585,14 +1608,15 @@
* @param uniqueId
* @return
*/
- public Either<DataTypeDefinition, TitanOperationStatus> getDataTypeByUid(String uniqueId) {
+ public Either<DataTypeDefinition, JanusGraphOperationStatus> getDataTypeByUid(String uniqueId) {
- Either<DataTypeDefinition, TitanOperationStatus> result = null;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result = null;
- Either<DataTypeData, TitanOperationStatus> dataTypesRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
+ Either<DataTypeData, JanusGraphOperationStatus> dataTypesRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
if (dataTypesRes.isRight()) {
- TitanOperationStatus status = dataTypesRes.right().value();
+ JanusGraphOperationStatus status = dataTypesRes.right().value();
log.debug(DATA_TYPE_CANNOT_BE_FOUND_IN_GRAPH_STATUS_IS, uniqueId, status);
return Either.right(status);
}
@@ -1600,20 +1624,22 @@
DataTypeData ctData = dataTypesRes.left().value();
DataTypeDefinition dataTypeDefinition = new DataTypeDefinition(ctData.getDataTypeDataDefinition());
- TitanOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
- if (propertiesStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
+ if (propertiesStatus != JanusGraphOperationStatus.OK) {
log.error(FAILED_TO_FETCH_PROPERTIES_OF_DATA_TYPE, uniqueId);
return Either.right(propertiesStatus);
}
- Either<ImmutablePair<DataTypeData, GraphEdge>, TitanOperationStatus> parentNode = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType,
+ Either<ImmutablePair<DataTypeData, GraphEdge>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType,
DataTypeData.class);
log.debug("After retrieving DERIVED_FROM node of {}. status is {}", uniqueId, parentNode);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus != TitanOperationStatus.NOT_FOUND) {
- log.error("Failed to find the parent data type of data type {}. status is {}", uniqueId, titanOperationStatus);
- result = Either.right(titanOperationStatus);
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus != JanusGraphOperationStatus.NOT_FOUND) {
+ log.error("Failed to find the parent data type of data type {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
+ result = Either.right(janusGraphOperationStatus);
return result;
}
} else {
@@ -1622,7 +1648,7 @@
DataTypeData parentCT = immutablePair.getKey();
String parentUniqueId = parentCT.getUniqueId();
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = getDataTypeByUid(parentUniqueId);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> dataTypeByUid = getDataTypeByUid(parentUniqueId);
if (dataTypeByUid.isRight()) {
return Either.right(dataTypeByUid.right().value());
@@ -1638,16 +1664,17 @@
return result;
}
- private TitanOperationStatus fillProperties(String uniqueId, DataTypeDefinition dataTypeDefinition) {
+ private JanusGraphOperationStatus fillProperties(String uniqueId, DataTypeDefinition dataTypeDefinition) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesOfNode = this.findPropertiesOfNode(NodeTypeEnum.DataType, uniqueId);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode = this.findPropertiesOfNode(NodeTypeEnum.DataType, uniqueId);
if (findPropertiesOfNode.isRight()) {
- TitanOperationStatus titanOperationStatus = findPropertiesOfNode.right().value();
- log.debug("After looking for properties of vertex {}. status is {}", uniqueId, titanOperationStatus);
- if (TitanOperationStatus.NOT_FOUND.equals(titanOperationStatus)) {
- return TitanOperationStatus.OK;
+ JanusGraphOperationStatus janusGraphOperationStatus = findPropertiesOfNode.right().value();
+ log.debug("After looking for properties of vertex {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
+ if (JanusGraphOperationStatus.NOT_FOUND.equals(janusGraphOperationStatus)) {
+ return JanusGraphOperationStatus.OK;
} else {
- return titanOperationStatus;
+ return janusGraphOperationStatus;
}
} else {
Map<String, PropertyDefinition> properties = findPropertiesOfNode.left().value();
@@ -1663,7 +1690,7 @@
}
dataTypeDefinition.setProperties(listOfProps);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
}
@@ -1673,12 +1700,12 @@
try {
- Either<DataTypeData, TitanOperationStatus> eitherStatus = addDataTypeToGraph(dataTypeDefinition);
+ Either<DataTypeData, JanusGraphOperationStatus> eitherStatus = addDataTypeToGraph(dataTypeDefinition);
if (eitherStatus.isRight()) {
log.debug("Failed to add data type {} to Graph. status is {}", dataTypeDefinition, eitherStatus.right().value().name());
BeEcompErrorManager.getInstance().logBeFailedAddingNodeTypeError("AddDataType", "DataType");
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(eitherStatus.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(eitherStatus.right().value()));
return result;
} else {
DataTypeData capabilityTypeData = eitherStatus.left().value();
@@ -1692,10 +1719,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -1714,14 +1741,14 @@
try {
String dtUid = UniqueIdBuilder.buildDataTypeUid(name);
- Either<DataTypeDefinition, TitanOperationStatus> ctResult = this.getDataTypeByUid(dtUid);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> ctResult = this.getDataTypeByUid(dtUid);
if (ctResult.isRight()) {
- TitanOperationStatus status = ctResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = ctResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
log.error("Failed to retrieve information on capability type {} status is {}", name, status);
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(ctResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(ctResult.right().value()));
return result;
}
@@ -1732,10 +1759,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -1758,14 +1785,14 @@
try {
String uid = UniqueIdBuilder.buildDataTypeUid(name);
- Either<DataTypeDefinition, TitanOperationStatus> ctResult = this.getDataTypeByUidWithoutDerivedDataTypes(uid);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> ctResult = this.getDataTypeByUidWithoutDerivedDataTypes(uid);
if (ctResult.isRight()) {
- TitanOperationStatus status = ctResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = ctResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
log.error("Failed to retrieve information on capability type {} status is {}", name, status);
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(ctResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(ctResult.right().value()));
return result;
}
@@ -1776,22 +1803,23 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
}
- public Either<DataTypeDefinition, TitanOperationStatus> getDataTypeByUidWithoutDerivedDataTypes(String uniqueId) {
+ public Either<DataTypeDefinition, JanusGraphOperationStatus> getDataTypeByUidWithoutDerivedDataTypes(String uniqueId) {
- Either<DataTypeData, TitanOperationStatus> dataTypesRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
+ Either<DataTypeData, JanusGraphOperationStatus> dataTypesRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
if (dataTypesRes.isRight()) {
- TitanOperationStatus status = dataTypesRes.right().value();
+ JanusGraphOperationStatus status = dataTypesRes.right().value();
log.debug(DATA_TYPE_CANNOT_BE_FOUND_IN_GRAPH_STATUS_IS, uniqueId, status);
return Either.right(status);
}
@@ -1799,8 +1827,8 @@
DataTypeData ctData = dataTypesRes.left().value();
DataTypeDefinition dataTypeDefinition = new DataTypeDefinition(ctData.getDataTypeDataDefinition());
- TitanOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
- if (propertiesStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
+ if (propertiesStatus != JanusGraphOperationStatus.OK) {
log.error(FAILED_TO_FETCH_PROPERTIES_OF_DATA_TYPE, uniqueId);
return Either.right(propertiesStatus);
}
@@ -1821,7 +1849,7 @@
return new DataTypeDefinition(dataTypeData.getDataTypeDataDefinition());
}
- private Either<Boolean, TitanOperationStatus> isValidPropertyType(String propertyType) {
+ private Either<Boolean, JanusGraphOperationStatus> isValidPropertyType(String propertyType) {
if (propertyType == null || propertyType.isEmpty()) {
return Either.left(false);
@@ -1835,13 +1863,13 @@
}
}
- public Either<Boolean, TitanOperationStatus> isDefinedInDataTypes(String propertyType) {
+ public Either<Boolean, JanusGraphOperationStatus> isDefinedInDataTypes(String propertyType) {
String dataTypeUid = UniqueIdBuilder.buildDataTypeUid(propertyType);
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = getDataTypeByUid(dataTypeUid);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> dataTypeByUid = getDataTypeByUid(dataTypeUid);
if (dataTypeByUid.isRight()) {
- TitanOperationStatus status = dataTypeByUid.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = dataTypeByUid.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(false);
}
return Either.right(status);
@@ -1851,15 +1879,16 @@
}
- public Either<Map<String, DataTypeDefinition>, TitanOperationStatus> getAllDataTypes() {
+ public Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> getAllDataTypes() {
Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result = Either.left(dataTypes);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> result = Either.left(dataTypes);
- Either<List<DataTypeData>, TitanOperationStatus> getAllDataTypes = titanGenericDao.getByCriteria(NodeTypeEnum.DataType, null, DataTypeData.class);
+ Either<List<DataTypeData>, JanusGraphOperationStatus> getAllDataTypes = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.DataType, null, DataTypeData.class);
if (getAllDataTypes.isRight()) {
- TitanOperationStatus status = getAllDataTypes.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getAllDataTypes.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(status);
} else {
return result;
@@ -1877,11 +1906,11 @@
for (DataTypeData dataTypeData : list) {
log.trace("Going to fetch data type {}. uid is {}", dataTypeData.getDataTypeDataDefinition().getName(), dataTypeData.getUniqueId());
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = this.getAndAddDataTypeByUid(dataTypeData.getUniqueId(), dataTypes);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> dataTypeByUid = this.getAndAddDataTypeByUid(dataTypeData.getUniqueId(), dataTypes);
if (dataTypeByUid.isRight()) {
- TitanOperationStatus status = dataTypeByUid.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = dataTypeByUid.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -1909,18 +1938,19 @@
* @param uniqueId
* @return
*/
- private Either<DataTypeDefinition, TitanOperationStatus> getAndAddDataTypeByUid(String uniqueId, Map<String, DataTypeDefinition> allDataTypes) {
+ private Either<DataTypeDefinition, JanusGraphOperationStatus> getAndAddDataTypeByUid(String uniqueId, Map<String, DataTypeDefinition> allDataTypes) {
- Either<DataTypeDefinition, TitanOperationStatus> result = null;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result = null;
if (allDataTypes.containsKey(uniqueId)) {
return Either.left(allDataTypes.get(uniqueId));
}
- Either<DataTypeData, TitanOperationStatus> dataTypesRes = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
+ Either<DataTypeData, JanusGraphOperationStatus> dataTypesRes = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, DataTypeData.class);
if (dataTypesRes.isRight()) {
- TitanOperationStatus status = dataTypesRes.right().value();
+ JanusGraphOperationStatus status = dataTypesRes.right().value();
log.debug(DATA_TYPE_CANNOT_BE_FOUND_IN_GRAPH_STATUS_IS, uniqueId, status);
return Either.right(status);
}
@@ -1928,8 +1958,8 @@
DataTypeData ctData = dataTypesRes.left().value();
DataTypeDefinition dataTypeDefinition = new DataTypeDefinition(ctData.getDataTypeDataDefinition());
- TitanOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
- if (propertiesStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus propertiesStatus = fillProperties(uniqueId, dataTypeDefinition);
+ if (propertiesStatus != JanusGraphOperationStatus.OK) {
log.error(FAILED_TO_FETCH_PROPERTIES_OF_DATA_TYPE, uniqueId);
return Either.right(propertiesStatus);
}
@@ -1945,14 +1975,16 @@
return Either.left(dataTypeDefinition);
}
- Either<ImmutablePair<DataTypeData, GraphEdge>, TitanOperationStatus> parentNode = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType,
+ Either<ImmutablePair<DataTypeData, GraphEdge>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType,
DataTypeData.class);
log.debug("After retrieving DERIVED_FROM node of {}. status is {}", uniqueId, parentNode);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus != TitanOperationStatus.NOT_FOUND) {
- log.error("Failed to find the parent data type of data type {}. status is {}", uniqueId, titanOperationStatus);
- result = Either.right(titanOperationStatus);
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus != JanusGraphOperationStatus.NOT_FOUND) {
+ log.error("Failed to find the parent data type of data type {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
+ result = Either.right(janusGraphOperationStatus);
return result;
}
} else {
@@ -1961,7 +1993,7 @@
DataTypeData parentCT = immutablePair.getKey();
String parentUniqueId = parentCT.getUniqueId();
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = getDataTypeByUid(parentUniqueId);
+ Either<DataTypeDefinition, JanusGraphOperationStatus> dataTypeByUid = getDataTypeByUid(parentUniqueId);
if (dataTypeByUid.isRight()) {
return Either.right(dataTypeByUid.right().value());
@@ -1977,12 +2009,12 @@
return result;
}
- private Either<DataTypeDefinition, TitanOperationStatus> getDataTypeUsingName(String name) {
+ private Either<DataTypeDefinition, JanusGraphOperationStatus> getDataTypeUsingName(String name) {
String uid = UniqueIdBuilder.buildDataTypeUid(name);
return getDataTypeByUid(uid);
}
- public Either<String, TitanOperationStatus> checkInnerType(PropertyDataDefinition propDataDef) {
+ public Either<String, JanusGraphOperationStatus> checkInnerType(PropertyDataDefinition propDataDef) {
String propertyType = propDataDef.getType();
@@ -1991,12 +2023,13 @@
return getInnerType(type, propDataDef::getSchema);
}
- public Either<List<DataTypeData>, TitanOperationStatus> getAllDataTypeNodes() {
- Either<List<DataTypeData>, TitanOperationStatus> getAllDataTypes = titanGenericDao.getByCriteria(NodeTypeEnum.DataType, null, DataTypeData.class);
+ public Either<List<DataTypeData>, JanusGraphOperationStatus> getAllDataTypeNodes() {
+ Either<List<DataTypeData>, JanusGraphOperationStatus> getAllDataTypes = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.DataType, null, DataTypeData.class);
if (getAllDataTypes.isRight()) {
- TitanOperationStatus status = getAllDataTypes.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = getAllDataTypes.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.OK;
return Either.right(status);
}
}
@@ -2047,11 +2080,12 @@
.bind(props -> getAllDerivedFromChainProperties(uniqueId, nodeType, clazz, props.values()));
}
- private Either<Map<String, PropertyDefinition>, StorageOperationStatus> handleNotFoundProperties(TitanOperationStatus titanOperationStatus) {
- if (titanOperationStatus == TitanOperationStatus.NOT_FOUND) {
+ private Either<Map<String, PropertyDefinition>, StorageOperationStatus> handleNotFoundProperties(JanusGraphOperationStatus janusGraphOperationStatus) {
+ if (janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(new HashMap<>());
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
}
private <T extends GraphNode> Either<List<PropertyDefinition>, StorageOperationStatus> getAllDerivedFromChainProperties(String uniqueId, NodeTypeEnum nodeType, Class<T> clazz, Collection<PropertyDefinition> nodeProps) {
@@ -2060,10 +2094,12 @@
Either<T, StorageOperationStatus> derivedFrom;
while ((derivedFrom = derivedFromOperation.getDerivedFromChild(currentNodeUid, nodeType, clazz)).isLeft()) {
currentNodeUid = derivedFrom.left().value().getUniqueId();
- TitanOperationStatus titanOperationStatus = fillPropertiesList(currentNodeUid, nodeType, accumulatedProps::addAll);
- if (titanOperationStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ janusGraphOperationStatus = fillPropertiesList(currentNodeUid, nodeType, accumulatedProps::addAll);
+ if (janusGraphOperationStatus != JanusGraphOperationStatus.OK) {
log.debug("failed to fetch properties for type {} with id {}", nodeType, currentNodeUid);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(titanOperationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ janusGraphOperationStatus));
}
}
StorageOperationStatus getDerivedResult = derivedFrom.right().value();
@@ -2077,8 +2113,8 @@
/*
* @Override public PropertyOperation getPropertyOperation() { return this; }
*/
- public TitanOperationStatus fillPropertiesList(String uniqueId, NodeTypeEnum nodeType, Consumer<List<PropertyDefinition>> propertySetter) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesRes = findPropertiesifExist(uniqueId, nodeType);
+ public JanusGraphOperationStatus fillPropertiesList(String uniqueId, NodeTypeEnum nodeType, Consumer<List<PropertyDefinition>> propertySetter) {
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesRes = findPropertiesifExist(uniqueId, nodeType);
if (findPropertiesRes.isRight()) {
return findPropertiesRes.right().value();
}
@@ -2087,14 +2123,14 @@
List<PropertyDefinition> propertiesAsList = properties.entrySet().stream().map(Entry::getValue).collect(Collectors.toList());
propertySetter.accept(propertiesAsList);
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesifExist(String uniqueId, NodeTypeEnum nodeType){
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesOfNode = this.findPropertiesOfNode(nodeType, uniqueId);
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesifExist(String uniqueId, NodeTypeEnum nodeType){
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode = this.findPropertiesOfNode(nodeType, uniqueId);
if (findPropertiesOfNode.isRight()) {
log.debug("After looking for properties of vertex {}. status is {}", uniqueId, findPropertiesOfNode.right().value());
- if(findPropertiesOfNode.right().value() == TitanOperationStatus.NOT_FOUND)
+ if(findPropertiesOfNode.right().value() == JanusGraphOperationStatus.NOT_FOUND)
return Either.left(Maps.newHashMap());
return findPropertiesOfNode;
}
@@ -2111,7 +2147,7 @@
*
* @return
*/
- protected Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToElementType(String uniqueId, NodeTypeEnum nodeType, Map<String, PropertyDefinition> propertiesMap) {
+ protected Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToElementType(String uniqueId, NodeTypeEnum nodeType, Map<String, PropertyDefinition> propertiesMap) {
Map<String, PropertyData> propertiesData = new HashMap<>();
@@ -2120,10 +2156,10 @@
for (Entry<String, PropertyDefinition> propertyDefinitionEntry : propertiesMap.entrySet()) {
String propertyName = propertyDefinitionEntry.getKey();
- Either<PropertyData, TitanOperationStatus> addPropertyToNodeType = this.addPropertyToNodeType(propertyName, propertyDefinitionEntry.getValue(), nodeType, uniqueId);
+ Either<PropertyData, JanusGraphOperationStatus> addPropertyToNodeType = this.addPropertyToNodeType(propertyName, propertyDefinitionEntry.getValue(), nodeType, uniqueId);
if (addPropertyToNodeType.isRight()) {
- TitanOperationStatus operationStatus = addPropertyToNodeType.right().value();
+ JanusGraphOperationStatus operationStatus = addPropertyToNodeType.right().value();
log.error("Failed to associate {} {} to property {} in graph. status is {}", nodeType.getName(), uniqueId, propertyName, operationStatus);
return Either.right(operationStatus);
}
@@ -2136,7 +2172,7 @@
}
- public Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToElementType(String uniqueId, NodeTypeEnum elementType, List<PropertyDefinition> properties) {
+ public Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToElementType(String uniqueId, NodeTypeEnum elementType, List<PropertyDefinition> properties) {
Map<String, PropertyDefinition> propMap;
if (properties == null) {
@@ -2186,30 +2222,30 @@
if(MapUtils.isNotEmpty(newDescriptions)){
- TitanOperationStatus updatePropertiesStatus = updateDataTypePropertyDescriptions(oldDataTypeDefinition.getUniqueId(), newDescriptions);
- if (updatePropertiesStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus updatePropertiesStatus = updateDataTypePropertyDescriptions(oldDataTypeDefinition.getUniqueId(), newDescriptions);
+ if (updatePropertiesStatus != JanusGraphOperationStatus.OK) {
log.debug("#updateDataType - Failed to update the descriptions of the properties of the data type {}. Status is {}", oldDataTypeDefinition, updatePropertiesStatus);
BeEcompErrorManager.getInstance().logBeFailedAddingNodeTypeError(UPDATE_DATA_TYPE, PROPERTY);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updatePropertiesStatus));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updatePropertiesStatus));
return result;
}
}
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToDataType = addPropertiesToDataType(oldDataTypeDefinition.getUniqueId(), propertiesToAdd);
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToDataType = addPropertiesToDataType(oldDataTypeDefinition.getUniqueId(), propertiesToAdd);
if (addPropertiesToDataType.isRight()) {
log.debug("Failed to update data type {} to Graph. Status is {}", oldDataTypeDefinition, addPropertiesToDataType.right().value().name());
BeEcompErrorManager.getInstance().logBeFailedAddingNodeTypeError(UPDATE_DATA_TYPE, PROPERTY);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertiesToDataType.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertiesToDataType.right().value()));
return result;
} else {
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = this.getDataTypeByUid(oldDataTypeDefinition.getUniqueId());
+ Either<DataTypeDefinition, JanusGraphOperationStatus> dataTypeByUid = this.getDataTypeByUid(oldDataTypeDefinition.getUniqueId());
if (dataTypeByUid.isRight()) {
- TitanOperationStatus status = addPropertiesToDataType.right().value();
+ JanusGraphOperationStatus status = addPropertiesToDataType.right().value();
log.debug("Failed to get data type {} after update. Status is {}", oldDataTypeDefinition.getUniqueId(), status.name());
BeEcompErrorManager.getInstance().logBeFailedRetrieveNodeError(UPDATE_DATA_TYPE, PROPERTY, status.name());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
} else {
result = Either.left(dataTypeByUid.left().value());
}
@@ -2221,10 +2257,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
log.error(GOING_TO_EXECUTE_ROLLBACK_ON_GRAPH);
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug(GOING_TO_EXECUTE_COMMIT_ON_GRAPH);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -2364,14 +2400,15 @@
* @return
*/
public Either<Integer, StorageOperationStatus> increaseAndGetObjInstancePropertyCounter(String instanceId, NodeTypeEnum nodeType) {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanGenericDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
if (graphResult.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(graphResult.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(graphResult.right().value()));
}
- Either<TitanVertex, TitanOperationStatus> vertexService = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(nodeType), instanceId);
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexService = janusGraphGenericDao
+ .getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(nodeType), instanceId);
if (vertexService.isRight()) {
log.debug("failed to fetch vertex of resource instance for id = {}", instanceId);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexService.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexService.right().value()));
}
Vertex vertex = vertexService.left().value();
@@ -2388,12 +2425,13 @@
}
- public Either<List<PropertyDefinition>, TitanOperationStatus> validatePropertiesUniqueness(Map<String, PropertyDefinition> inheritedProperties, List<PropertyDefinition> properties) {
- Either<List<PropertyDefinition>, TitanOperationStatus> result = Either.left(properties);
+ public Either<List<PropertyDefinition>, JanusGraphOperationStatus> validatePropertiesUniqueness(Map<String, PropertyDefinition> inheritedProperties, List<PropertyDefinition> properties) {
+ Either<List<PropertyDefinition>, JanusGraphOperationStatus> result = Either.left(properties);
for (PropertyDefinition property : properties) {
- TitanOperationStatus status = validatePropertyUniqueness(inheritedProperties, property);
- if (status != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ status = validatePropertyUniqueness(inheritedProperties, property);
+ if (status != JanusGraphOperationStatus.OK) {
result = Either.right(status);
break;
}
@@ -2406,16 +2444,16 @@
* Validates uniqueness of examined property by comparing it with properties in propertiesOfType
* and updates if need type and inner type of the property.
*/
- private TitanOperationStatus validatePropertyUniqueness(Map<String, PropertyDefinition> inheritedProperties, PropertyDefinition property) {
+ private JanusGraphOperationStatus validatePropertyUniqueness(Map<String, PropertyDefinition> inheritedProperties, PropertyDefinition property) {
String propertyName = property.getName();
String propertyType = property.getType();
- TitanOperationStatus result = TitanOperationStatus.OK;
+ JanusGraphOperationStatus result = JanusGraphOperationStatus.OK;
if (inheritedProperties.containsKey(propertyName)) {
PropertyDefinition defaultProperty = inheritedProperties.get(propertyName);
if (typesMismatch(propertyType, defaultProperty.getType())) {
log.error("#validatePropertyUniqueness - Property with name {} and different type already exists.", propertyName);
- result = TitanOperationStatus.PROPERTY_NAME_ALREADY_EXISTS;
+ result = JanusGraphOperationStatus.PROPERTY_NAME_ALREADY_EXISTS;
} else {
property.setType(defaultProperty.getType());
String innerType = defaultProperty.getSchemaType();
@@ -2435,22 +2473,23 @@
}
- public <T extends GraphNode> Either<Map<String, PropertyDefinition>, TitanOperationStatus> getAllTypePropertiesFromAllDerivedFrom(String nextParentUid,
- NodeTypeEnum nodeType,
- Class<T> clazz) {
+ public <T extends GraphNode> Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllTypePropertiesFromAllDerivedFrom(String nextParentUid,
+ NodeTypeEnum nodeType,
+ Class<T> clazz) {
Map<String, PropertyDefinition> allProperies = new HashMap<>();
return getTypePropertiesFromDerivedFromRecursively(nextParentUid, allProperies, nodeType, clazz);
}
- private <T extends GraphNode> Either<Map<String, PropertyDefinition>, TitanOperationStatus> getTypePropertiesFromDerivedFromRecursively(String nextParentUid,
- Map<String, PropertyDefinition> allProperies,
- NodeTypeEnum nodeType,
- Class<T> clazz) {
- TitanOperationStatus error;
- Either<List<ImmutablePair<T, GraphEdge>>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType),
+ private <T extends GraphNode> Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getTypePropertiesFromDerivedFromRecursively(String nextParentUid,
+ Map<String, PropertyDefinition> allProperies,
+ NodeTypeEnum nodeType,
+ Class<T> clazz) {
+ JanusGraphOperationStatus error;
+ Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType),
nextParentUid, GraphEdgeLabels.DERIVED_FROM, nodeType, clazz);
if (childrenNodes.isRight()) {
- if (childrenNodes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (childrenNodes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
error = childrenNodes.right().value();
log.debug("#getTypePropertiesFromDerivedFromRecursively - Couldn't fetch derived from node with UID {}, error: {}", nextParentUid, error);
return Either.right(error);
@@ -2461,8 +2500,9 @@
}
} else {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> allPropertiesOfTypeRes = findPropertiesOfNode(nodeType, nextParentUid);
- if (allPropertiesOfTypeRes.isRight() && !allPropertiesOfTypeRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> allPropertiesOfTypeRes = findPropertiesOfNode(nodeType, nextParentUid);
+ if (allPropertiesOfTypeRes.isRight() && !allPropertiesOfTypeRes.right().value().equals(
+ JanusGraphOperationStatus.NOT_FOUND)) {
error = allPropertiesOfTypeRes.right().value();
log.error("#getTypePropertiesFromDerivedFromRecursively - Failed to retrieve properties for node with UID {} from graph. status is {}", nextParentUid, error);
return Either.right(error);
@@ -2476,10 +2516,11 @@
return getTypePropertiesFromDerivedFromRecursively(childrenNodes.left().value().get(0).getLeft().getUniqueId(), allProperies, nodeType, clazz);
}
}
- private TitanOperationStatus updateDataTypePropertyDescriptions(String uniqueId, Map<String, String> newDescriptions) {
+ private JanusGraphOperationStatus updateDataTypePropertyDescriptions(String uniqueId, Map<String, String> newDescriptions) {
if (MapUtils.isNotEmpty(newDescriptions)) {
- Either<List<ImmutablePair<TitanVertex, Edge>>, TitanOperationStatus> getDataTypePropertiesRes = titanGenericDao.getChildrenVertecies(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), uniqueId, GraphEdgeLabels.PROPERTY);
+ Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> getDataTypePropertiesRes = janusGraphGenericDao
+ .getChildrenVertecies(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), uniqueId, GraphEdgeLabels.PROPERTY);
if(getDataTypePropertiesRes.isRight()){
log.debug("#updateDataTypePropertiesDescriptions - Failed to fetch the property verticies of the Data type {} ", uniqueId);
@@ -2490,14 +2531,14 @@
.forEach(pair -> setNewDescriptionToVertex(newDescriptions.get(getPropertyNameFromEdge(pair)), pair));
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanVertexProperty<String> setNewDescriptionToVertex(String newDescription, ImmutablePair<TitanVertex, Edge> pair) {
+ private JanusGraphVertexProperty<String> setNewDescriptionToVertex(String newDescription, ImmutablePair<JanusGraphVertex, Edge> pair) {
return pair.getLeft().property(GraphPropertiesDictionary.DESCRIPTION.getProperty(), newDescription);
}
- private String getPropertyNameFromEdge(ImmutablePair<TitanVertex, Edge> pair) {
+ private String getPropertyNameFromEdge(ImmutablePair<JanusGraphVertex, Edge> pair) {
return (String) pair.getRight().property(GraphPropertiesDictionary.NAME.getProperty()).value();
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperation.java
index 13ad7a7..0eaec1b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperation.java
@@ -10,8 +10,8 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.RelationshipTypeDefinition;
@@ -39,12 +39,12 @@
private static final String FAILED_TO_FETCH_PROPERTIES_OF_RELATIONSHIP_TYPE = "Failed to fetch properties of "
+ "relationship type {}";
- public Either<RelationshipTypeDefinition, TitanOperationStatus> getRelationshipTypeByName(String name) {
+ public Either<RelationshipTypeDefinition, JanusGraphOperationStatus> getRelationshipTypeByName(String name) {
String uid = UniqueIdBuilder.buildRelationshipTypeUid(name);
- Either<RelationshipTypeDefinition, TitanOperationStatus> result = getRelationshipTypeByUid(uid);
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> result = getRelationshipTypeByUid(uid);
if (result.isRight()) {
- TitanOperationStatus status = result.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = result.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
logger.error("Failed to get information on relationship type {} status is {}", name, status);
}
return Either.right(status);
@@ -52,16 +52,16 @@
return Either.left(result.left().value());
}
- public Either<RelationshipTypeDefinition, TitanOperationStatus> getRelationshipTypeByUid(String uniqueId) {
+ public Either<RelationshipTypeDefinition, JanusGraphOperationStatus> getRelationshipTypeByUid(String uniqueId) {
- Either<RelationshipTypeDefinition, TitanOperationStatus> result;
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> result;
- Either<RelationshipTypeData, TitanOperationStatus> relationshipTypesRes =
- titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(
+ Either<RelationshipTypeData, JanusGraphOperationStatus> relationshipTypesRes =
+ janusGraphGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(
NodeTypeEnum.RelationshipType), uniqueId, RelationshipTypeData.class);
if (relationshipTypesRes.isRight()) {
- TitanOperationStatus status = relationshipTypesRes.right().value();
+ JanusGraphOperationStatus status = relationshipTypesRes.right().value();
logger.debug("Relationship type {} cannot be found in graph. status is {}", uniqueId, status);
return Either.right(status);
}
@@ -70,9 +70,9 @@
RelationshipTypeDefinition relationshipTypeDefinition =
new RelationshipTypeDefinition(relationshipTypeData.getRelationshipTypeDataDefinition());
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> propertiesStatus =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> propertiesStatus =
OperationUtils.fillProperties(uniqueId, propertyOperation, NodeTypeEnum.RelationshipType);
- if (propertiesStatus.isRight() && propertiesStatus.right().value() != TitanOperationStatus.OK) {
+ if (propertiesStatus.isRight() && propertiesStatus.right().value() != JanusGraphOperationStatus.OK) {
logger.error("Failed to fetch properties of relationship type {}", uniqueId);
return Either.right(propertiesStatus.right().value());
}
@@ -81,17 +81,17 @@
relationshipTypeDefinition.setProperties(propertiesStatus.left().value());
}
- Either<ImmutablePair<RelationshipTypeData, GraphEdge>, TitanOperationStatus> parentNode = titanGenericDao
+ Either<ImmutablePair<RelationshipTypeData, GraphEdge>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.RelationshipType), uniqueId,
GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
logger.debug("After retrieving DERIVED_FROM node of {}. status is {}", uniqueId, parentNode);
if (parentNode.isRight()) {
- TitanOperationStatus titanOperationStatus = parentNode.right().value();
- if (titanOperationStatus != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
+ if (janusGraphOperationStatus != JanusGraphOperationStatus.NOT_FOUND) {
logger.error("Failed to find the parent relationship of relationship type {}. status is {}", uniqueId,
- titanOperationStatus);
- result = Either.right(titanOperationStatus);
+ janusGraphOperationStatus);
+ result = Either.right(janusGraphOperationStatus);
return result;
}
} else {
@@ -107,27 +107,27 @@
private Either<RelationshipTypeDefinition, StorageOperationStatus> validateUpdateProperties(
RelationshipTypeDefinition relationshipTypeDefinition) {
- TitanOperationStatus error = null;
+ JanusGraphOperationStatus error = null;
if (MapUtils.isNotEmpty(relationshipTypeDefinition.getProperties())
&& relationshipTypeDefinition.getDerivedFrom() != null) {
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> allPropertiesRes =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> allPropertiesRes =
getAllRelationshipTypePropertiesFromAllDerivedFrom(relationshipTypeDefinition.getDerivedFrom());
- if (allPropertiesRes.isRight() && !TitanOperationStatus.NOT_FOUND.equals(allPropertiesRes.right().value())) {
+ if (allPropertiesRes.isRight() && !JanusGraphOperationStatus.NOT_FOUND.equals(allPropertiesRes.right().value())) {
error = allPropertiesRes.right().value();
logger.debug("Couldn't fetch derived from property nodes for relationship type {}, error: {}",
relationshipTypeDefinition.getType(), error);
}
- error = getTitanOperationStatus(relationshipTypeDefinition, error, allPropertiesRes);
+ error = getJanusGraphOperationStatus(relationshipTypeDefinition, error, allPropertiesRes);
}
if (error == null) {
return Either.left(relationshipTypeDefinition);
}
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
- private TitanOperationStatus getTitanOperationStatus(RelationshipTypeDefinition relationshipTypeDefinition,
- TitanOperationStatus error,
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> allPropertiesRes) {
+ private JanusGraphOperationStatus getJanusGraphOperationStatus(RelationshipTypeDefinition relationshipTypeDefinition,
+ JanusGraphOperationStatus error,
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> allPropertiesRes) {
if (error == null && !allPropertiesRes.left().value().isEmpty()) {
Map<String, PropertyDefinition> derivedFromProperties = allPropertiesRes.left().value();
relationshipTypeDefinition.getProperties().entrySet().stream()
@@ -136,7 +136,7 @@
List<PropertyDefinition>
properties = new ArrayList<>(relationshipTypeDefinition.getProperties().values());
- Either<List<PropertyDefinition>, TitanOperationStatus> validatePropertiesRes =
+ Either<List<PropertyDefinition>, JanusGraphOperationStatus> validatePropertiesRes =
propertyOperation.validatePropertiesUniqueness(allPropertiesRes.left().value(), properties);
if (validatePropertiesRes.isRight()) {
error = validatePropertiesRes.right().value();
@@ -145,7 +145,7 @@
return error;
}
- private Either<Map<String, PropertyDefinition>, TitanOperationStatus> getAllRelationshipTypePropertiesFromAllDerivedFrom(
+ private Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllRelationshipTypePropertiesFromAllDerivedFrom(
String firstParentType) {
return propertyOperation.getAllTypePropertiesFromAllDerivedFrom(firstParentType, NodeTypeEnum.RelationshipType,
RelationshipTypeData.class);
@@ -185,10 +185,10 @@
if (!inTransaction) {
if (result == null || result.isRight()) {
logger.error("#addRelationshipType - Going to execute rollback on graph.");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
logger.debug("#addRelationshipType - Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -200,15 +200,15 @@
Either<RelationshipTypeDefinition, StorageOperationStatus> result;
try {
- Either<RelationshipTypeDefinition, TitanOperationStatus> ctResult = this.getRelationshipTypeByUid(uniqueId);
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> ctResult = this.getRelationshipTypeByUid(uniqueId);
if (ctResult.isRight()) {
- TitanOperationStatus status = ctResult.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = ctResult.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
logger.error("Failed to retrieve information on relationship type {}. status is {}", uniqueId,
status);
}
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(ctResult.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(ctResult.right().value()));
return result;
}
@@ -218,7 +218,7 @@
} finally {
if (!inTransaction) {
logger.debug("Going to execute commit on graph.");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -232,26 +232,26 @@
RelationshipTypeData relationshipTypeData = buildRelationshipTypeData(relationshipTypeDefinition, ctUniqueId);
logger.debug("Before adding relationship type to graph. relationshipTypeData = {}", relationshipTypeData);
- Either<RelationshipTypeData, TitanOperationStatus> createCTResult =
- titanGenericDao.createNode(relationshipTypeData, RelationshipTypeData.class);
+ Either<RelationshipTypeData, JanusGraphOperationStatus> createCTResult =
+ janusGraphGenericDao.createNode(relationshipTypeData, RelationshipTypeData.class);
logger.debug("After adding relationship type to graph. status is = {}", createCTResult);
if (createCTResult.isRight()) {
- TitanOperationStatus operationStatus = createCTResult.right().value();
+ JanusGraphOperationStatus operationStatus = createCTResult.right().value();
logger.error("Failed to relationship type {} to graph. status is {}", relationshipTypeDefinition.getType(),
operationStatus);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus));
}
RelationshipTypeData resultCTD = createCTResult.left().value();
Map<String, PropertyDefinition> propertiesMap = relationshipTypeDefinition.getProperties();
- Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToRelationshipType = propertyOperation
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> addPropertiesToRelationshipType = propertyOperation
.addPropertiesToElementType(resultCTD.getUniqueId(), NodeTypeEnum.RelationshipType, propertiesMap);
if (addPropertiesToRelationshipType.isRight()) {
logger.error("Failed add properties {} to relationship {}", propertiesMap,
relationshipTypeDefinition.getType());
return Either.right(DaoStatusConverter
- .convertTitanStatusToStorageStatus(addPropertiesToRelationshipType.right().value()));
+ .convertJanusGraphStatusToStorageStatus(addPropertiesToRelationshipType.right().value()));
}
return addDerivedFromRelation(relationshipTypeDefinition, ctUniqueId)
@@ -288,13 +288,13 @@
+ "{}", relationshipTypeDefinition.getType(), derivedFrom);
return getRelationshipTypeByType(derivedFrom)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(derivedFromRelationship -> derivedFromOperation.addDerivedFromRelation(relationshipTypeUniqueId,
derivedFromRelationship.getUniqueId(), NodeTypeEnum.RelationshipType));
}
- private Either<RelationshipTypeDefinition, TitanOperationStatus> getRelationshipTypeByType(
+ private Either<RelationshipTypeDefinition, JanusGraphOperationStatus> getRelationshipTypeByType(
String relationshipType) {
// Optimization: In case of Relationship Type its unique ID is the same as type
return getRelationshipTypeByUid(relationshipType);
@@ -312,9 +312,9 @@
} finally {
if (!inTransaction) {
if (updateRelationshipEither == null || updateRelationshipEither.isRight()) {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@@ -325,10 +325,10 @@
RelationshipTypeDefinition newRelationshipTypeDefinition,
RelationshipTypeDefinition oldRelationshipTypeDefinition) {
updateRelationshipTypeData(newRelationshipTypeDefinition, oldRelationshipTypeDefinition);
- return titanGenericDao
+ return janusGraphGenericDao
.updateNode(new RelationshipTypeData(newRelationshipTypeDefinition), RelationshipTypeData.class)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.left()
.bind(updatedNode -> updateRelationshipTypeProperties(newRelationshipTypeDefinition.getUniqueId(),
newRelationshipTypeDefinition.getProperties()))
@@ -379,7 +379,7 @@
return propertyOperation
.addPropertiesToElementType(relationshipTypeId, NodeTypeEnum.RelationshipType, properties)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus);
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
private StorageOperationStatus deleteDerivedFromRelationshipType(String relationshipTypeId,
@@ -393,19 +393,20 @@
.either(derivedFromNode -> derivedFromOperation
.removeDerivedFromRelation(relationshipTypeId, derivedFromNode.getUniqueId(),
NodeTypeEnum.RelationshipType),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
- public Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> getAllRelationshipTypes() {
+ public Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> getAllRelationshipTypes() {
Map<String, RelationshipTypeDefinition> relationshipTypeDefinitionMap = new HashMap<>();
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> result = Either.left(relationshipTypeDefinitionMap);
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> result = Either.left(relationshipTypeDefinitionMap);
- Either<List<RelationshipTypeData>, TitanOperationStatus> getAllRelationshipTypes =
- titanGenericDao.getByCriteria(NodeTypeEnum.RelationshipType, null, RelationshipTypeData.class);
+ Either<List<RelationshipTypeData>, JanusGraphOperationStatus> getAllRelationshipTypes =
+ janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.RelationshipType, null, RelationshipTypeData.class);
if (getAllRelationshipTypes.isRight()) {
- TitanOperationStatus status = getAllRelationshipTypes.right().value();
- if (status != TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getAllRelationshipTypes.right().value();
+ if (status != JanusGraphOperationStatus.NOT_FOUND) {
return Either.right(status);
} else {
return result;
@@ -417,8 +418,8 @@
logger.trace("Number of relationship types to load is {}", list.size());
//Set properties
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> status =
- getMapTitanOperationStatusEither(relationshipTypeDefinitionMap, list);
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> status =
+ getMapJanusGraphOperationStatusEither(relationshipTypeDefinitionMap, list);
if (status != null) {
return status;
}
@@ -427,7 +428,7 @@
return result;
}
- private Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> getMapTitanOperationStatusEither(
+ private Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> getMapJanusGraphOperationStatusEither(
Map<String, RelationshipTypeDefinition> relationshipTypeDefinitionMap,
List<RelationshipTypeData> list) {
for (RelationshipTypeData relationshipTypeData : list) {
@@ -435,12 +436,12 @@
logger.trace("Going to fetch relationship type {}. uid is {}",
relationshipTypeData.getRelationshipTypeDataDefinition().getType(),
relationshipTypeData.getUniqueId());
- Either<RelationshipTypeDefinition, TitanOperationStatus> relationshipTypesByUid =
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> relationshipTypesByUid =
getAndAddPropertiesANdDerivedFrom(relationshipTypeData.getUniqueId(), relationshipTypeDefinitionMap);
if (relationshipTypesByUid.isRight()) {
- TitanOperationStatus status = relationshipTypesByUid.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = relationshipTypesByUid.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
return Either.right(status);
}
@@ -448,18 +449,18 @@
return null;
}
- private Either<RelationshipTypeDefinition, TitanOperationStatus> getAndAddPropertiesANdDerivedFrom(
+ private Either<RelationshipTypeDefinition, JanusGraphOperationStatus> getAndAddPropertiesANdDerivedFrom(
String uniqueId, Map<String, RelationshipTypeDefinition> relationshipTypeDefinitionMap) {
if (relationshipTypeDefinitionMap.containsKey(uniqueId)) {
return Either.left(relationshipTypeDefinitionMap.get(uniqueId));
}
- Either<RelationshipTypeData, TitanOperationStatus> relationshipTypesRes =
- titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.RelationshipType), uniqueId,
+ Either<RelationshipTypeData, JanusGraphOperationStatus> relationshipTypesRes =
+ janusGraphGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.RelationshipType), uniqueId,
RelationshipTypeData.class);
if (relationshipTypesRes.isRight()) {
- TitanOperationStatus status = relationshipTypesRes.right().value();
+ JanusGraphOperationStatus status = relationshipTypesRes.right().value();
logger.debug(RELATIONSHIP_TYPE_CANNOT_BE_FOUND_IN_GRAPH_STATUS_IS, uniqueId, status);
return Either.right(status);
}
@@ -468,9 +469,9 @@
RelationshipTypeDefinition relationshipTypeDefinition =
new RelationshipTypeDefinition(ctData.getRelationshipTypeDataDefinition());
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> propertiesStatus =
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> propertiesStatus =
OperationUtils.fillProperties(uniqueId, propertyOperation, NodeTypeEnum.RelationshipType);
- if (propertiesStatus.isRight() && propertiesStatus.right().value() != TitanOperationStatus.OK) {
+ if (propertiesStatus.isRight() && propertiesStatus.right().value() != JanusGraphOperationStatus.OK) {
logger.error(FAILED_TO_FETCH_PROPERTIES_OF_RELATIONSHIP_TYPE, uniqueId);
return Either.right(propertiesStatus.right().value());
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperation.java
index 72c370f..bea9df9 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperation.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -28,10 +28,10 @@
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -52,11 +52,12 @@
@Component("user-operation")
public class UserAdminOperation implements IUserAdminOperation {
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
- public UserAdminOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) {
+ public UserAdminOperation(@Qualifier("janusgraph-generic-dao")
+ JanusGraphGenericDao janusGraphGenericDao) {
super();
- this.titanGenericDao = titanGenericDao;
+ this.janusGraphGenericDao = janusGraphGenericDao;
}
@@ -93,7 +94,7 @@
return resultWrapper.getInnerElement();
} finally {
if (!inTransaction) {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
log.debug("getUserData - end");
}
@@ -127,7 +128,8 @@
return;
}
id = id.toLowerCase();
- Either<UserData, TitanOperationStatus> either = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), id, UserData.class);
+ Either<UserData, JanusGraphOperationStatus> either = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), id, UserData.class);
if (either.isRight()) {
resultWrapper.setInnerElement(getUserNotFoundError(id, either.right().value()));
@@ -138,10 +140,10 @@
@Override
public Either<User, StorageOperationStatus> saveUserData(User user) {
- Either<UserData, TitanOperationStatus> result = null;
+ Either<UserData, JanusGraphOperationStatus> result = null;
try {
UserData userData = convertToUserData(user);
- result = titanGenericDao.createNode(userData, UserData.class);
+ result = janusGraphGenericDao.createNode(userData, UserData.class);
if (result.isRight()) {
log.debug("Problem while saving User {}. Reason - {}", userData.getUserId(), result.right().value());
return Either.right(StorageOperationStatus.GENERAL_ERROR);
@@ -153,21 +155,21 @@
if (result == null || result.isRight()) {
log.error("saveUserData - Failed");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("saveUserData - end");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
}
@Override
public Either<User, StorageOperationStatus> updateUserData(User user) {
- Either<UserData, TitanOperationStatus> result = null;
+ Either<UserData, JanusGraphOperationStatus> result = null;
try {
log.debug("updateUserData - start");
UserData userData = convertToUserData(user);
- result = titanGenericDao.updateNode(userData, UserData.class);
+ result = janusGraphGenericDao.updateNode(userData, UserData.class);
if (result.isRight()) {
if (log.isDebugEnabled()) {
log.debug("Problem while updating User {}. Reason - {}", userData.toString(), result.right().value());
@@ -181,10 +183,10 @@
if (result == null || result.isRight()) {
log.error("updateUserData - Failed");
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
} else {
log.debug("updateUserData - end");
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
@@ -206,10 +208,11 @@
@Override
public Either<User, ActionStatus> deleteUserData(String id) {
Either<User, ActionStatus> result;
- Either<UserData, TitanOperationStatus> eitherGet = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), id, UserData.class);
+ Either<UserData, JanusGraphOperationStatus> eitherGet = janusGraphGenericDao
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), id, UserData.class);
if (eitherGet.isRight()) {
log.debug("Problem while retriving user with userId {}",id);
- if (eitherGet.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (eitherGet.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
result = Either.right(ActionStatus.USER_NOT_FOUND);
} else {
result = Either.right(ActionStatus.GENERAL_ERROR);
@@ -228,13 +231,14 @@
deleteUser(resultWrapper, userData);
}
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
return resultWrapper.getInnerElement();
}
private void deleteUser(Wrapper<Either<User, ActionStatus>> resultWrapper, UserData userData) {
- Either<UserData, TitanOperationStatus> eitherDelete = titanGenericDao.deleteNode(userData, UserData.class);
+ Either<UserData, JanusGraphOperationStatus> eitherDelete = janusGraphGenericDao
+ .deleteNode(userData, UserData.class);
if (eitherDelete.isRight()) {
if (log.isDebugEnabled()) {
log.debug("Problem while deleting User {}. Reason - {}", userData.toString(), eitherDelete.right().value());
@@ -249,7 +253,8 @@
private void validateUserHasNoConnections(Wrapper<Either<User, ActionStatus>> resultWrapper, UserData userData) {
if (resultWrapper.isEmpty()) {
- Either<List<Edge>, TitanOperationStatus> edgesForNode = titanGenericDao.getEdgesForNode(userData, Direction.BOTH);
+ Either<List<Edge>, JanusGraphOperationStatus> edgesForNode = janusGraphGenericDao
+ .getEdgesForNode(userData, Direction.BOTH);
if (edgesForNode.isRight()) {
if (log.isDebugEnabled()) {
log.debug("Problem while deleting User {}. Reason - {}", userData.getUserId(), edgesForNode.right().value());
@@ -266,21 +271,23 @@
public Either<List<Edge>, StorageOperationStatus> getUserPendingTasksList(User user, Map<String, Object> properties) {
- Either<TitanVertex, TitanOperationStatus> vertexUser = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), user.getUserId());
+ Either<JanusGraphVertex, JanusGraphOperationStatus> vertexUser = janusGraphGenericDao
+ .getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), user.getUserId());
if (vertexUser.isRight()) {
- TitanOperationStatus tos = vertexUser.right().value();
+ JanusGraphOperationStatus tos = vertexUser.right().value();
log.debug("Failed to get User {} from graph while retrieving pending tasks. Reason - {}", user.getUserId(), tos);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(tos));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(tos));
}
List<Edge> pendingTasks = new ArrayList<>();
- Either<List<Edge>, TitanOperationStatus> edges = titanGenericDao.getOutgoingEdgesByCriteria(vertexUser.left().value(), GraphEdgeLabels.STATE, properties);
+ Either<List<Edge>, JanusGraphOperationStatus> edges = janusGraphGenericDao
+ .getOutgoingEdgesByCriteria(vertexUser.left().value(), GraphEdgeLabels.STATE, properties);
if (edges.isRight() || edges.left().value() == null) {
- TitanOperationStatus tos = edges.right().value();
- if (tos == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus tos = edges.right().value();
+ if (tos == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(pendingTasks);
} else {
log.debug("Failed while retrieving pending tasks for user {} . Reason - {}", user.getUserId(), tos);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(tos));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(tos));
}
}
for (Edge edge : edges.left().value()) {
@@ -322,21 +329,22 @@
propertiesToMatch.put(GraphPropertiesDictionary.USER_STATUS.getProperty(), status);
}
- Either<List<UserData>, TitanOperationStatus> userNodes = titanGenericDao.getByCriteria(NodeTypeEnum.User, propertiesToMatch, UserData.class);
+ Either<List<UserData>, JanusGraphOperationStatus> userNodes = janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.User, propertiesToMatch, UserData.class);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
return convertToUsers(role, userNodes);
} finally {
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
}
- private Either<List<User>, ActionStatus> convertToUsers(String role, Either<List<UserData>, TitanOperationStatus> userNodes) {
+ private Either<List<User>, ActionStatus> convertToUsers(String role, Either<List<UserData>, JanusGraphOperationStatus> userNodes) {
if (userNodes.isRight()) {
- // in case of NOT_FOUND from Titan return empty list
- TitanOperationStatus tos = userNodes.right().value();
- if (tos.equals(TitanOperationStatus.NOT_FOUND)) {
+ // in case of NOT_FOUND from JanusGraph return empty list
+ JanusGraphOperationStatus tos = userNodes.right().value();
+ if (tos.equals(JanusGraphOperationStatus.NOT_FOUND)) {
return Either.left(Collections.emptyList());
} else {
log.error("Problem while getting all users with role {}. Reason - {}", role, tos);
@@ -361,8 +369,8 @@
return result;
}
- private Either<User, ActionStatus> getUserNotFoundError(String uid, TitanOperationStatus status) {
- if (status == TitanOperationStatus.NOT_FOUND) {
+ private Either<User, ActionStatus> getUserNotFoundError(String uid, JanusGraphOperationStatus status) {
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("User with userId {} not found", uid);
return Either.right(ActionStatus.USER_NOT_FOUND);
} else {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
index d4cbc8d..5c22120 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
@@ -25,7 +25,7 @@
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
index 9efdc95..046161a 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
@@ -20,14 +20,14 @@
package org.openecomp.sdc.be.model;
-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 org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -54,7 +54,7 @@
Configuration configuration = new Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setJanusGraphInMemoryGraph(true);
Map<String, Object> deploymentRIArtifacts = new HashMap<>();
ArtifactDataDefinition artifactInfo = new ArtifactDataDefinition();
@@ -66,13 +66,13 @@
configurationManager.getConfiguration().setDeploymentResourceInstanceArtifacts(deploymentRIArtifacts);
}
- protected void removeGraphVertices(Either<TitanGraph, TitanOperationStatus> graphResult) {
- TitanGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ protected void removeGraphVertices(Either<JanusGraph, JanusGraphOperationStatus> graphResult) {
+ JanusGraph graph = graphResult.left().value();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCacheTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCacheTest.java
index 4868186..82c8ae6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCacheTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCacheTest.java
@@ -9,7 +9,7 @@
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.be.resources.data.DataTypeData;
@@ -54,7 +54,7 @@
@Test
public void testGetAllDataTypesFromGraph() throws Exception {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result;
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> result;
// default test
result = Deencapsulation.invoke(testSubject, "getAllDataTypesFromGraph");
@@ -62,7 +62,7 @@
@Test
public void testGetAll() throws Exception {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result;
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> result;
// default test
result = testSubject.getAll();
@@ -71,7 +71,7 @@
@Test
public void testGet() throws Exception {
String uniqueId = "";
- Either<DataTypeDefinition, TitanOperationStatus> result;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result;
// default test
result = testSubject.get(uniqueId);
@@ -80,13 +80,13 @@
@Test
public void testGet2() throws Exception {
String uniqueId = "";
- Either<DataTypeDefinition, TitanOperationStatus> result;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result;
HashMap<String, DataTypeDefinition> a = new HashMap<>();
DataTypeDefinition value1 = new DataTypeDefinition();
value1.setUniqueId("mock");
a.put("mock", value1);
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> value = Either.left(a);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> value = Either.left(a);
Mockito.when(propertyOperation.getAllDataTypes()).thenReturn(value);
// default test
Deencapsulation.invoke(testSubject, "replaceAllData");
@@ -100,7 +100,8 @@
@Test
public void testRun2() throws Exception {
- Either<List<DataTypeData>, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR);
+ Either<List<DataTypeData>, JanusGraphOperationStatus> value = Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR);
Mockito.when(propertyOperation.getAllDataTypeNodes()).thenReturn(value);
testSubject.run();
}
@@ -109,14 +110,14 @@
public void testRun3() throws Exception {
LinkedList<DataTypeData> a = new LinkedList<>();
a.add(new DataTypeData());
- Either<List<DataTypeData>, TitanOperationStatus> value = Either.left(a);
+ Either<List<DataTypeData>, JanusGraphOperationStatus> value = Either.left(a);
Mockito.when(propertyOperation.getAllDataTypeNodes()).thenReturn(value);
HashMap<String, DataTypeDefinition> a1 = new HashMap<>();
DataTypeDefinition value1 = new DataTypeDefinition();
value1.setUniqueId("mock");
a1.put("mock", value1);
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> value2 = Either.left(a1);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> value2 = Either.left(a1);
Mockito.when(propertyOperation.getAllDataTypes()).thenReturn(value2);
Deencapsulation.invoke(testSubject, "replaceAllData");
@@ -152,7 +153,7 @@
DataTypeDefinition value1 = new DataTypeDefinition();
value1.setUniqueId("mock");
a.put("mock", value1);
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> value = Either.left(a);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> value = Either.left(a);
Mockito.when(propertyOperation.getAllDataTypes()).thenReturn(value);
// default test
Deencapsulation.invoke(testSubject, "replaceAllData");
@@ -160,7 +161,8 @@
@Test
public void testReplaceAllData2() throws Exception {
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> value = Either.right(TitanOperationStatus.GENERAL_ERROR);
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> value = Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR);
Mockito.when(propertyOperation.getAllDataTypes()).thenReturn(value);
// default test
Deencapsulation.invoke(testSubject, "replaceAllData");
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java
index 49e847a..62155e2 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java
@@ -22,7 +22,7 @@
import org.openecomp.sdc.be.model.Product;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.resources.data.ComponentCacheData;
import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java
index 2e2f36b..8c4d9d5 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java
@@ -1,7 +1,7 @@
package org.openecomp.sdc.be.model.cache;
import org.junit.Test;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class DaoInfoTest {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java
index 5347bc0..4e54ba7 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java
@@ -14,7 +14,7 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.cache.ComponentCache;
import org.openecomp.sdc.be.model.cache.DaoInfo;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
index d6b2dd6..7e0a72e 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
@@ -6,7 +6,8 @@
@Configuration
@ComponentScan({"org.openecomp.sdc.be.dao.cassandra", "org.openecomp.sdc.be.model.cache",
- "org.openecomp.sdc.be.model.jsontitan.operations", "org.openecomp.sdc.be.model.jsontitan.utils",
+ "org.openecomp.sdc.be.model.jsonjanusgraph.operations",
+ "org.openecomp.sdc.be.model.jsonjanusgraph.utils",
"org.openecomp.sdc.be.model.operations.impl"})
@PropertySource("classpath:dao.properties")
public class ModelOperationsSpringConfig { }
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeTypeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java
similarity index 98%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeTypeTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java
index 493cb74..e4e377f 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeTypeTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import java.util.List;
import java.util.Map;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplateTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java
similarity index 98%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplateTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java
index c13ddd3..4875ca6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplateTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java
@@ -1,11 +1,10 @@
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import java.util.Map;
import org.junit.Test;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.DataTypeDefinition;
public class TopologyTemplateTest {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnumTest.java
similarity index 86%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnumTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnumTest.java
index 918b032..f175aa3 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnumTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnumTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.datamodel;
+package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
import org.junit.Test;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnumTest.java
similarity index 86%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnumTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnumTest.java
index b00b13e..a37a157 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnumTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnumTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.enums;
+package org.openecomp.sdc.be.model.jsonjanusgraph.enums;
import org.junit.Test;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
similarity index 79%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
index b906604..ce208d9 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
@@ -6,11 +6,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -18,8 +18,8 @@
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -45,7 +45,7 @@
private ArchiveOperation archiveOperation;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private boolean isInitialized;
@@ -88,7 +88,7 @@
@Before
public void beforeTest() {
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
@@ -247,13 +247,13 @@
}
private void assertOnVspArchived(boolean expectedValue) {
- GraphVertex v = titanDao.getVertexById(vfResource0_1.getUniqueId()).left().value();
+ GraphVertex v = janusGraphDao.getVertexById(vfResource0_1.getUniqueId()).left().value();
assertThat(v.getMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED)).isEqualTo(expectedValue);
- v = titanDao.getVertexById(vfResource0_2.getUniqueId()).left().value();
+ v = janusGraphDao.getVertexById(vfResource0_2.getUniqueId()).left().value();
assertThat(v.getMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED)).isEqualTo(expectedValue);
- v = titanDao.getVertexById(vfResource1_0.getUniqueId()).left().value();
+ v = janusGraphDao.getVertexById(vfResource1_0.getUniqueId()).left().value();
assertThat(v.getMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED)).isEqualTo(expectedValue);
}
@@ -262,17 +262,17 @@
*************************/
private void checkoutComponent(GraphVertex serviceVertex0_5) {
- Either<GraphVertex, TitanOperationStatus> vE = titanDao.getVertexById(serviceVertex0_5.getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> vE = janusGraphDao.getVertexById(serviceVertex0_5.getUniqueId());
GraphVertex v = vE.left().value();
v.addMetadataProperty(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
v.setJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
- titanDao.updateVertex(v);
+ janusGraphDao.updateVertex(v);
assertOnCommit();
}
private void assertOnCommit(){
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
}
private void assertArchived(String componentUniqueId) {
@@ -284,18 +284,18 @@
}
private void assertArchivedOrRestored(ArchiveOperation.Action action, String componentUniqueId) {
- GraphVertex v = titanDao.getVertexById(componentUniqueId).left().value();
+ GraphVertex v = janusGraphDao.getVertexById(componentUniqueId).left().value();
EdgeLabelEnum requiredEdge = action == ArchiveOperation.Action.ARCHIVE ? EdgeLabelEnum.ARCHIVE_ELEMENT : EdgeLabelEnum.CATALOG_ELEMENT;
EdgeLabelEnum otherEdge = action == ArchiveOperation.Action.ARCHIVE ? EdgeLabelEnum.CATALOG_ELEMENT : EdgeLabelEnum.ARCHIVE_ELEMENT;
GraphVertex parent = null;
- Either<GraphVertex, TitanOperationStatus> otherLookup = null;
+ Either<GraphVertex, JanusGraphOperationStatus> otherLookup = null;
Boolean isHighest = (Boolean) v.getMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION);
if (isHighest != null && isHighest) {
//Highest version are linked to Archive/Catalog Root
- parent = titanDao.getParentVertex(v, requiredEdge, JsonParseFlagEnum.NoParse).left().value();
- otherLookup = titanDao.getParentVertex(v, otherEdge, JsonParseFlagEnum.NoParse);
+ parent = janusGraphDao.getParentVertex(v, requiredEdge, JsonParseFlagEnum.NoParse).left().value();
+ otherLookup = janusGraphDao.getParentVertex(v, otherEdge, JsonParseFlagEnum.NoParse);
assertThat(otherLookup.isRight()).isTrue(); //Verify that component is not linked to Catalog/Archive Root
assertThat(parent.getUniqueId()).isEqualTo(action == ArchiveOperation.Action.ARCHIVE ? this.archiveVertex.getUniqueId() : this.catalogVertex.getUniqueId()); //Verify that parent is indeed Archive Root
}
@@ -305,13 +305,13 @@
private void assertArchivedProps(String uniqueId) {
GraphVertex v =
- titanDao.getVertexById(uniqueId).left().value();
+ janusGraphDao.getVertexById(uniqueId).left().value();
assertArchivedOrRestoredProps(ArchiveOperation.Action.ARCHIVE, v);
}
private void assertRestoredProps(String uniqueId) {
GraphVertex v =
- titanDao.getVertexById(uniqueId).left().value();
+ janusGraphDao.getVertexById(uniqueId).left().value();
assertArchivedOrRestoredProps(ArchiveOperation.Action.RESTORE, v);
}
@@ -327,9 +327,9 @@
*******************************/
private void initGraphForTest() {
//Create Catalog Root
- this.catalogVertex = GraphTestUtils.createRootCatalogVertex(titanDao);
+ this.catalogVertex = GraphTestUtils.createRootCatalogVertex(janusGraphDao);
//Create Archive Root
- this.archiveVertex = GraphTestUtils.createRootArchiveVertex(titanDao);
+ this.archiveVertex = GraphTestUtils.createRootArchiveVertex(janusGraphDao);
createScenario1_SingleVersionNode();
createScenario2_TwoHighestVersions();
@@ -344,53 +344,58 @@
private void createScenario1_SingleVersionNode() {
//Create Service for Scenario 1 Tests (1 Service)
- this.serviceVertex1 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ this.serviceVertex1 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
//Connect Service to Catalog Root
- titanDao.createEdge(catalogVertex, serviceVertex1, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao.createEdge(catalogVertex, serviceVertex1, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
private void createScenario2_TwoHighestVersions() {
//Create Service for Scenario 2 Tests (1 Service)
- this.serviceVertex1_0 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
- this.serviceVertex1_1 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ this.serviceVertex1_0 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
+ this.serviceVertex1_1 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
- titanDao.createEdge(serviceVertex1_0, serviceVertex1_1, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex1_0, serviceVertex1_1, EdgeLabelEnum.VERSION, null);
//Connect 1.0 and 1.1 to Catalog Root
- titanDao.createEdge(catalogVertex, serviceVertex1_0, EdgeLabelEnum.CATALOG_ELEMENT, null);
- titanDao.createEdge(catalogVertex, serviceVertex1_1, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao
+ .createEdge(catalogVertex, serviceVertex1_0, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao
+ .createEdge(catalogVertex, serviceVertex1_1, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
private void createScenario3_TwoHighestVersionsOneLowest() {
//Create Service for Scenario 1 Tests (1 Service)
- this.serviceVertex2_0 = GraphTestUtils.createServiceVertex(titanDao, propsForNonHighestVersion()); //NonHighestVersion
- this.serviceVertex3_0 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
- this.serviceVertex3_1 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ this.serviceVertex2_0 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForNonHighestVersion()); //NonHighestVersion
+ this.serviceVertex3_0 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
+ this.serviceVertex3_1 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
//Connect version edges
- titanDao.createEdge(serviceVertex2_0, serviceVertex3_0, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(serviceVertex3_0, serviceVertex3_1, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex2_0, serviceVertex3_0, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex3_0, serviceVertex3_1, EdgeLabelEnum.VERSION, null);
//Connect 3.0 and 3.1 to Catalog Root
- titanDao.createEdge(catalogVertex, serviceVertex3_0, EdgeLabelEnum.CATALOG_ELEMENT, null);
- titanDao.createEdge(catalogVertex, serviceVertex3_1, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao
+ .createEdge(catalogVertex, serviceVertex3_0, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao
+ .createEdge(catalogVertex, serviceVertex3_1, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
private void createScenario4_1Highest4LowestVersions() {
//2 Lowest version only
- this.serviceVertex0_1 = GraphTestUtils.createServiceVertex(titanDao, propsForNonHighestVersion());
- this.serviceVertex0_2 = GraphTestUtils.createServiceVertex(titanDao, propsForNonHighestVersion());
- this.serviceVertex0_3 = GraphTestUtils.createServiceVertex(titanDao, propsForNonHighestVersion());
- this.serviceVertex0_4 = GraphTestUtils.createServiceVertex(titanDao, propsForNonHighestVersion());
- this.serviceVertex0_5 = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ this.serviceVertex0_1 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForNonHighestVersion());
+ this.serviceVertex0_2 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForNonHighestVersion());
+ this.serviceVertex0_3 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForNonHighestVersion());
+ this.serviceVertex0_4 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForNonHighestVersion());
+ this.serviceVertex0_5 = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
- titanDao.createEdge(serviceVertex0_1, serviceVertex0_2, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(serviceVertex0_2, serviceVertex0_3, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(serviceVertex0_3, serviceVertex0_4, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(serviceVertex0_4, serviceVertex0_5, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex0_1, serviceVertex0_2, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex0_2, serviceVertex0_3, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex0_3, serviceVertex0_4, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(serviceVertex0_4, serviceVertex0_5, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(catalogVertex, serviceVertex0_5, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ janusGraphDao
+ .createEdge(catalogVertex, serviceVertex0_5, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
private void createResourcesForArchivedVsp(){
@@ -402,35 +407,39 @@
vfPropsHighest.put(GraphPropertyEnum.CSAR_UUID, csarUuid);
vfPropsHighest.put(GraphPropertyEnum.IS_VSP_ARCHIVED, false);
- this.vfResource0_1 = GraphTestUtils.createResourceVertex(titanDao, vfPropsNonHighest, ResourceTypeEnum.VF);
- this.vfResource0_2 = GraphTestUtils.createResourceVertex(titanDao, vfPropsNonHighest, ResourceTypeEnum.VF);
- this.vfResource1_0 = GraphTestUtils.createResourceVertex(titanDao, vfPropsHighest, ResourceTypeEnum.VF);
+ this.vfResource0_1 = GraphTestUtils.createResourceVertex(janusGraphDao, vfPropsNonHighest, ResourceTypeEnum.VF);
+ this.vfResource0_2 = GraphTestUtils.createResourceVertex(janusGraphDao, vfPropsNonHighest, ResourceTypeEnum.VF);
+ this.vfResource1_0 = GraphTestUtils.createResourceVertex(janusGraphDao, vfPropsHighest, ResourceTypeEnum.VF);
- titanDao.createEdge(vfResource0_1, vfResource0_2, EdgeLabelEnum.VERSION, null);
- titanDao.createEdge(vfResource0_2, vfResource1_0, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(vfResource0_1, vfResource0_2, EdgeLabelEnum.VERSION, null);
+ janusGraphDao.createEdge(vfResource0_2, vfResource1_0, EdgeLabelEnum.VERSION, null);
}
private void createMiscServices() {
//Create Service for Scenario 1 Tests (1 Service)
- this.archivedVertex1 = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ this.archivedVertex1 = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
//Connect Service to Catalog Root
- titanDao.createEdge(archiveVertex, archivedVertex1, EdgeLabelEnum.ARCHIVE_ELEMENT, null);
+ janusGraphDao.createEdge(archiveVertex, archivedVertex1, EdgeLabelEnum.ARCHIVE_ELEMENT, null);
}
private void createServiceCompositionForCalculatingArchivedOrigins(){
//Service that point to another service in composition
- this.compositionService = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
- this.compositionAnotherService = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion());
+ this.compositionService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
+ this.compositionAnotherService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
- this.compositionResource1 = GraphTestUtils.createResourceVertex(titanDao, propsForHighestVersion(), ResourceTypeEnum.CP);
- this.compositionResource2 = GraphTestUtils.createResourceVertex(titanDao, propsForHighestVersion(), ResourceTypeEnum.VL);
- this.compositionServiceProxy = GraphTestUtils.createResourceVertex(titanDao, propsForHighestVersion(), ResourceTypeEnum.ServiceProxy);
+ this.compositionResource1 = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.CP);
+ this.compositionResource2 = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.VL);
+ this.compositionServiceProxy = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.ServiceProxy);
- titanDao.createEdge(compositionService, compositionResource1, EdgeLabelEnum.INSTANCE_OF, null);
- titanDao.createEdge(compositionService, compositionResource2, EdgeLabelEnum.INSTANCE_OF, null);
- titanDao.createEdge(compositionService, compositionServiceProxy, EdgeLabelEnum.INSTANCE_OF, null);
- titanDao.createEdge(compositionService, compositionAnotherService, EdgeLabelEnum.PROXY_OF, null);
+ janusGraphDao
+ .createEdge(compositionService, compositionResource1, EdgeLabelEnum.INSTANCE_OF, null);
+ janusGraphDao
+ .createEdge(compositionService, compositionResource2, EdgeLabelEnum.INSTANCE_OF, null);
+ janusGraphDao
+ .createEdge(compositionService, compositionServiceProxy, EdgeLabelEnum.INSTANCE_OF, null);
+ janusGraphDao
+ .createEdge(compositionService, compositionAnotherService, EdgeLabelEnum.PROXY_OF, null);
createAndAttachCompositionJson(compositionService);
}
@@ -466,7 +475,7 @@
//Add Full Json to vertex
compositionService.setJson(compositions);
//System.out.println(JsonParserUtils.toJson(compositions));
- titanDao.updateVertex(compositionService);
+ janusGraphDao.updateVertex(compositionService);
}
private Map<GraphPropertyEnum, Object> propsForHighestVersion(){
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperationsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperationsTest.java
similarity index 90%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperationsTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperationsTest.java
index 410cef9..160957d 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperationsTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperationsTest.java
@@ -1,9 +1,9 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Test;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@@ -57,7 +57,7 @@
@Test
public void getInstanceArtifacts_errorGettingInstanceArtifacts() throws Exception {
- doReturn(Either.right(TitanOperationStatus.GENERAL_ERROR)).when(testInstance).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INSTANCE_ARTIFACTS);
+ doReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)).when(testInstance).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INSTANCE_ARTIFACTS);
Either<Map<String, ArtifactDefinition>, StorageOperationStatus> allInstArtifacts = testInstance.getAllInstanceArtifacts(SERVICE_ID, INSTANCE_ID);
verify(testInstance, times(0)).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
assertTrue(allInstArtifacts.isRight());
@@ -66,7 +66,7 @@
@Test
public void getAllInstanceArtifacts_errorGettingDeploymentArtifacts() throws Exception {
doReturn(Either.left(new HashMap<>())).when(testInstance).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INSTANCE_ARTIFACTS);
- doReturn(Either.right(TitanOperationStatus.GENERAL_ERROR)).when(testInstance).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
+ doReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)).when(testInstance).getDataFromGraph(SERVICE_ID, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS);
Either<Map<String, ArtifactDefinition>, StorageOperationStatus> allInstArtifacts = testInstance.getAllInstanceArtifacts(SERVICE_ID, INSTANCE_ID);
assertTrue(allInstArtifacts.isRight());
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java
similarity index 84%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java
index 0c9c35b..5fc2ef2 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Assert;
@@ -24,12 +24,12 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.utils.CapabilityTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.CapabilityTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import java.util.HashMap;
@@ -45,7 +45,7 @@
@InjectMocks
CapabilitiesOperation operation = new CapabilitiesOperation();
@Mock
- private TitanDao mockTitanDao;
+ private JanusGraphDao mockJanusGraphDao;
@Mock
private TopologyTemplateOperation topologyTemplateOperation;
@@ -53,8 +53,8 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
- when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
- when(mockTitanDao.getVertexById(anyString(), any())).thenReturn(Either.left(new GraphVertex()));
+ when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
+ when(mockJanusGraphDao.getVertexById(anyString(), any())).thenReturn(Either.left(new GraphVertex()));
when(topologyTemplateOperation.updateFullToscaData(any(), any(), any(), anyMap())).thenReturn(StorageOperationStatus.OK);
TopologyTemplate topologyTemplate = new TopologyTemplate();
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
similarity index 85%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
index e580fd5..8900377 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
@@ -7,15 +7,15 @@
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs;
import org.openecomp.sdc.be.model.ModelTestBase;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
-import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -49,7 +49,7 @@
private ExternalReferencesOperation externalReferenceOperation;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private boolean isInitialized;
@@ -74,7 +74,7 @@
this.externalReferenceOperation.setIdMapper(idMapper);
when(idMapper.mapComponentNameToUniqueId(Mockito.anyString(), Mockito.any(GraphVertex.class))).thenReturn(COMPONENT_ID);
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
@@ -85,9 +85,9 @@
Either<String, ActionStatus> addResult = externalReferenceOperation.addExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_4);
assertThat(addResult.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
assertThat(getServiceExternalRefs()).contains(REF_1, REF_2, REF_3, REF_4);
}
@@ -152,9 +152,9 @@
Either<String, ActionStatus> deleteStatus = externalReferenceOperation.deleteExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_5);
assertThat(deleteStatus.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
//Check that ref does not exist anymore
assertThat(getServiceExternalRefs()).doesNotContain(REF_5).contains(REF_1, REF_2, REF_3);
@@ -170,9 +170,9 @@
assertThat(updateResult.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
//Check that ref does not exist anymore
assertThat(getServiceExternalRefs()).doesNotContain(REF_5).contains(REF_1, REF_2, REF_3, REF_4);
@@ -180,7 +180,8 @@
private List<String> getServiceExternalRefs(){
//Get service vertex
- final Either<GraphVertex, TitanOperationStatus> externalRefsVertexResult = this.titanDao.getChildVertex(this.serviceVertex, EdgeLabelEnum.EXTERNAL_REFS, JsonParseFlagEnum.ParseJson);
+ final Either<GraphVertex, JanusGraphOperationStatus> externalRefsVertexResult = this.janusGraphDao
+ .getChildVertex(this.serviceVertex, EdgeLabelEnum.EXTERNAL_REFS, JsonParseFlagEnum.ParseJson);
assertThat(externalRefsVertexResult.isLeft()).isEqualTo(true);
GraphVertex externalRefVertex = externalRefsVertexResult.left().value();
@@ -200,7 +201,7 @@
private void initGraphForTest() {
//create a service
- this.serviceVertex = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ this.serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
this.serviceVertexUuid = this.serviceVertex.getUniqueId();
//monitoring references
@@ -213,14 +214,14 @@
externalReferenceOperation.addExternalReference(serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE, REF_6);
//create a service without refs
- serviceVertex2 = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ serviceVertex2 = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
serviceVertex2Uuid = serviceVertex2.getUniqueId();
//create a service for adding all references
- serviceVertex3 = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ serviceVertex3 = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
serviceVertex3Uuid = serviceVertex3.getUniqueId();
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
}
}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
similarity index 86%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
index 575fbbc..e93ec3c 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
@@ -10,10 +10,10 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.GroupDefinition;
@@ -27,14 +27,14 @@
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class})
+@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class GroupsOperationTest extends ModelTestBase {
@Autowired
private GroupsOperation groupsOperation;
@Autowired
- HealingTitanDao titanDao;
+ HealingJanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -49,14 +49,14 @@
public void setUp() throws Exception {
container = new Resource();
container.setUniqueId(CONTAINER_ID);
- Either<GraphVertex, TitanOperationStatus> createdCmpt = titanDao.createVertex(createBasicContainerGraphVertex());
+ Either<GraphVertex, JanusGraphOperationStatus> createdCmpt = janusGraphDao.createVertex(createBasicContainerGraphVertex());
assertThat(createdCmpt.isLeft()).isTrue();
}
@After
public void tearDown() throws Exception {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@Test
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
similarity index 92%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
index fe2ea20..31d3f86 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
@@ -17,11 +17,11 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -38,9 +38,9 @@
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.common.util.ValidationUtils;
@@ -60,7 +60,7 @@
private final Service service = createService();
private final org.openecomp.sdc.be.model.Resource resource = createResource();
@Resource
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Resource
protected NodeTypeOperation nodeTypeOperation;
@Resource
@@ -78,11 +78,11 @@
@Before
public void setupBefore() {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
createUsers();
createResourceCategory();
createServiceCategory();
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
createRootNodeType();
createNodeType("resource", RESOURCE_ID);
createNodeType("service", SERVICE_ID);
@@ -100,7 +100,7 @@
ownerV.setMetadataProperties(metadataProperties);
ownerV.updateMetadataJsonWithCurrentMetadataProperties();
ownerV.setJson(new HashMap<>());
- Either<GraphVertex, TitanOperationStatus> createUserRes = titanDao.createVertex(ownerV);
+ Either<GraphVertex, JanusGraphOperationStatus> createUserRes = janusGraphDao.createVertex(ownerV);
ownerVertex = createUserRes.left().value();
@@ -114,7 +114,7 @@
modifierV.setMetadataProperties(metadataProperties);
modifierV.updateMetadataJsonWithCurrentMetadataProperties();
modifierV.setJson(new HashMap<>());
- createUserRes = titanDao.createVertex(modifierV);
+ createUserRes = janusGraphDao.createVertex(modifierV);
createUserRes.left().value();
lifecycleOperation.findUser(ownerVertex.getUniqueId());
@@ -145,9 +145,9 @@
subCat.setMetadataProperties(metadataProperties);
subCat.updateMetadataJsonWithCurrentMetadataProperties();
- Either<GraphVertex, TitanOperationStatus> catRes = titanDao.createVertex(cat);
- Either<GraphVertex, TitanOperationStatus> subCatRes = titanDao.createVertex(subCat);
- titanDao.createEdge(catRes.left().value().getVertex(), subCatRes.left().value().getVertex(),
+ Either<GraphVertex, JanusGraphOperationStatus> catRes = janusGraphDao.createVertex(cat);
+ Either<GraphVertex, JanusGraphOperationStatus> subCatRes = janusGraphDao.createVertex(subCat);
+ janusGraphDao.createEdge(catRes.left().value().getVertex(), subCatRes.left().value().getVertex(),
EdgeLabelEnum.SUB_CATEGORY, new HashMap<>());
}
@@ -163,7 +163,7 @@
.put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
- titanDao.createVertex(cat);
+ janusGraphDao.createVertex(cat);
}
private void createRootNodeType() {
@@ -215,8 +215,8 @@
vf.setComponentType(ComponentTypeEnum.RESOURCE);
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes =
- titanDao.getVertexById(createVFRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
+ janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
getNodeTyeRes.left().value();
}
@@ -259,8 +259,8 @@
addProperties.add(prop22);
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes =
- titanDao.getVertexById(createVFRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
+ janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
GraphVertex vfVertex = getNodeTyeRes.left().value();
StorageOperationStatus status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES,
VertexTypeEnum.PROPERTIES, addProperties, JsonPresentationFields.NAME);
@@ -322,15 +322,15 @@
service.setComponentType(ComponentTypeEnum.SERVICE);
Either<TopologyTemplate, StorageOperationStatus> createRes =
topologyTemplateOperation.createTopologyTemplate(service);
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes =
- titanDao.getVertexById(createRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
+ janusGraphDao.getVertexById(createRes.left().value().getUniqueId());
getNodeTyeRes.left().value();
}
@After
public void cleanAfter() {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
}
@Test
@@ -491,7 +491,7 @@
@After
public void teardown() {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationGraphTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
similarity index 88%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationGraphTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
index 1887891..0131783 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationGraphTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
@@ -1,12 +1,12 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-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 java.io.BufferedOutputStream;
import java.io.File;
@@ -27,13 +27,13 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
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.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -43,14 +43,14 @@
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class})
+@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class NodeTemplateOperationGraphTest extends ModelTestBase{
@Resource
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
@Resource
private NodeTemplateOperation nodeTemplateOperation;
- private TitanGraph graphT;
+ private JanusGraph graphT;
private GraphVertex containerVertex;
private String containeId;
@@ -62,19 +62,19 @@
@Before
public void before(){
- Either<TitanGraph, TitanOperationStatus> graph = titanDao.getGraph();
+ Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphDao.getGraph();
graphT = graph.left().value();
containerVertex = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
containeId = "containerId";
containerVertex.setUniqueId(containeId);
- Either<GraphVertex, TitanOperationStatus> createVertex = titanDao.createVertex(containerVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(containerVertex);
assertTrue(createVertex.isLeft());
}
@After
public void after(){
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@@ -136,7 +136,7 @@
private void validateOnGraph(Map<String, List<String>> mapOriginToInstId, int expectedEdgeCount, boolean validateProxy) {
Iterable vertices = graphT.query().has(GraphPropertyEnum.UNIQUE_ID.getProperty(), containeId).vertices();
assertNotNull(vertices);
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
assertTrue(iterator.hasNext());
Vertex containerV = iterator.next();
validatePerEdgeType(mapOriginToInstId, expectedEdgeCount, containerV, EdgeLabelEnum.INSTANCE_OF);
@@ -207,11 +207,11 @@
private String createOrigin(int index) {
- Either<GraphVertex, TitanOperationStatus> createVertex;
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex;
GraphVertex originVertex = new GraphVertex(VertexTypeEnum.NODE_TYPE);
String originId = "originId_" + index;
originVertex.setUniqueId(originId);
- createVertex = titanDao.createVertex(originVertex);
+ createVertex = janusGraphDao.createVertex(originVertex);
assertTrue(createVertex.isLeft());
return originId;
}
@@ -219,15 +219,15 @@
List<String> expextedInList;
Vertex originV = edge.inVertex();
- String id = (String) titanDao.getProperty((TitanVertex)originV, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String id = (String) janusGraphDao.getProperty((JanusGraphVertex)originV, GraphPropertyEnum.UNIQUE_ID.getProperty());
expextedInList = mapOriginToInstId.get(id);
- List<String> list = (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
+ List<String> list = (List<String>) janusGraphDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
assertThat(list).hasSameSizeAs(expextedInList);
assertThat(list).containsOnlyElementsOf(expextedInList);
}
- private String exportGraphMl(TitanGraph graph) {
+ private String exportGraphMl(JanusGraph graph) {
String result = null;
String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
try {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java
similarity index 84%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java
index bddebea..1455d1e 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java
@@ -27,7 +27,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import com.google.common.collect.Lists;
import fj.data.Either;
@@ -40,17 +40,17 @@
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
@@ -91,7 +91,7 @@
private static NodeTemplateOperation operation;
@Mock
- private static TitanDao titanDao;
+ private static JanusGraphDao janusGraphDao;
@Mock
private static TopologyTemplateOperation topologyTemplateOperation;
@@ -99,9 +99,9 @@
@BeforeClass
public static void setup() {
init();
- titanDao = Mockito.mock(TitanDao.class);
+ janusGraphDao = Mockito.mock(JanusGraphDao.class);
operation = new NodeTemplateOperation();
- operation.setTitanDao(titanDao);
+ operation.setJanusGraphDao(janusGraphDao);
buildDataDefinition();
}
@@ -114,13 +114,13 @@
@Test
public void testGetFulfilledCapabilityByRelationSuccess(){
GraphVertex vertex = Mockito.mock(GraphVertex.class);
- Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex);
- when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexRes = Either.left(vertex);
+ when(janusGraphDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
GraphVertex dataVertex = new GraphVertex();
dataVertex.setJson(fulfilledCapability);
- Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex);
- when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertexRes = Either.left(dataVertex);
+ when(janusGraphDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, this::isBelongingCapability);
assertTrue(result.isLeft());
assertEquals(result.left().value(), capability);
@@ -129,13 +129,13 @@
@Test
public void testGetFulfilledRequirementByRelationSuccess(){
GraphVertex vertex = Mockito.mock(GraphVertex.class);
- Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex);
- when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexRes = Either.left(vertex);
+ when(janusGraphDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
GraphVertex dataVertex = new GraphVertex();
dataVertex.setJson(fulfilledRequirement);
- Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex);
- when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertexRes = Either.left(dataVertex);
+ when(janusGraphDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation, this::isBelongingRequirement);
assertTrue(result.isLeft());
assertEquals(result.left().value(), requirement);
@@ -144,11 +144,12 @@
@Test
public void testGetFulfilledCapabilityByRelationNotFoundFailure(){
GraphVertex vertex = Mockito.mock(GraphVertex.class);
- Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex);
- when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexRes = Either.left(vertex);
+ when(janusGraphDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
- Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND);
- when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertexRes = Either.right(
+ JanusGraphOperationStatus.NOT_FOUND);
+ when(janusGraphDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, this::isBelongingCapability);
assertTrue(result.isRight());
assertSame(result.right().value(), StorageOperationStatus.NOT_FOUND);
@@ -157,11 +158,12 @@
@Test
public void testGetFulfilledRequirementByRelationNotFoundFailure(){
GraphVertex vertex = Mockito.mock(GraphVertex.class);
- Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex);
- when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexRes = Either.left(vertex);
+ when(janusGraphDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes);
- Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND);
- when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> childVertexRes = Either.right(
+ JanusGraphOperationStatus.NOT_FOUND);
+ when(janusGraphDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes);
Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation, this::isBelongingRequirement);
assertTrue(result.isRight());
assertSame(result.right().value(), StorageOperationStatus.NOT_FOUND);
@@ -179,8 +181,8 @@
componentInstance.setComponentUid(id);
container.setUniqueId(id);
GraphVertex graphVertex = new GraphVertex();
- when(titanDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertex));
- when(titanDao.updateVertex(graphVertex)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDao.getVertexById(container.getUniqueId(), JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDao.updateVertex(graphVertex)).thenReturn(Either.left(graphVertex));
when(topologyTemplateOperation.getToscaElement(anyString())).thenReturn(Either.left(toscaElement));
result = operation.updateComponentInstanceMetadataOfTopologyTemplate(container, toscaElement, componentInstance);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
similarity index 88%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
index ca8713f..2740551 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.After;
@@ -6,10 +6,9 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
@@ -21,8 +20,8 @@
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -37,7 +36,7 @@
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class})
+@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class PolicyOperationIntegrationTest extends ModelTestBase {
private static final String CONTAINER_ID = "container";
@@ -45,7 +44,7 @@
@Resource
private TopologyTemplateOperation topologyTemplateOperation;
@Resource
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
@Resource
private PolicyOperation policyOperation;
private PropertyDataDefinition prop1, prop2;
@@ -76,15 +75,15 @@
GraphVertex resource = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
resource.addMetadataProperty(GraphPropertyEnum.UNIQUE_ID, CONTAINER_ID);
- titanDao.createVertex(resource);
- GraphVertex loadedResource = titanDao.getVertexById(CONTAINER_ID).left().value();
+ janusGraphDao.createVertex(resource);
+ GraphVertex loadedResource = janusGraphDao.getVertexById(CONTAINER_ID).left().value();
topologyTemplateOperation.addToscaDataToToscaElement(loadedResource, EdgeLabelEnum.POLICIES, VertexTypeEnum.POLICIES, policy, JsonPresentationFields.UNIQUE_ID);
-// titanDao.commit();
+// janusGraphDao.commit();
}
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@Test
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java
similarity index 85%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java
index 136f95b..1df6721 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
@@ -9,10 +9,10 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.PolicyDefinition;
@@ -35,7 +35,7 @@
@InjectMocks
private PolicyOperation testInstance;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private TopologyTemplateOperation topologyTemplateOperation;
@Captor
@@ -63,7 +63,8 @@
@Test
public void updatePolicyProperties_failedToFetchContainer() {
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
StorageOperationStatus storageOperationStatus = testInstance.updatePolicyProperties(component, POLICY_ID, Collections.emptyList());
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.NOT_FOUND);
verifyZeroInteractions(topologyTemplateOperation);
@@ -72,7 +73,7 @@
@Test
public void updatePolicyProperties_updateFailed() {
GraphVertex cmptVertex = new GraphVertex();
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(cmptVertex));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(cmptVertex));
when(topologyTemplateOperation.updatePolicyOfToscaElement(cmptVertex, policyDefinition)).thenReturn(StorageOperationStatus.GENERAL_ERROR);
StorageOperationStatus storageOperationStatus = testInstance.updatePolicyProperties(component, POLICY_ID, Collections.emptyList());
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.GENERAL_ERROR);
@@ -81,7 +82,7 @@
@Test
public void updatePolicyProperties() {
GraphVertex cmptVertex = new GraphVertex();
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(cmptVertex));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(cmptVertex));
when(topologyTemplateOperation.updatePolicyOfToscaElement(eq(cmptVertex), policyDefCaptor.capture())).thenReturn(StorageOperationStatus.OK);
PropertyDataDefinition prop1Copy = new PropertyDataDefinition(prop1);
prop1Copy.setValue("prop1Copy");
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
similarity index 93%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
index 9936d45..f5dd3a0 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
@@ -1,14 +1,13 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
@@ -19,7 +18,7 @@
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -33,7 +32,7 @@
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class})
+@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTestBase {
private static final String CONTAINER_ID = "id";
@@ -44,7 +43,7 @@
private TopologyTemplateOperation topologyTemplateOperation;
@Resource
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private CapabilityPropertyDataObject capabilityProperty1;
private CapabilityPropertyDataObject capabilityProperty2;
private CapabilityPropertyDataObject capabilityProperty3;
@@ -74,14 +73,14 @@
GraphVertex resource = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
resource.addMetadataProperty(GraphPropertyEnum.UNIQUE_ID, CONTAINER_ID);
- titanDao.createVertex(resource);
- GraphVertex loadedResource = titanDao.getVertexById(CONTAINER_ID).left().value();
+ janusGraphDao.createVertex(resource);
+ GraphVertex loadedResource = janusGraphDao.getVertexById(CONTAINER_ID).left().value();
topologyTemplateOperation.associateElementToData(loadedResource, VertexTypeEnum.CALCULATED_CAP_PROPERTIES, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, capabilitiesPropsMap).left().value();
}
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@Test
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java
similarity index 66%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java
index 4ace70b..bc3c7cc 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java
@@ -1,6 +1,6 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -10,12 +10,12 @@
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition;
@@ -27,7 +27,7 @@
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import java.util.*;
@@ -45,11 +45,12 @@
@InjectMocks
private TopologyTemplateOperation topologyTemplateOperation;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Test
public void overrideToscaDataOfToscaElement_failedToFetchContainerVertex() {
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(TitanOperationStatus.INVALID_ID));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(
+ JanusGraphOperationStatus.INVALID_ID));
StorageOperationStatus storageOperationStatus = topologyTemplateOperation.overrideToscaDataOfToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, Collections.emptyMap());
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.INVALID_ID);
}
@@ -57,15 +58,17 @@
@Test
public void overrideToscaDataOfToscaElement_failedToFetchDataVertex() {
GraphVertex containerVertex = new GraphVertex();
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(containerVertex));
- when(titanDao.getChildVertex(containerVertex, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, JsonParseFlagEnum.ParseJson)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(containerVertex));
+ when(janusGraphDao.getChildVertex(containerVertex, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, JsonParseFlagEnum.ParseJson)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
StorageOperationStatus storageOperationStatus = topologyTemplateOperation.overrideToscaDataOfToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, Collections.emptyMap());
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.NOT_FOUND);
}
@Test
public void updateToscaDataDeepElements_failedToFetchContainerVertex() {
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(TitanOperationStatus.INVALID_ID));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(
+ JanusGraphOperationStatus.INVALID_ID));
StorageOperationStatus storageOperationStatus = topologyTemplateOperation.updateToscaDataDeepElementsBlockToToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, new MapCapabilityProperty(), "");
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.INVALID_ID);
}
@@ -73,22 +76,23 @@
@Test
public void updateToscaDataDeepElements_failedToFetchDataVertex() {
GraphVertex containerVertex = new GraphVertex();
- when(titanDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(containerVertex));
- when(titanDao.getChildVertex(containerVertex, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, JsonParseFlagEnum.ParseJson)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getVertexById(CONTAINER_ID, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(containerVertex));
+ when(janusGraphDao.getChildVertex(containerVertex, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, JsonParseFlagEnum.ParseJson)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
StorageOperationStatus storageOperationStatus = topologyTemplateOperation.updateToscaDataDeepElementsBlockToToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, new MapCapabilityProperty(), "");
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.NOT_FOUND);
}
@Test
public void addPolicyToToscaElementSuccessTest(){
- TitanOperationStatus status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
StorageOperationStatus result = addPolicyToToscaElementWithStatus(status);
assertThat(result).isEqualTo(StorageOperationStatus.OK);
}
@Test
public void addPolicyToToscaElementFailureTest(){
- TitanOperationStatus status = TitanOperationStatus.ALREADY_EXIST;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.ALREADY_EXIST;
StorageOperationStatus result = addPolicyToToscaElementWithStatus(status);
assertThat(result).isEqualTo(StorageOperationStatus.ENTITY_ALREADY_EXISTS);
}
@@ -100,7 +104,7 @@
Map<String, MapListRequirementDataDefinition> calcRequirements = new HashMap<>();
Map<String, MapListCapabilityDataDefinition> calcCapabilty = new HashMap<>();
Map<String, MapCapabilityProperty> calCapabilitiesProps = new HashMap<>();
- addPolicyToToscaElementWithStatus(TitanOperationStatus.OK);
+ addPolicyToToscaElementWithStatus(JanusGraphOperationStatus.OK);
result = topologyTemplateOperation.associateOrAddCalcCapReqToComponent(graphVertex, calcRequirements, calcCapabilty, calCapabilitiesProps);
assertEquals(StorageOperationStatus.OK, result);
}
@@ -113,11 +117,12 @@
filter.setIgnoreDataType(false);
String componentName = "componentName";
String componentId = UniqueIdBuilder.buildResourceUniqueId();
- containerVertex.setVertex(Mockito.mock(TitanVertex.class));
+ containerVertex.setVertex(Mockito.mock(JanusGraphVertex.class));
containerVertex.setJsonMetadataField(JsonPresentationFields.NAME, componentName);
containerVertex.setUniqueId(componentId);
containerVertex.setLabel(VertexTypeEnum.TOPOLOGY_TEMPLATE);
- when(titanDao.getChildVertex(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class))).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR));
+ when(janusGraphDao.getChildVertex(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class))).thenReturn(Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR));
Either<ToscaElement, StorageOperationStatus> storageOperationStatus = topologyTemplateOperation.getToscaElement(containerVertex, filter);
assertThat(storageOperationStatus).isEqualTo(Either.right(StorageOperationStatus.GENERAL_ERROR));
}
@@ -141,23 +146,25 @@
}
};
GraphVertex graphVertex = Mockito.mock(GraphVertex.class);
- TitanVertex titanVertex = Mockito.mock(TitanVertex.class);
- when(graphVertex.getVertex()).thenReturn(titanVertex);
- when(titanVertex.edges(Direction.IN, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER.name())).thenReturn(edgeIterator);
- when(titanDao.getVertexByPropertyAndLabel(GraphPropertyEnum.USERID, userId, VertexTypeEnum.USER, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
- when(titanDao.getVertexById(uniqueId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertex));
- when(titanDao.createEdge(graphVertex, graphVertex, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER, null)).thenReturn(TitanOperationStatus.OK);
- when(titanDao.updateVertex(graphVertex)).thenReturn(Either.left(graphVertex));
+ JanusGraphVertex janusGraphVertex = Mockito.mock(JanusGraphVertex.class);
+ when(graphVertex.getVertex()).thenReturn(janusGraphVertex);
+ when(janusGraphVertex.edges(Direction.IN, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER.name())).thenReturn(edgeIterator);
+ when(janusGraphDao
+ .getVertexByPropertyAndLabel(GraphPropertyEnum.USERID, userId, VertexTypeEnum.USER, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDao.getVertexById(uniqueId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDao.createEdge(graphVertex, graphVertex, EdgeLabelEnum.LAST_DISTRIBUTION_STATE_MODIFIER, null)).thenReturn(
+ JanusGraphOperationStatus.OK);
+ when(janusGraphDao.updateVertex(graphVertex)).thenReturn(Either.left(graphVertex));
result = topologyTemplateOperation.updateDistributionStatus(uniqueId, user, DistributionStatusEnum.DISTRIBUTED);
assertThat(result.isLeft());
}
@SuppressWarnings("unchecked")
- private StorageOperationStatus addPolicyToToscaElementWithStatus(TitanOperationStatus status) {
+ private StorageOperationStatus addPolicyToToscaElementWithStatus(JanusGraphOperationStatus status) {
GraphVertex componentV = new GraphVertex();
- componentV.setVertex(Mockito.mock(TitanVertex.class));
+ componentV.setVertex(Mockito.mock(JanusGraphVertex.class));
GraphVertex dataV = new GraphVertex();
- dataV.setVertex(Mockito.mock(TitanVertex.class));
+ dataV.setVertex(Mockito.mock(JanusGraphVertex.class));
String componentName = "componentName";
String componentId = UniqueIdBuilder.buildResourceUniqueId();
String policyTypeName = "org.openecomp.policies.placement.valet.Affinity";
@@ -166,11 +173,12 @@
PolicyDefinition policy = new PolicyDefinition();
policy.setPolicyTypeName(policyTypeName);
int counter = 0;
- Either<GraphVertex, TitanOperationStatus> toscaDataVertexRes = Either.right(TitanOperationStatus.NOT_FOUND);
- when(titanDao.getChildVertex(eq(componentV), eq(EdgeLabelEnum.POLICIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(toscaDataVertexRes);
- Either<GraphVertex, TitanOperationStatus> createVertex = Either.left(dataV);
- when(titanDao.createVertex(any(GraphVertex.class))).thenReturn(createVertex);
- when(titanDao.createEdge(any(TitanVertex.class), any(TitanVertex.class), any(EdgeLabelEnum.class), any(HashMap.class))).thenReturn(status);
+ Either<GraphVertex, JanusGraphOperationStatus> toscaDataVertexRes = Either.right(
+ JanusGraphOperationStatus.NOT_FOUND);
+ when(janusGraphDao.getChildVertex(eq(componentV), eq(EdgeLabelEnum.POLICIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(toscaDataVertexRes);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = Either.left(dataV);
+ when(janusGraphDao.createVertex(any(GraphVertex.class))).thenReturn(createVertex);
+ when(janusGraphDao.createEdge(any(JanusGraphVertex.class), any(JanusGraphVertex.class), any(EdgeLabelEnum.class), any(HashMap.class))).thenReturn(status);
return topologyTemplateOperation.addPolicyToToscaElement(componentV, policy, counter);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationCatalogTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java
similarity index 89%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationCatalogTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java
index bffefd8..eeb7e17 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationCatalogTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -9,11 +9,11 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import java.util.ArrayList;
@@ -31,7 +31,7 @@
@Mock
Vertex vertex;
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@Mock
VertexProperty<Object> property;
@@ -41,9 +41,9 @@
@Before
public void setUp() {
vertexList.add(vertex);
- when(titanDao.getCatalogOrArchiveVerticies(true)).thenReturn(Either.left(vertexList.iterator()));
- when(titanDao.getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse))
- .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDao.getCatalogOrArchiveVerticies(true)).thenReturn(Either.left(vertexList.iterator()));
+ when(janusGraphDao.getChildVertex(vertex, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse))
+ .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
when(vertex.property(GraphPropertiesDictionary.METADATA.getProperty())).thenReturn(property);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
similarity index 87%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
index e77f8e1..205899d 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
@@ -8,16 +8,16 @@
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -42,7 +42,7 @@
private ToscaElementOperationTestImpl toscaElementOperation;
@javax.annotation.Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@BeforeClass
public static void initTest(){
@@ -56,8 +56,8 @@
@Before
public void beforeTest() {
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
- //exportGraphMl(titanDao.getGraph().left().value(),"");
+ GraphTestUtils.clearGraph(janusGraphDao);
+ //exportGraphMl(janusGraphDao.getGraph().left().value(),"");
initGraphForTest();
isInitialized = true;
}
@@ -281,7 +281,7 @@
}
private void initGraphForTest() {
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
Map<GraphPropertyEnum, Object> highstVerticesProps = new HashMap<GraphPropertyEnum, Object>() {
{
@@ -297,34 +297,34 @@
};
// add vertices with higestVersion = true
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, highstVerticesProps, ResourceTypeEnum.VF));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, highstVerticesProps, ResourceTypeEnum.VFC));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, highstVerticesProps, ResourceTypeEnum.VFCMT));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, highstVerticesProps, ResourceTypeEnum.VL));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, highstVerticesProps, ResourceTypeEnum.CP));
- allVertices.add(GraphTestUtils.createServiceVertex(titanDao, highstVerticesProps));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, highstVerticesProps, ResourceTypeEnum.VF));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, highstVerticesProps, ResourceTypeEnum.VFC));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, highstVerticesProps, ResourceTypeEnum.VFCMT));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, highstVerticesProps, ResourceTypeEnum.VL));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, highstVerticesProps, ResourceTypeEnum.CP));
+ allVertices.add(GraphTestUtils.createServiceVertex(janusGraphDao, highstVerticesProps));
// add vertices with non-additional properties
for (int i=0 ; i<2 ; i++) {
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VF));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VFC));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VFCMT));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VL));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.CP));
- allVertices.add(GraphTestUtils.createServiceVertex(titanDao, new HashMap<>()));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VF));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VFC));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VFCMT));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VL));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.CP));
+ allVertices.add(GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>()));
}
// add certified vertices
for (int i=0; i<3; i++) {
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, certifiedVerticesProps, ResourceTypeEnum.VF));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, certifiedVerticesProps, ResourceTypeEnum.VFC));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, certifiedVerticesProps, ResourceTypeEnum.VFCMT));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, certifiedVerticesProps, ResourceTypeEnum.VL));
- allVertices.add(GraphTestUtils.createResourceVertex(titanDao, certifiedVerticesProps, ResourceTypeEnum.CP));
- allVertices.add(GraphTestUtils.createServiceVertex(titanDao, certifiedVerticesProps));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, certifiedVerticesProps, ResourceTypeEnum.VF));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, certifiedVerticesProps, ResourceTypeEnum.VFC));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, certifiedVerticesProps, ResourceTypeEnum.VFCMT));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, certifiedVerticesProps, ResourceTypeEnum.VL));
+ allVertices.add(GraphTestUtils.createResourceVertex(janusGraphDao, certifiedVerticesProps, ResourceTypeEnum.CP));
+ allVertices.add(GraphTestUtils.createServiceVertex(janusGraphDao, certifiedVerticesProps));
}
//allVertices.stream().forEach( v -> System.out.println("type: "+v.getMetadataProperty(GraphPropertyEnum.COMPONENT_TYPE)));
- //String result = GraphTestUtils.exportGraphMl(titanDao.getGraph().left().value(), "");
+ //String result = GraphTestUtils.exportGraphMl(janusGraphDao.getGraph().left().value(), "");
//System.out.println("graph is: " + result);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTestImpl.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTestImpl.java
similarity index 75%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTestImpl.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTestImpl.java
index 27fbce4..01e14cd 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTestImpl.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTestImpl.java
@@ -1,12 +1,12 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
/**
@@ -17,7 +17,7 @@
@Override
protected <T extends ToscaElement> Either<T, StorageOperationStatus> getLightComponent(GraphVertex vertexComponent, ComponentTypeEnum nodeType, ComponentParametersView parametersFilter) {
- titanDao.parseVertexProperties(vertexComponent, JsonParseFlagEnum.ParseMetadata);
+ janusGraphDao.parseVertexProperties(vertexComponent, JsonParseFlagEnum.ParseMetadata);
T toscaElement = convertToComponent(vertexComponent);
return Either.left(toscaElement);
}
@@ -43,17 +43,17 @@
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCategoriesFromGraph(GraphVertex vertexComponent, T toscaElement) {
return null;
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setCapabilitiesFromGraph(GraphVertex componentV, T toscaElement) {
return null;
}
@Override
- protected <T extends ToscaElement> TitanOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
+ protected <T extends ToscaElement> JanusGraphOperationStatus setRequirementsFromGraph(GraphVertex componentV, T toscaElement) {
return null;
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
similarity index 91%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
index 95dca7f..88d3db6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.After;
@@ -6,11 +6,10 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
@@ -34,13 +33,13 @@
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class})
+@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@Autowired
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private PolicyDefinition policy1, policy2;
@@ -67,7 +66,7 @@
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@Test
@@ -121,7 +120,7 @@
private void createContainerVertexInDB() {
GraphVertex resource = createBasicContainerGraphVertex();
- Either<GraphVertex, TitanOperationStatus> container = titanDao.createVertex(resource);
+ Either<GraphVertex, JanusGraphOperationStatus> container = janusGraphDao.createVertex(resource);
assertTrue(container.isLeft());
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
similarity index 86%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
index b43b632..1bbbd1c 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
@@ -27,7 +27,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
@@ -39,13 +39,12 @@
import org.mockito.ArgumentMatchers;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -56,11 +55,11 @@
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.PolicyDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -89,7 +88,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
@RunWith(MockitoJUnitRunner.class)
@@ -104,7 +102,7 @@
private ToscaOperationFacade testInstance;
@Mock
- private HealingTitanDao titanDaoMock;
+ private HealingJanusGraphDao janusGraphDaoMock;
@Mock
private TopologyTemplateOperation topologyTemplateOperationMock;
@@ -128,9 +126,9 @@
ArgumentCaptor<Map> criteriaNotCapture = ArgumentCaptor.forClass(Map.class);
ComponentParametersView dataFilter = new ComponentParametersView();
List<GraphVertex> mockVertices = getMockVertices(2);
- Either<List<GraphVertex>, TitanOperationStatus> returnedVertices = Either.left(mockVertices);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> returnedVertices = Either.left(mockVertices);
- when(titanDaoMock.getByCriteria(eq(null), criteriaCapture.capture(), criteriaNotCapture.capture(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(returnedVertices);
+ when(janusGraphDaoMock.getByCriteria(eq(null), criteriaCapture.capture(), criteriaNotCapture.capture(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(returnedVertices);
when(topologyTemplateOperationMock.getToscaElement(mockVertices.get(0), dataFilter)).thenReturn(Either.left(getResourceToscaElement("0")));
when(topologyTemplateOperationMock.getToscaElement(mockVertices.get(1), dataFilter)).thenReturn(Either.left(getResourceToscaElement("1")));
Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance.fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), dataFilter);
@@ -161,7 +159,8 @@
@SuppressWarnings("unchecked")
@Test
public void fetchMetaDataByResourceType_failedToGetData() throws Exception {
- when(titanDaoMock.getByCriteria(eq(null), anyMap(), anyMap(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR));
+ when(janusGraphDaoMock.getByCriteria(eq(null), anyMap(), anyMap(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR));
Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance.fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), new ComponentParametersView());
assertTrue(fetchedComponents.isRight());
assertEquals(StorageOperationStatus.GENERAL_ERROR, fetchedComponents.right().value());
@@ -214,7 +213,7 @@
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
ToscaElement toscaElement = getToscaElementForTest();
when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex),any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
- when(titanDaoMock.getByCriteria(ModelConverter.getVertexType(component), props)).thenReturn(Either.left(list));
+ when(janusGraphDaoMock.getByCriteria(ModelConverter.getVertexType(component), props)).thenReturn(Either.left(list));
result = testInstance.findLastCertifiedToscaElementByUUID(component);
Component resultComp = result.left().value();
assertEquals(resultComp.getToscaType(),ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
@@ -238,7 +237,7 @@
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- when(titanDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex),any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
result = testInstance.getFullLatestComponentByToscaResourceName("toscaResourceName");
@@ -252,7 +251,7 @@
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID);
List<GraphVertex> vertexList = new ArrayList<>();
- when(titanDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(vertexList));
+ when(janusGraphDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(vertexList));
result = testInstance.validateCsarUuidUniqueness(csarUUID);
assertEquals(StorageOperationStatus.ENTITY_ALREADY_EXISTS, result);
}
@@ -263,7 +262,8 @@
String csarUUID = "csarUUID";
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID);
- when(titanDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
result = testInstance.validateCsarUuidUniqueness(csarUUID);
assertEquals(StorageOperationStatus.OK, result);
}
@@ -284,8 +284,8 @@
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
ToscaElement topologyTemplate = new TopologyTemplate();
topologyTemplate.setComponentType(ComponentTypeEnum.SERVICE);
- when(titanDaoMock.getByCriteria(VertexTypeEnum.NODE_TYPE, props, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(vertexList));
- when(titanDaoMock.getVertexById(uniqueId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getByCriteria(VertexTypeEnum.NODE_TYPE, props, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(vertexList));
+ when(janusGraphDaoMock.getVertexById(uniqueId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(topologyTemplate));
result = testInstance.getLatestCertifiedNodeTypeByToscaResourceName(toscaResourceName);
assertThat(result.isLeft());
@@ -296,7 +296,7 @@
Either<Boolean, StorageOperationStatus> result;
String componentId = "componentId";
GraphVertex graphVertex = getTopologyTemplateVertex();
- when(titanDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
result = testInstance.validateComponentExists(componentId);
assertEquals(true, result.left().value());
}
@@ -305,7 +305,8 @@
public void testValidateCompExists_NotFound() {
Either<Boolean, StorageOperationStatus> result;
String componentId = "componentId";
- when(titanDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
result = testInstance.validateComponentExists(componentId);
assertEquals(false, result.left().value());
}
@@ -319,7 +320,7 @@
List<GraphVertex> graphVertexList = new ArrayList<>();
GraphVertex graphVertex = getTopologyTemplateVertex();
graphVertexList.add(graphVertex);
- when(titanDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
+ when(janusGraphDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
result = testInstance.validateToscaResourceNameExists(templateName);
assertEquals(true, result.left().value());
}
@@ -333,7 +334,8 @@
List<GraphVertex> graphVertexList = new ArrayList<>();
GraphVertex graphVertex = getTopologyTemplateVertex();
graphVertexList.add(graphVertex);
- when(titanDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDaoMock.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
result = testInstance.validateToscaResourceNameExists(templateName);
assertEquals(false, result.left().value());
}
@@ -350,12 +352,13 @@
nodeType.setComponentType(ComponentTypeEnum.RESOURCE);
ToscaElement toscaElement = new TopologyTemplate();
toscaElement.setComponentType(ComponentTypeEnum.SERVICE);
- when(titanDaoMock.getVertexById(id, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
- when(titanDaoMock.getParentVertex(graphVertex, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getVertexById(id, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getParentVertex(graphVertex, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
when(topologyTemplateOperationMock.deleteToscaElement(graphVertex)).thenReturn(Either.left(toscaElement));
when(nodeTypeOperation.createToscaElement(any(ToscaElement.class))).thenReturn(Either.left(nodeType));
- when(titanDaoMock.getVertexById(null, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
- when(titanDaoMock.createEdge(graphVertex, graphVertex, EdgeLabelEnum.VERSION, null)).thenReturn(TitanOperationStatus.OK);
+ when(janusGraphDaoMock.getVertexById(null, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.createEdge(graphVertex, graphVertex, EdgeLabelEnum.VERSION, null)).thenReturn(
+ JanusGraphOperationStatus.OK);
result = testInstance.overrideComponent(resource, resource);
assertTrue(result.isLeft());
}
@@ -366,7 +369,7 @@
String id = "id";
GraphVertex graphVertex = getTopologyTemplateVertex();
ToscaElement toscaElement = getToscaElementForTest();
- when(titanDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
result = testInstance.getToscaElement(id, JsonParseFlagEnum.ParseAll);
assertTrue(result.isLeft());
@@ -379,7 +382,7 @@
String id = "id";
component.setUniqueId(id);
GraphVertex graphVertex = getTopologyTemplateVertex();
- when(titanDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
when(nodeTypeOperation.markComponentToDelete(graphVertex)).thenReturn(Either.left(graphVertex));
result = testInstance.markComponentToDelete(component);
assertEquals(result, StorageOperationStatus.OK);
@@ -391,7 +394,7 @@
String componentId = "compId";
GraphVertex graphVertex = getTopologyTemplateVertex();
ToscaElement toscaElement = getToscaElementForTest();
- when(titanDaoMock.getVertexById(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
when(topologyTemplateOperationMock.deleteToscaElement(graphVertex)).thenReturn(Either.left(toscaElement));
result = testInstance.deleteToscaComponent(componentId);
assertTrue(result.isLeft());
@@ -417,7 +420,7 @@
graphVertex.setMetadataProperties(props);
graphVertexList.add(graphVertex);
- when(titanDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
result = testInstance.getLatestByToscaResourceName(toscaResourceName);
assertTrue(result.isLeft());
@@ -462,7 +465,7 @@
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- when(titanDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(componentVertices));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(componentVertices));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
result = testInstance.getBySystemName(componentTypeEnum, sysName);
assertTrue(result.isLeft());
@@ -487,7 +490,7 @@
hasProperties.put(GraphPropertyEnum.VERSION, version);
hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true);
hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
- when(titanDaoMock.getByCriteria(null, hasProperties, hasNotProperties, parseFlag)).thenReturn(Either.left(graphVertexList));
+ when(janusGraphDaoMock.getByCriteria(null, hasProperties, hasNotProperties, parseFlag)).thenReturn(Either.left(graphVertexList));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
result = testInstance.getComponentByNameAndVersion(componentType, name, version, parseFlag);
assertTrue(result.isLeft());
@@ -559,8 +562,8 @@
} else {
vertex = getNodeTypeVertex();
}
- Either<GraphVertex, TitanOperationStatus> getVertexEither = Either.left(vertex);
- when(titanDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(getVertexEither);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(getVertexEither);
when(topologyTemplateOperationMock.addToscaDataToToscaElement(eq(vertex),
eq(EdgeLabelEnum.DATA_TYPES), eq(VertexTypeEnum.DATA_TYPES), anyMap(), eq(JsonPresentationFields.NAME))).thenReturn(status);
return testInstance.addDataTypesToComponent(dataTypes, componentId);
@@ -572,7 +575,8 @@
String componentId = "componentId";
GraphVertex vertex = getNodeTypeVertex();
Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
- when(titanDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.right(
+ JanusGraphOperationStatus.NOT_FOUND));
result = testInstance.addDataTypesToComponent(dataTypes, componentId);
assertTrue(result.isRight() && result.right().value() == StorageOperationStatus.NOT_FOUND);
}
@@ -636,8 +640,8 @@
} else {
vertex = getNodeTypeVertex();
}
- Either<GraphVertex, TitanOperationStatus> getVertexEither = Either.left(vertex);
- when(titanDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(getVertexEither);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
+ when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(getVertexEither);
when(topologyTemplateOperationMock.addPolicyToToscaElement(eq(vertex), any(PolicyDefinition.class), anyInt())).thenReturn(status);
return testInstance.associatePolicyToComponent(componentId, policy, counter);
}
@@ -646,7 +650,7 @@
PolicyDefinition policy = new PolicyDefinition();
String componentId = "componentId";
GraphVertex vertex = getTopologyTemplateVertex();
- when(titanDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(Either.left(vertex));
+ when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(Either.left(vertex));
when(topologyTemplateOperationMock.updatePolicyOfToscaElement(eq(vertex), any(PolicyDefinition.class))).thenReturn(status);
return testInstance.updatePolicyOfComponent(componentId, policy);
}
@@ -655,8 +659,8 @@
String componentId = "componentId";
String policyId = "policyId";
GraphVertex vertex = getTopologyTemplateVertex();
- Either<GraphVertex, TitanOperationStatus> getVertexEither = Either.left(vertex);
- when(titanDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(getVertexEither);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
+ when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(getVertexEither);
when(topologyTemplateOperationMock.removePolicyFromToscaElement(eq(vertex), eq(policyId))).thenReturn(status);
StorageOperationStatus result = testInstance.removePolicyFromComponent(componentId, policyId);
assertSame(result, status);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
similarity index 94%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperationTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
index acb9af6..68c87bb 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -7,7 +7,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -16,8 +16,8 @@
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@@ -36,7 +36,7 @@
private boolean isInitialized;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Resource
private UpgradeOperation upgradeOperation;
@Resource
@@ -62,7 +62,7 @@
@Before
public void beforeTest() {
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
@@ -102,7 +102,7 @@
Either<User, StorageOperationStatus> saveUserData = userAdminOperation.saveUserData(user);
assertThat(saveUserData.isLeft()).isTrue();
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
resourceCategory = createResourceCategories();
serviceCategory = createServiceCategory();
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityTestUtils.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityTestUtils.java
similarity index 96%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityTestUtils.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityTestUtils.java
index 6f6b7ea..8a17de4 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityTestUtils.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityTestUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
@@ -23,7 +23,7 @@
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/GraphTestUtils.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java
similarity index 74%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/GraphTestUtils.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java
index 71dd472..06e0b42 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/GraphTestUtils.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java
@@ -18,17 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
-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 org.apache.tinkerpop.gremlin.structure.io.IoCore;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -43,21 +43,21 @@
public final class GraphTestUtils {
- public static GraphVertex createRootCatalogVertex(TitanDao titanDao) {
+ public static GraphVertex createRootCatalogVertex(JanusGraphDao janusGraphDao) {
GraphVertex catalogRootVertex = new GraphVertex(VertexTypeEnum.CATALOG_ROOT);
catalogRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(catalogRootVertex)
+ return janusGraphDao.createVertex(catalogRootVertex)
.either(v -> v, s -> null);
}
- public static GraphVertex createRootArchiveVertex(TitanDao titanDao) {
+ public static GraphVertex createRootArchiveVertex(JanusGraphDao janusGraphDao) {
GraphVertex archiveRootVertex = new GraphVertex(VertexTypeEnum.ARCHIVE_ROOT);
archiveRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(archiveRootVertex)
+ return janusGraphDao.createVertex(archiveRootVertex)
.either(v -> v, s -> null);
}
- public static GraphVertex createResourceVertex(TitanDao titanDao, Map<GraphPropertyEnum,Object> metadataProps, ResourceTypeEnum type) {
+ public static GraphVertex createResourceVertex(JanusGraphDao janusGraphDao, Map<GraphPropertyEnum,Object> metadataProps, ResourceTypeEnum type) {
GraphVertex vertex = new GraphVertex();
if (type == ResourceTypeEnum.VF) {
vertex.setLabel(VertexTypeEnum.TOPOLOGY_TEMPLATE);
@@ -76,12 +76,12 @@
for (Map.Entry<GraphPropertyEnum, Object> prop : metadataProps.entrySet()) {
vertex.addMetadataProperty(prop.getKey(), prop.getValue());
}
- titanDao.createVertex(vertex);
- titanDao.commit();
+ janusGraphDao.createVertex(vertex);
+ janusGraphDao.commit();
return vertex;
}
- public static GraphVertex createServiceVertex(TitanDao titanDao, Map<GraphPropertyEnum, Object> metadataProps){
+ public static GraphVertex createServiceVertex(JanusGraphDao janusGraphDao, Map<GraphPropertyEnum, Object> metadataProps){
GraphVertex vertex = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
String uuid = UUID.randomUUID().toString();
vertex.setUniqueId(uuid);
@@ -91,27 +91,27 @@
for (Map.Entry<GraphPropertyEnum, Object> prop : metadataProps.entrySet()) {
vertex.addMetadataProperty(prop.getKey(), prop.getValue());
}
- titanDao.createVertex(vertex);
- titanDao.commit();
+ janusGraphDao.createVertex(vertex);
+ janusGraphDao.commit();
return vertex;
}
- public static void clearGraph(TitanDao titanDao) {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ public static void clearGraph(JanusGraphDao janusGraphDao) {
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanDao.commit();
+ janusGraphDao.commit();
}
- public static String exportGraphMl(TitanGraph graph, String outputDirectory) {
+ public static String exportGraphMl(JanusGraph graph, String outputDirectory) {
String result = null;
String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
try {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapperTest.java
similarity index 93%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapperTest.java
index 39ea68c..dca79c6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapperTest.java
@@ -1,4 +1,4 @@
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import org.junit.Test;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
similarity index 93%
rename from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverterTest.java
rename to catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
index a927f5a..740d148 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverterTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
@@ -27,7 +27,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.be.model.jsontitan.utils;
+package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,9 +40,9 @@
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import java.util.Map;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
index 6fd04c1..dedf84c 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,10 +31,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+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.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -55,14 +55,14 @@
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
public class AdditionalInformationOperationTest extends ModelTestBase {
- private static final TitanGenericDao titanGenericDao = mock(TitanGenericDao.class);
+ private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class);
private static String USER_ID = "muUserId";
private static String CATEGORY_NAME = "category/mycategory";
@Mock
- private TitanVertex titanVertex;
+ private JanusGraphVertex janusGraphVertex;
- @javax.annotation.Resource(name = "titan-generic-dao")
- private TitanGenericDao titanDao;
+ @javax.annotation.Resource(name = "janusgraph-generic-dao")
+ private JanusGraphGenericDao janusGraphDao;
@javax.annotation.Resource(name = "additional-information-operation")
private IAdditionalInformationOperation additionalInformationOperation;
@@ -90,10 +90,10 @@
@Test
public void testAddInfoParameter_InvalidId(){
- Either<AdditionalInformationDefinition, TitanOperationStatus> result;
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> result;
String uid = "uid";
String componentId = "componentId";
- when(titanGenericDao.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(titanVertex));
+ when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(janusGraphVertex));
result = additionalInformationOperation.addAdditionalInformationParameter
(NodeTypeEnum.Resource,componentId,"key","value");
assertThat(result.isRight());
@@ -101,10 +101,10 @@
@Test
public void testUpdateInfoParameter_InvalidId(){
- Either<AdditionalInformationDefinition, TitanOperationStatus> result;
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> result;
String uid = "uid";
String componentId = "componentId";
- when(titanGenericDao.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(titanVertex));
+ when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(janusGraphVertex));
result = additionalInformationOperation.updateAdditionalInformationParameter
(NodeTypeEnum.Resource,componentId,"id","key","value");
assertTrue(result.isRight());
@@ -112,17 +112,17 @@
@Test
public void testDelAdditionalInfoParam_InvalidId() {
- Either<AdditionalInformationDefinition, TitanOperationStatus> result;
+ Either<AdditionalInformationDefinition, JanusGraphOperationStatus> result;
String id = "uid";
String componentId = "componentId";
- TitanGraph graph = titanDao.getGraph().left().value();
- TitanVertex v1 = graph.addVertex();
+ JanusGraph graph = janusGraphDao.getGraph().left().value();
+ JanusGraphVertex v1 = graph.addVertex();
v1.property("uid", componentId);
v1.property(GraphPropertiesDictionary.LABEL.getProperty(), "resource");
- TitanVertex v2 = graph.addVertex();
+ JanusGraphVertex v2 = graph.addVertex();
v2.property(id,id);
- TitanEdge addEdge = v1.addEdge(GraphEdgeLabels.ADDITIONAL_INFORMATION.getProperty(), v2);
+ JanusGraphEdge addEdge = v1.addEdge(GraphEdgeLabels.ADDITIONAL_INFORMATION.getProperty(), v2);
addEdge.property("edgeProp", "resource");
graph.tx().commit();
@@ -132,18 +132,18 @@
}
private void clearGraph() {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanDao.commit();
+ janusGraphDao.commit();
}
private UserData deleteAndCreateUser(String userId, String firstName, String lastName) {
@@ -152,16 +152,16 @@
userData.setFirstName(firstName);
userData.setLastName(lastName);
- titanDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
- titanDao.createNode(userData, UserData.class);
- titanDao.commit();
+ janusGraphDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
+ janusGraphDao.createNode(userData, UserData.class);
+ janusGraphDao.commit();
return userData;
}
private void deleteAndCreateCategory(String category) {
String[] names = category.split("/");
- OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao);
+ OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], janusGraphDao);
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
index 9a3c666..24a263a 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
@@ -5,7 +5,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.model.AnnotationTypeDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -29,7 +29,7 @@
static final String NEW_DESCRIPTION = "new description";
@Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Resource
private CommonTypeOperations commonTypeOperations;
@@ -47,13 +47,13 @@
@Before
public void initTestData() {
- removeGraphVertices(titanGenericDao.getGraph());
+ removeGraphVertices(janusGraphGenericDao.getGraph());
prop1 = createSimpleProperty("val1", "prop1", "string");
}
@After
public void tearDown() {
- titanGenericDao.rollback();
+ janusGraphGenericDao.rollback();
}
@SuppressWarnings("unchecked")
@@ -86,7 +86,7 @@
public void addAnnotationType() {
prepareInitialType();
annotationTypeOperations.addType(initialAnnotationDefinition);
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
@Test
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
index 8e92549..10553a0 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
@@ -23,18 +23,17 @@
import fj.data.Either;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil;
import org.openecomp.sdc.be.resources.data.*;
@@ -60,8 +59,8 @@
private static final String ARTIFACT_NAME = "myHeatArtifact";
- @javax.annotation.Resource(name = "titan-generic-dao")
- private TitanGenericDao titanDao;
+ @javax.annotation.Resource(name = "janusgraph-generic-dao")
+ private JanusGraphGenericDao janusGraphDao;
@javax.annotation.Resource(name = "tosca-operation-facade")
private ToscaOperationFacade toscaOperationFacade;
@@ -99,20 +98,20 @@
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, TitanOperationStatus> parameterNode = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
assertTrue(removeArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, TitanOperationStatus> artifactAfterDelete = titanDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterDelete.isRight());
- Either<HeatParameterData, TitanOperationStatus> parameterNodeAfterDelete = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
}
@Test
@@ -125,7 +124,7 @@
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, TitanOperationStatus> parameterNode = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
// update to artifact without params
@@ -139,18 +138,18 @@
assertTrue(updateArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, TitanOperationStatus> artifactAfterUpdate = titanDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterUpdate.isLeft());
ArtifactData artifactAfterUpdateValue = artifactAfterUpdate.left().value();
assertEquals(artifactNoParams.getArtifactVersion(), artifactAfterUpdateValue.getArtifactDataDefinition()
.getArtifactVersion());
- Either<HeatParameterData, TitanOperationStatus> parameterNodeAfterDelete = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
}
@Test
@@ -163,7 +162,7 @@
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, TitanOperationStatus> parameterNode = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
// update to artifact without params
@@ -175,19 +174,19 @@
assertTrue(updateArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, TitanOperationStatus> artifactAfterUpdate = titanDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterUpdate.isLeft());
ArtifactData artifactAfterUpdateValue = artifactAfterUpdate.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), artifactAfterUpdateValue.getArtifactDataDefinition()
.getArtifactVersion());
- Either<HeatParameterData, TitanOperationStatus> parameterNodeAfterDelete = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID_2, (String) artifactAfterUpdateValue.getUniqueId(), NodeTypeEnum.Resource, true, false);
removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
}
@@ -198,7 +197,7 @@
ResourceMetadataData resource2 = createResource(RESOURCE_ID_2);
Map<String, Object> props = new HashMap<>();
props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), ArtifactGroupTypeEnum.DEPLOYMENT.name());
- Either<GraphRelation, TitanOperationStatus> createRelation = titanDao.createRelation(resource2, new ArtifactData(artifactWithHeat), GraphEdgeLabels.ARTIFACT_REF, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphDao.createRelation(resource2, new ArtifactData(artifactWithHeat), GraphEdgeLabels.ARTIFACT_REF, props);
assertTrue(createRelation.isLeft());
List<HeatParameterDefinition> heatParameters = artifactWithHeat.getListHeatParameters();
@@ -206,7 +205,7 @@
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, TitanOperationStatus> parameterNode = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
ArtifactDefinition atifactToUpdate = new ArtifactDefinition(artifactWithHeat);
@@ -227,19 +226,19 @@
// verify old artifact and parameter still exist
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, TitanOperationStatus> origArtifact = titanDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> origArtifact = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
assertTrue(origArtifact.isLeft());
ArtifactData origArtifactData = origArtifact.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), origArtifactData.getArtifactDataDefinition()
.getArtifactVersion());
- Either<HeatParameterData, TitanOperationStatus> parameterNodeAfterDelete = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
// verify new artifact and new parameter
ArtifactDefinition artifactDefinitionUpdated = updateArifact.left().value();
ArtifactData artifactDataUpdated = new ArtifactData(artifactDefinitionUpdated);
- Either<ArtifactData, TitanOperationStatus> updatedArtifact = titanDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> updatedArtifact = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
assertTrue(updatedArtifact.isLeft());
ArtifactData updatedArtifactData = updatedArtifact.left().value();
assertEquals(atifactToUpdate.getArtifactVersion(), updatedArtifactData.getArtifactDataDefinition()
@@ -251,7 +250,7 @@
assertEquals(1, heatParametersAfterUpdate.size());
HeatParameterDefinition UpdatedHeatParameter = heatParametersAfterUpdate.get(0);
assertFalse(UpdatedHeatParameter.getUniqueId().equalsIgnoreCase((String) parameterData.getUniqueId()));
- Either<HeatParameterData, TitanOperationStatus> parameterNodeAfterUpdate = titanDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), UpdatedHeatParameter.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterUpdate = janusGraphDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), UpdatedHeatParameter.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterUpdate.isLeft());
// delete new artifact
@@ -259,25 +258,25 @@
assertTrue(removeArifact.isLeft());
// verify old artifact and parameter still exist
- origArtifact = titanDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ origArtifact = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
assertTrue(origArtifact.isLeft());
origArtifactData = origArtifact.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), origArtifactData.getArtifactDataDefinition()
.getArtifactVersion());
- parameterNodeAfterDelete = titanDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
// verify new artifact is deleted
- Either<ArtifactData, TitanOperationStatus> artifactAfterDelete = titanDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterDelete.isRight());
- parameterNodeAfterDelete = titanDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), new HeatParameterData(UpdatedHeatParameter).getUniqueId(), HeatParameterData.class);
+ parameterNodeAfterDelete = janusGraphDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), new HeatParameterData(UpdatedHeatParameter).getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
- titanDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
+ janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID_2), ResourceMetadataData.class);
}
private ArtifactDefinition createResourceWithHeat() {
@@ -369,8 +368,8 @@
private void deleteAndCreateCategory(String category) {
String[] names = category.split("/");
- OperationTestsUtil.deleteAndCreateServiceCategory(category, titanDao);
- OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao);
+ OperationTestsUtil.deleteAndCreateServiceCategory(category, janusGraphDao);
+ OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], janusGraphDao);
}
private UserData deleteAndCreateUser(String userId, String firstName, String lastName, String role) {
@@ -384,9 +383,9 @@
userData.setRole("ADMIN");
}
- titanDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
- titanDao.createNode(userData, UserData.class);
- titanDao.commit();
+ janusGraphDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
+ janusGraphDao.createNode(userData, UserData.class);
+ janusGraphDao.commit();
return userData;
}
@@ -395,7 +394,7 @@
ResourceMetadataData serviceData1 = new ResourceMetadataData();
serviceData1.getMetadataDataDefinition().setUniqueId(resourceName);
- Either<ResourceMetadataData, TitanOperationStatus> createNode = titanDao.createNode(serviceData1, ResourceMetadataData.class);
+ Either<ResourceMetadataData, JanusGraphOperationStatus> createNode = janusGraphDao.createNode(serviceData1, ResourceMetadataData.class);
assertTrue("check resource created", createNode.isLeft());
return createNode.left().value();
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
index f853553..b003c93 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
@@ -25,8 +25,8 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-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 java.util.ArrayList;
import java.util.HashMap;
@@ -44,10 +44,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -62,23 +61,15 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import javax.annotation.Resource;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
public class CapabilityTypeOperationTest extends ModelTestBase {
- @Resource(name = "titan-generic-dao")
- private HealingTitanGenericDao titanDao;
+ @Resource(name = "janusgraph-generic-dao")
+ private HealingJanusGraphGenericDao janusGraphDao;
@Resource(name = "capability-type-operation")
private CapabilityTypeOperation capabilityTypeOperation;
@@ -90,20 +81,20 @@
@Before
public void cleanUp() {
- HealingTitanGenericDao titanGenericDao = capabilityTypeOperation.titanGenericDao;
- Either<TitanGraph, TitanOperationStatus> graphResult = titanGenericDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ HealingJanusGraphGenericDao janusGraphGenericDao = capabilityTypeOperation.janusGraphGenericDao;
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
@Test
@@ -124,7 +115,7 @@
CapabilityTypeDefinition capabilityTypeAdded = addCapabilityType1.left().value();
compareBetweenCreatedToSent(capabilityTypeDefinition, capabilityTypeAdded);
- Either<CapabilityTypeDefinition, TitanOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(capabilityTypeAdded.getUniqueId());
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(capabilityTypeAdded.getUniqueId());
compareBetweenCreatedToSent(capabilityTypeByUid.left().value(), capabilityTypeDefinition);
Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
@@ -441,7 +432,7 @@
}
private void verifyDerivedFromNodeEqualsToRootCapabilityType(CapabilityTypeDefinition rootCapabilityType, String parentCapabilityId) {
- Either<ImmutablePair<CapabilityTypeData, GraphEdge>, TitanOperationStatus> derivedFromRelation = titanDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), parentCapabilityId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<CapabilityTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), parentCapabilityId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getCapabilityTypeDataDefinition())
.isEqualToComparingFieldByField(rootCapabilityType);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
index 849a442..029c638 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
@@ -29,7 +29,7 @@
*/
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,10 +37,9 @@
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
@@ -64,12 +63,12 @@
private ComponentInstanceOperation componentInstanceOperation;
@Mock
- protected HealingTitanGenericDao titanGenericDao;
+ protected HealingJanusGraphGenericDao janusGraphGenericDao;
@Test
- public void testSetTitanGenericDao() {
- componentInstanceOperation.setTitanGenericDao(titanGenericDao);
+ public void testSetJanusGraphGenericDao() {
+ componentInstanceOperation.setJanusGraphGenericDao(janusGraphGenericDao);
}
@Test
@@ -87,8 +86,8 @@
public void testUpdateCustomizationUUID() {
StorageOperationStatus result;
String componentInstanceId = "instanceId";
- TitanVertex titanVertex = Mockito.mock(TitanVertex.class);
- when(titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),componentInstanceId)).thenReturn(Either.left(titanVertex));
+ JanusGraphVertex janusGraphVertex = Mockito.mock(JanusGraphVertex.class);
+ when(janusGraphGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),componentInstanceId)).thenReturn(Either.left(janusGraphVertex));
result = componentInstanceOperation.updateCustomizationUUID(componentInstanceId);
assertEquals(StorageOperationStatus.OK, result);
}
@@ -125,7 +124,8 @@
componentInstance.setUniqueId("INST0.1");
componentInstance.setComponentUid("RES0.1");
componentInstance.setGroupInstances(gilist);
- when(titanGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR));
+ when(janusGraphGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.right(
+ JanusGraphOperationStatus.GENERAL_ERROR));
Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false);
assertEquals(StorageOperationStatus.GENERAL_ERROR, result.right().value());
}
@@ -145,7 +145,7 @@
componentInstance.setComponentUid("RES0.1");
componentInstance.setGroupInstances(gilist);
ComponentInstanceData componentInstanceData = new ComponentInstanceData();
- when(titanGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.left(componentInstanceData));
+ when(janusGraphGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.left(componentInstanceData));
Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false);
assertEquals(componentInstanceData, result.left().value());
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
index 9b2a5d9..2c00d3d 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
@@ -26,8 +26,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ArtifactType;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -56,8 +56,8 @@
@javax.annotation.Resource(name = "element-operation")
private ElementOperation elementOperation;
- @javax.annotation.Resource(name = "titan-generic-dao")
- private TitanGenericDao titanDao;
+ @javax.annotation.Resource(name = "janusgraph-generic-dao")
+ private JanusGraphGenericDao janusGraphDao;
private static String CATEGORY = "category";
private static String SUBCATEGORY = "subcategory";
@@ -112,7 +112,7 @@
// @Test
public void testGetResourceAndServiceCategoty() {
- String id = OperationTestsUtil.deleteAndCreateResourceCategory(CATEGORY, SUBCATEGORY, titanDao);
+ String id = OperationTestsUtil.deleteAndCreateResourceCategory(CATEGORY, SUBCATEGORY, janusGraphDao);
Either<CategoryDefinition, ActionStatus> res = elementOperation.getCategory(NodeTypeEnum.ResourceNewCategory, id);
assertTrue(res.isLeft());
@@ -120,7 +120,7 @@
assertEquals(CATEGORY, categoryDefinition.getName());
assertEquals(SUBCATEGORY, categoryDefinition.getSubcategories().get(0).getName());
- id = OperationTestsUtil.deleteAndCreateServiceCategory(CATEGORY, titanDao);
+ id = OperationTestsUtil.deleteAndCreateServiceCategory(CATEGORY, janusGraphDao);
res = elementOperation.getCategory(NodeTypeEnum.ServiceNewCategory, id);
assertTrue(res.isLeft());
@@ -129,7 +129,7 @@
}
private ElementOperation createTestSubject() {
- return new ElementOperation(new TitanGenericDao(new TitanGraphClient()));
+ return new ElementOperation(new JanusGraphGenericDao(new JanusGraphClient()));
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
index 0f8e294..8e1e5d3 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
@@ -1,7 +1,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -10,11 +10,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+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.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
@@ -44,8 +43,8 @@
private static final String TOSCA_GROUPS_ROOT = "tosca.groups.Root";
private static final String NULL_STRING = null;
- @Resource(name = "titan-generic-dao")
- private HealingTitanGenericDao titanDao;
+ @Resource(name = "janusgraph-generic-dao")
+ private HealingJanusGraphGenericDao janusGraphDao;
@Resource(name = "capability-type-operation")
private CapabilityTypeOperation capabilityTypeOperation;
@@ -60,7 +59,7 @@
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
cleanUp();
}
@@ -120,10 +119,12 @@
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
- Either<GroupTypeData, TitanOperationStatus> groupTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
GroupTypeData groupTypeNode = extractVal(groupTypeResult);
- Either<Edge, TitanOperationStatus> edgeResult = titanDao.getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
+ Either<Edge, JanusGraphOperationStatus> edgeResult = janusGraphDao
+ .getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
validate(edgeResult);
}
@@ -132,7 +133,8 @@
getOrCreateRootGroupTypeNode();
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(null);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -171,7 +173,8 @@
buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -199,7 +202,8 @@
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
- Either<GroupTypeData, TitanOperationStatus> groupTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
GroupTypeData groupTypeNode = extractVal(groupTypeResult);
Either<GroupTypeDefinition, StorageOperationStatus> groupTypeDefResult = groupTypeOperation.getGroupTypeByUid(groupTypeNode.getUniqueId());
@@ -213,7 +217,8 @@
CapabilityDefinition updatedCapabilityDef = capabilityDefs.get("vlan_assignment");
assertEquals(2, updatedCapabilityDef.getProperties().size());
- Either<Edge, TitanOperationStatus> edgeDerivedFromResult = titanDao.getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
+ Either<Edge, JanusGraphOperationStatus> edgeDerivedFromResult = janusGraphDao
+ .getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
validate(edgeDerivedFromResult);
}
@@ -226,7 +231,8 @@
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -254,7 +260,8 @@
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
- Either<GroupTypeData, TitanOperationStatus> groupTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
GroupTypeData groupTypeNode = extractVal(groupTypeResult);
Either<GroupTypeDefinition, StorageOperationStatus> groupTypeDefResult = groupTypeOperation.getGroupTypeByUid(groupTypeNode.getUniqueId());
@@ -281,7 +288,8 @@
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -317,7 +325,8 @@
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -362,7 +371,8 @@
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
- Either<CapabilityTypeData, TitanOperationStatus> capabilityTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
+ Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -501,7 +511,8 @@
private GroupTypeData getOrCreateRootGroupTypeNode() {
- Either<GroupTypeData, TitanOperationStatus> groupTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), TOSCA_GROUPS_ROOT, GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), TOSCA_GROUPS_ROOT, GroupTypeData.class);
if(groupTypeResult.isLeft()) {
return groupTypeResult.left().value();
}
@@ -514,7 +525,8 @@
Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(rootGroupDefinition, false);
assertTrue("check group type added", addGroupTypeResult.isLeft());
- Either<GroupTypeData, TitanOperationStatus> groupTypeResult = titanDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), rootGroupDefinition.getType(), GroupTypeData.class);
+ Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
+ .getNode(GraphPropertiesDictionary.TYPE.getProperty(), rootGroupDefinition.getType(), GroupTypeData.class);
return extractVal(groupTypeResult);
}
@@ -603,11 +615,11 @@
assertEquals(expected.getDescription(), actual.getDescription());
}
- private <T> void validate(Either<T, TitanOperationStatus> result) {
+ private <T> void validate(Either<T, JanusGraphOperationStatus> result) {
extractVal(result);
}
- private <T> T extractVal(Either<T, TitanOperationStatus> result) {
+ private <T> T extractVal(Either<T, JanusGraphOperationStatus> result) {
assertTrue(result.isLeft());
T t = result.left().value();
assertNotNull(t);
@@ -616,19 +628,19 @@
}
private void cleanUp() {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanDao.commit();
+ janusGraphDao.commit();
}
@@ -764,17 +776,19 @@
}
private void verifyDerivedFromNodeEqualsToRootGroupType(GroupTypeDefinition rootGroupType, String parentGroupId) {
- Either<ImmutablePair<GroupTypeData, GraphEdge>, TitanOperationStatus> derivedFromRelation = titanDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<GroupTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.GroupType, GroupTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getGroupTypeDataDefinition())
.isEqualToComparingFieldByField(rootGroupType);
}
private void verifyDerivedFromRelationDoesntExist(String parentGroupId) {
- Either<ImmutablePair<GroupTypeData, GraphEdge>, TitanOperationStatus> derivedFromRelation = titanDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<GroupTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphDao
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.GroupType, GroupTypeData.class);
assertThat(derivedFromRelation.right().value())
- .isEqualTo(TitanOperationStatus.NOT_FOUND);
+ .isEqualTo(JanusGraphOperationStatus.NOT_FOUND);
}
private GroupTypeDefinition createGroupTypeDef() {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java
index 61504db..958f7c8 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java
@@ -26,9 +26,9 @@
import org.mockito.Mockito;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+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.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -48,11 +48,11 @@
HeatParametersOperation heatParametersOperation = new HeatParametersOperation();
- TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class);
+ JanusGraphGenericDao janusGraphGenericDao = Mockito.mock(JanusGraphGenericDao.class);
@Before
public void setup() {
- heatParametersOperation.setTitanGenericDao(titanGenericDao);
+ heatParametersOperation.setJanusGraphGenericDao(janusGraphGenericDao);
}
@@ -64,15 +64,15 @@
HeatParameterData propertyData = new HeatParameterData(property);
- Either<HeatParameterData, TitanOperationStatus> either = Either.left(propertyData);
+ Either<HeatParameterData, JanusGraphOperationStatus> either = Either.left(propertyData);
GraphRelation graphRelation = new GraphRelation();
- Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation);
+ Either<GraphRelation, JanusGraphOperationStatus> relationResult = Either.left(graphRelation);
- when(titanGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either);
- when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult);
+ when(janusGraphGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either);
+ when(janusGraphGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult);
- Either<HeatParameterData, TitanOperationStatus> result = heatParametersOperation.addPropertyToGraph(propName, property, "resourceId.artifactId", NodeTypeEnum.ArtifactRef);
+ Either<HeatParameterData, JanusGraphOperationStatus> result = heatParametersOperation.addPropertyToGraph(propName, property, "resourceId.artifactId", NodeTypeEnum.ArtifactRef);
assertTrue(result.isLeft());
@@ -91,13 +91,13 @@
HeatParameterData propertyData = new HeatParameterData(property);
- Either<HeatParameterData, TitanOperationStatus> either = Either.left(propertyData);
+ Either<HeatParameterData, JanusGraphOperationStatus> either = Either.left(propertyData);
GraphRelation graphRelation = new GraphRelation();
- Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation);
+ Either<GraphRelation, JanusGraphOperationStatus> relationResult = Either.left(graphRelation);
- when(titanGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either);
- when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult);
+ when(janusGraphGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either);
+ when(janusGraphGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult);
StorageOperationStatus result = heatParametersOperation.addPropertiesToGraph(parameters, "resourceId.artifactId", NodeTypeEnum.ArtifactRef);
@@ -222,16 +222,16 @@
propertyData.setUniqueId("bla");
propertyData.setValue("value1");
- Either<HeatParameterValueData, TitanOperationStatus> either = Either.left(propertyData);
+ Either<HeatParameterValueData, JanusGraphOperationStatus> either = Either.left(propertyData);
GraphRelation graphRelation = new GraphRelation();
- Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation);
+ Either<GraphRelation, JanusGraphOperationStatus> relationResult = Either.left(graphRelation);
- when(titanGenericDao.createNode(any(HeatParameterValueData.class), eq(HeatParameterValueData.class))).thenReturn(either);
- when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_VALUE), anyMap())).thenReturn(relationResult);
- when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_IMPL), isNull())).thenReturn(relationResult);
+ when(janusGraphGenericDao.createNode(any(HeatParameterValueData.class), eq(HeatParameterValueData.class))).thenReturn(either);
+ when(janusGraphGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_VALUE), anyMap())).thenReturn(relationResult);
+ when(janusGraphGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_IMPL), isNull())).thenReturn(relationResult);
- Either<HeatParameterValueData, TitanOperationStatus> result = heatParametersOperation.addHeatValueToGraph(property, "artifactLabel", "resourceInstanceId.artifactId", "resourceInstanceId");
+ Either<HeatParameterValueData, JanusGraphOperationStatus> result = heatParametersOperation.addHeatValueToGraph(property, "artifactLabel", "resourceInstanceId.artifactId", "resourceInstanceId");
assertTrue(result.isLeft());
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
index 3e8b087..532e76b 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
@@ -33,8 +33,8 @@
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
@@ -72,7 +72,7 @@
private static String USER_ID = "muUserId";
private static String CATEGORY_NAME = "category/mycategory";
- TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class);
+ JanusGraphGenericDao janusGraphGenericDao = Mockito.mock(JanusGraphGenericDao.class);
@InjectMocks
private InterfaceLifecycleOperation interfaceLifecycleOperation = new InterfaceLifecycleOperation();
@@ -87,7 +87,7 @@
MockitoAnnotations.initMocks(this);
final String UNIQUE_ID = "UNIQUE_ID";
CategoryData categoryData = new CategoryData(NodeTypeEnum.ResourceCategory);
- when(titanGenericDao.createNode(any(),any())).thenReturn(Either.left(categoryData));
+ when(janusGraphGenericDao.createNode(any(),any())).thenReturn(Either.left(categoryData));
deleteAndCreateCategory(CATEGORY_NAME);
deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
}
@@ -124,7 +124,7 @@
String reqRelationship = "myrelationship";
ResourceOperationTest resourceOperationTest = new ResourceOperationTest();
- resourceOperationTest.setOperations(titanDao, resourceOperation, propertyOperation);
+ resourceOperationTest.setOperations(janusGraphDao, resourceOperation, propertyOperation);
Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "100.0", null, true, true);
@@ -161,7 +161,7 @@
String softwareCompName = "tosca.nodes.SoftwareComponent";
ResourceOperationTest resourceOperationTest = new ResourceOperationTest();
- resourceOperationTest.setOperations(titanDao, resourceOperation, propertyOperation);
+ resourceOperationTest.setOperations(janusGraphDao, resourceOperation, propertyOperation);
Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "200.0", null, true, true);
@@ -178,7 +178,7 @@
ResourceMetadataData resourceData = new ResourceMetadataData();
resourceData.getMetadataDataDefinition().setUniqueId(rootResource.getUniqueId());
resourceData.getMetadataDataDefinition().setState(LifecycleStateEnum.CERTIFIED.name());
- Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanDao.updateNode(resourceData, ResourceMetadataData.class);
+ Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceData, ResourceMetadataData.class);
assertTrue(updateNode.isLeft());
Either<Resource, StorageOperationStatus> fetchRootResource = resourceOperation.getResource(rootResource.getUniqueId());
@@ -198,7 +198,7 @@
Either<Operation, StorageOperationStatus> opResult = interfaceOperation.updateInterfaceOperation(softwareComponent.getUniqueId(), "standard", "create", op);
// PrintGraph pg = new PrintGraph();
- // System.out.println(pg.buildGraphForWebgraphWiz(titanDao.getGraph().left().value()));
+ // System.out.println(pg.buildGraphForWebgraphWiz(janusGraphDao.getGraph().left().value()));
assertTrue(opResult.isLeft());
log.debug("{}", opResult.left().value());
@@ -247,12 +247,12 @@
private void deleteAndCreateCategory(String category) {
String[] names = category.split("/");
- OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanGenericDao);
+ OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], janusGraphGenericDao);
/*
* CategoryData categoryData = new CategoryData(); categoryData.setName(category);
*
- * titanDao.deleteNode(categoryData, CategoryData.class); Either<CategoryData, TitanOperationStatus> createNode = titanDao .createNode(categoryData, CategoryData.class); System.out.println("after creating caetgory " + createNode);
+ * janusGraphDao.deleteNode(categoryData, CategoryData.class); Either<CategoryData, JanusGraphOperationStatus> createNode = janusGraphDao .createNode(categoryData, CategoryData.class); System.out.println("after creating caetgory " + createNode);
*/
}
@@ -263,18 +263,18 @@
userData.setFirstName(firstName);
userData.setLastName(lastName);
- titanGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId,
+ janusGraphGenericDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId,
UserData.class);
- titanGenericDao.createNode(userData, UserData.class);
- titanGenericDao.commit();
+ janusGraphGenericDao.createNode(userData, UserData.class);
+ janusGraphGenericDao.commit();
return userData;
}
@Test
public void testGetAllInterfaceLifecycleTypes_TypesNotFound() {
- when(titanGenericDao.getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(),
- InterfaceData.class)).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
+ when(janusGraphGenericDao.getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(),
+ InterfaceData.class)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes();
Assert.assertEquals(types.isRight(), Boolean.TRUE);
}
@@ -288,12 +288,13 @@
interfaceData.getInterfaceDataDefinition().setType(TYPE);
List<InterfaceData> interfaceDataList = new ArrayList<>();
interfaceDataList.add(interfaceData);
- Either<List<InterfaceData>, TitanOperationStatus> allInterfaceTypes = Either.left(interfaceDataList);
- when(titanGenericDao.getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(), InterfaceData.class)).thenReturn(allInterfaceTypes);
+ Either<List<InterfaceData>, JanusGraphOperationStatus> allInterfaceTypes = Either.left(interfaceDataList);
+ when(janusGraphGenericDao
+ .getByCriteria(NodeTypeEnum.Interface, Collections.emptyMap(), InterfaceData.class)).thenReturn(allInterfaceTypes);
List<ImmutablePair<OperationData, GraphEdge>> list = new ArrayList<>();
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus> childrenNodes = Either.left(list);
- when(titanGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(childrenNodes);
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = Either.left(list);
+ when(janusGraphGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(childrenNodes);
Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes();
Assert.assertEquals(types.left().value().size(),1);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
index ef1025f..f5197f0 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
@@ -26,8 +26,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-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 java.util.Iterator;
import java.util.List;
@@ -39,10 +39,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
+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.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -64,7 +64,7 @@
private PolicyTypeOperation policyTypeOperation;
@Autowired
- private HealingTitanGenericDao titanGenericDao;
+ private HealingJanusGraphGenericDao janusGraphGenericDao;
@BeforeClass
public static void setupBeforeClass() {
@@ -74,20 +74,20 @@
@Before
public void cleanUp() {
- TitanGenericDao titanGenericDao = policyTypeOperation.titanGenericDao;
- Either<TitanGraph, TitanOperationStatus> graphResult = titanGenericDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ JanusGraphGenericDao janusGraphGenericDao = policyTypeOperation.janusGraphGenericDao;
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanGenericDao.commit();
+ janusGraphGenericDao.commit();
}
@Test
@@ -310,17 +310,17 @@
}
private void verifyDerivedFromNodeEqualsToRootPolicyType(PolicyTypeDefinition rootPolicyType, String parentPolicyId) {
- Either<ImmutablePair<PolicyTypeData, GraphEdge>, TitanOperationStatus> derivedFromRelation = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.PolicyType, PolicyTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getPolicyTypeDataDefinition())
.isEqualToComparingFieldByField(rootPolicyType);
}
private void verifyDerivedFromRelationDoesntExist(String parentPolicyId) {
- Either<ImmutablePair<PolicyTypeData, GraphEdge>, TitanOperationStatus> derivedFromRelation = titanGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.PolicyType, PolicyTypeData.class);
assertThat(derivedFromRelation.right().value())
- .isEqualTo(TitanOperationStatus.NOT_FOUND);
+ .isEqualTo(JanusGraphOperationStatus.NOT_FOUND);
}
private PolicyTypeDefinition createRootPolicyTypeOnGraph() {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
index ae428bd..8535c3a 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
@@ -20,17 +20,17 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -51,13 +51,13 @@
public class PropertyOperationTest extends ModelTestBase {
- HealingTitanGenericDao titanGenericDao = Mockito.mock(HealingTitanGenericDao.class);
+ HealingJanusGraphGenericDao janusGraphGenericDao = Mockito.mock(HealingJanusGraphGenericDao.class);
- PropertyOperation propertyOperation = new PropertyOperation(titanGenericDao, null);
+ PropertyOperation propertyOperation = new PropertyOperation(janusGraphGenericDao, null);
@Before
public void setup() {
- propertyOperation.setTitanGenericDao(titanGenericDao);
+ propertyOperation.setJanusGraphGenericDao(janusGraphGenericDao);
}
@@ -68,10 +68,10 @@
*
* PropertyData propertyData = new PropertyData(property, propertyOperation.convertConstraintsToString(constraints));
*
- * Either<PropertyData, TitanOperationStatus> either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation =
- * new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation);
+ * Either<PropertyData, JanusGraphOperationStatus> either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation =
+ * new GraphRelation(); Either<GraphRelation, JanusGraphOperationStatus> relationResult = Either.left(graphRelation);
*
- * when(titanGenericDao.createNode((PropertyData)anyObject(), eq(PropertyData.class))).thenReturn(either); when(titanGenericDao.createRelation((GraphNode)anyObject(), (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY),
+ * when(janusGraphGenericDao.createNode((PropertyData)anyObject(), eq(PropertyData.class))).thenReturn(either); when(janusGraphGenericDao.createRelation((GraphNode)anyObject(), (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY),
* anyMap())).thenReturn(relationResult);
*
* Either<PropertyDefinition, StorageOperationStatus> result = propertyOperation.addPropertyToResource(propName, property, NodeTypeEnum.Resource, "my-resource.1.0");
@@ -512,7 +512,7 @@
}
private PropertyOperation createTestSubject() {
- return new PropertyOperation(new HealingTitanGenericDao(new TitanGraphClient()), null);
+ return new PropertyOperation(new HealingJanusGraphGenericDao(new JanusGraphClient()), null);
}
@@ -572,7 +572,7 @@
String propertyName = "";
PropertyDefinition propertyDefinition = new PropertyDefinition();
String resourceId = "";
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -583,11 +583,11 @@
@Test
public void testAddPropertyToGraphByVertex() throws Exception {
PropertyOperation testSubject;
- TitanVertex metadataVertex = null;
+ JanusGraphVertex metadataVertex = null;
String propertyName = "";
PropertyDefinition propertyDefinition = new PropertyDefinition();
String resourceId = "";
- TitanOperationStatus result;
+ JanusGraphOperationStatus result;
// default test
testSubject = createTestSubject();
@@ -596,20 +596,20 @@
@Test
- public void testGetTitanGenericDao() throws Exception {
+ public void testGetJanusGraphGenericDao() throws Exception {
PropertyOperation testSubject;
- TitanGenericDao result;
+ JanusGraphGenericDao result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanGenericDao();
+ result = testSubject.getJanusGraphGenericDao();
}
@Test
public void testDeletePropertyFromGraph() throws Exception {
PropertyOperation testSubject;
String propertyId = "";
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -636,7 +636,7 @@
PropertyOperation testSubject;
String propertyId = "";
PropertyDefinition propertyDefinition = null;
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -645,14 +645,14 @@
@Test
- public void testSetTitanGenericDao() {
+ public void testSetJanusGraphGenericDao() {
PropertyOperation testSubject;
- HealingTitanGenericDao titanGenericDao = null;
+ HealingJanusGraphGenericDao janusGraphGenericDao = null;
// default test
testSubject = createTestSubject();
- testSubject.setTitanGenericDao(titanGenericDao);
+ testSubject.setJanusGraphGenericDao(janusGraphGenericDao);
}
@@ -663,7 +663,7 @@
PropertyDefinition propertyDefinition = new PropertyDefinition();
NodeTypeEnum nodeType = NodeTypeEnum.Attribute;
String uniqueId = "";
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -676,7 +676,7 @@
PropertyOperation testSubject;
NodeTypeEnum nodeType = null;
String uniqueId = "";
- Either<Map<String, PropertyDefinition>, TitanOperationStatus> result;
+ Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -760,7 +760,7 @@
PropertyOperation testSubject;
String resourceInstanceId = "";
String propertyId = "";
- ImmutablePair<TitanOperationStatus, String> result;
+ ImmutablePair<JanusGraphOperationStatus, String> result;
// default test
testSubject = createTestSubject();
@@ -785,7 +785,7 @@
public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId() throws Exception {
PropertyOperation testSubject;
String resourceInstanceUid = "";
- Either<List<ComponentInstanceProperty>, TitanOperationStatus> result;
+ Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -798,7 +798,7 @@
PropertyOperation testSubject;
String propertyValueUid = "";
String resourceInstanceId = "";
- Either<PropertyValueData, TitanOperationStatus> result;
+ Either<PropertyValueData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -882,7 +882,7 @@
PropertyOperation testSubject;
String resourceInstanceUid = "";
NodeTypeEnum instanceNodeType = null;
- Either<List<ComponentInstanceProperty>, TitanOperationStatus> result;
+ Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -896,7 +896,7 @@
List<String> pathOfComponentInstances = null;
String propertyUniqueId = "";
String defaultValue = "";
- Either<String, TitanOperationStatus> result;
+ Either<String, JanusGraphOperationStatus> result;
// test 1
testSubject = createTestSubject();
@@ -927,7 +927,7 @@
public void testGetDataTypeByUid() throws Exception {
PropertyOperation testSubject;
String uniqueId = "";
- Either<DataTypeDefinition, TitanOperationStatus> result;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -988,7 +988,7 @@
public void testGetDataTypeByUidWithoutDerivedDataTypes() throws Exception {
PropertyOperation testSubject;
String uniqueId = "";
- Either<DataTypeDefinition, TitanOperationStatus> result;
+ Either<DataTypeDefinition, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -1000,7 +1000,7 @@
public void testIsDefinedInDataTypes() throws Exception {
PropertyOperation testSubject;
String propertyType = "";
- Either<Boolean, TitanOperationStatus> result;
+ Either<Boolean, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -1011,7 +1011,7 @@
@Test
public void testGetAllDataTypes() throws Exception {
PropertyOperation testSubject;
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result;
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -1023,7 +1023,7 @@
public void testCheckInnerType() throws Exception {
PropertyOperation testSubject;
PropertyDataDefinition propDataDef = new PropertyDataDefinition();
- Either<String, TitanOperationStatus> result;
+ Either<String, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -1034,7 +1034,7 @@
@Test
public void testGetAllDataTypeNodes() throws Exception {
PropertyOperation testSubject;
- Either<List<DataTypeData>, TitanOperationStatus> result;
+ Either<List<DataTypeData>, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -1083,7 +1083,7 @@
String uniqueId = "";
NodeTypeEnum elementType = null;
List<PropertyDefinition> properties = null;
- Either<Map<String, PropertyData>, TitanOperationStatus> result;
+ Either<Map<String, PropertyData>, JanusGraphOperationStatus> result;
// test 1
testSubject = createTestSubject();
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
index 3d60a65..30463e9 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
@@ -44,9 +44,8 @@
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
-import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -70,7 +69,7 @@
private static final String PROP = "prop";
@Mock
- HealingTitanGenericDao titanGenericDao;
+ HealingJanusGraphGenericDao janusGraphGenericDao;
@Mock
PropertyOperation propertyOperation;
@@ -101,16 +100,16 @@
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(TitanOperationStatus.OK).when(titanGenericDao).commit();
- Mockito.doReturn(TitanOperationStatus.OK).when(titanGenericDao).rollback();
+ Mockito.doReturn(JanusGraphOperationStatus.OK).when(janusGraphGenericDao).commit();
+ Mockito.doReturn(JanusGraphOperationStatus.OK).when(janusGraphGenericDao).rollback();
}
@Test
public void getRelationshipTypeByNameNotCreated() {
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_CREATED))
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CREATED))
.when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
- Either<RelationshipTypeDefinition, TitanOperationStatus> either =
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> either =
relationshipTypeOperation.getRelationshipTypeByName("name");
assertTrue(either.isRight());
}
@@ -122,7 +121,7 @@
@Test
public void testAddRelationshipTypeValidationFailStatusNullInTransactionFalse() {
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_CONNECTED))
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED))
.when(propertyOperation)
.getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
@@ -137,7 +136,7 @@
public void testAddRelationshipTypeValidationFailStatusPropertiesReturnedInTransactionFalse() {
Mockito.doReturn(Either.left(Collections.singletonMap("prop1", new PropertyDefinition()))).when(propertyOperation)
.getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_FOUND)).when(propertyOperation)
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(propertyOperation)
.validatePropertiesUniqueness(Mockito.any(), Mockito.any());
Either<RelationshipTypeDefinition, StorageOperationStatus> addRelationshipType =
@@ -148,20 +147,22 @@
@Test
public void testGetAllRelationshipTypesNotFound() {
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_FOUND)).when(titanGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(
+ janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
RelationshipTypeData.class);
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
assertTrue(either.isLeft() && MapUtils.isEmpty(either.left().value()));
}
@Test
public void testGetAllRelationshipTypesNotConnnected() {
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_CONNECTED)).when(titanGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED)).when(
+ janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
RelationshipTypeData.class);
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
- assertTrue(either.isRight() && TitanOperationStatus.NOT_CONNECTED == either.right().value());
+ assertTrue(either.isRight() && JanusGraphOperationStatus.NOT_CONNECTED == either.right().value());
}
@Test
@@ -177,10 +178,10 @@
relationshipTypeDataList.add(relationshipTypeData1);
Mockito.doReturn(Either.left(relationshipTypeDataList))
- .when(titanGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ .when(janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
RelationshipTypeData.class);
- Mockito.doReturn(Either.left(relationshipTypeData1)).when(titanGenericDao)
+ Mockito.doReturn(Either.left(relationshipTypeData1)).when(janusGraphGenericDao)
.getNode(Mockito.anyString(), Mockito.anyString(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(createPropertyData("prop1"))).when(propertyOperation)
@@ -194,7 +195,7 @@
.when(derivedFromOperation)
.getDerivedFromChild("tosca.relationships.Root1", NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
- Either<Map<String, RelationshipTypeDefinition>, TitanOperationStatus> either =
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either =
relationshipTypeOperation.getAllRelationshipTypes();
assertTrue(either.isLeft());
@@ -352,7 +353,7 @@
Mockito.doReturn(Either.left(new ArrayList<>(relationshipTypeDefinition.getProperties().values()))).when(propertyOperation)
.validatePropertiesUniqueness(Mockito.any(), Mockito.any());
- Mockito.doReturn(Either.left(relationshipTypeData)).when(titanGenericDao)
+ Mockito.doReturn(Either.left(relationshipTypeData)).when(janusGraphGenericDao)
.createNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(new HashMap())).when(propertyOperation)
@@ -376,7 +377,7 @@
@Test
public void testGetRelationshipTypeNotConnected() {
- Mockito.doReturn(Either.right(TitanOperationStatus.NOT_CONNECTED))
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED))
.when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
@@ -405,7 +406,8 @@
newRelationshipTypeDefinition.setDerivedFrom("tosca.relationships.Root");
newRelationshipTypeDefinition.setProperties(createPropertyData("prop1"));
- Mockito.doReturn(Either.left(new RelationshipTypeData(newRelationshipTypeDefinition))).when(titanGenericDao)
+ Mockito.doReturn(Either.left(new RelationshipTypeData(newRelationshipTypeDefinition))).when(
+ janusGraphGenericDao)
.updateNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(newRelationshipTypeDefinition.getProperties()))
@@ -435,7 +437,7 @@
public void testGetRelationshipTypeByUid() {
RelationshipTypeData relationshipTypeData = new RelationshipTypeData(relationshipTypeDefinition);
- Mockito.doReturn(Either.left(relationshipTypeData)).when(titanGenericDao)
+ Mockito.doReturn(Either.left(relationshipTypeData)).when(janusGraphGenericDao)
.getNode(Mockito.anyString(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(relationshipTypeDefinition.getProperties()))
@@ -444,11 +446,12 @@
RelationshipTypeDefinition childRelationshipTypeDefinition = new RelationshipTypeDefinition();
childRelationshipTypeDefinition.setType("tosca.relationships.ContainerChild");
- Mockito.doReturn(Either.left(new ImmutablePair(new RelationshipTypeData(childRelationshipTypeDefinition), null))).when(titanGenericDao)
+ Mockito.doReturn(Either.left(new ImmutablePair(new RelationshipTypeData(childRelationshipTypeDefinition), null))).when(
+ janusGraphGenericDao)
.getChild(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(),
Mockito.eq(RelationshipTypeData.class));
- Either<RelationshipTypeDefinition, TitanOperationStatus> either =
+ Either<RelationshipTypeDefinition, JanusGraphOperationStatus> either =
relationshipTypeOperation.getRelationshipTypeByUid("tosca.relationships.Container1");
assertTrue(either.isLeft()
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
index c70e41b..aef1642 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
@@ -20,18 +20,18 @@
package org.openecomp.sdc.be.model.operations.impl;
-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 org.junit.*;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
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.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
@@ -47,13 +47,13 @@
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.test.context.ContextConfiguration;
@@ -70,7 +70,7 @@
public class ToscaElementLifecycleOperationTest extends ModelTestBase {
@javax.annotation.Resource
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@javax.annotation.Resource
private NodeTypeOperation nodeTypeOperation;
@@ -105,7 +105,7 @@
createUsers();
createResourceCategory();
createServiceCategory();
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
rootVertex = createRootNodeType();
createNodeType("firstVf");
serviceVertex = createTopologyTemplate("firstService");
@@ -263,7 +263,7 @@
assertTrue(res.isLeft());
id = res.left().value().getUniqueId();
verifyInCatalogData(4, null);
- // exportGraphMl(titanDao.getGraph().left().value());
+ // exportGraphMl(janusGraphDao.getGraph().left().value());
}
@@ -322,7 +322,7 @@
public void testGetToscaElOwner_Fail(){
Either<User, StorageOperationStatus> result;
String toscaEleId = "toscaElementId";
- titanDao.getVertexById(toscaEleId, JsonParseFlagEnum.NoParse);
+ janusGraphDao.getVertexById(toscaEleId, JsonParseFlagEnum.NoParse);
result = lifecycleOperation.getToscaElementOwner(toscaEleId);
assertEquals(StorageOperationStatus.NOT_FOUND, result.right().value());
}
@@ -351,12 +351,14 @@
subCat.setMetadataProperties(metadataProperties);
subCat.updateMetadataJsonWithCurrentMetadataProperties();
- Either<GraphVertex, TitanOperationStatus> catRes = titanDao.createVertex(cat);
+ Either<GraphVertex, JanusGraphOperationStatus> catRes = janusGraphDao.createVertex(cat);
- Either<GraphVertex, TitanOperationStatus> subCatRes = titanDao.createVertex(subCat);
+ Either<GraphVertex, JanusGraphOperationStatus> subCatRes = janusGraphDao.createVertex(subCat);
- TitanOperationStatus status = titanDao.createEdge(catRes.left().value().getVertex(), subCatRes.left().value().getVertex(), EdgeLabelEnum.SUB_CATEGORY, new HashMap<>());
- assertEquals(TitanOperationStatus.OK, status);
+ JanusGraphOperationStatus
+ status = janusGraphDao
+ .createEdge(catRes.left().value().getVertex(), subCatRes.left().value().getVertex(), EdgeLabelEnum.SUB_CATEGORY, new HashMap<>());
+ assertEquals(JanusGraphOperationStatus.OK, status);
}
private void createServiceCategory() {
@@ -372,7 +374,7 @@
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
- Either<GraphVertex, TitanOperationStatus> catRes = titanDao.createVertex(cat);
+ Either<GraphVertex, JanusGraphOperationStatus> catRes = janusGraphDao.createVertex(cat);
assertTrue(catRes.isLeft());
}
@@ -398,7 +400,8 @@
Either<TopologyTemplate, StorageOperationStatus> createRes = topologyTemplateOperation.createTopologyTemplate(service);
assertTrue(createRes.isLeft());
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes = titanDao.getVertexById(createRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes = janusGraphDao
+ .getVertexById(createRes.left().value().getUniqueId());
assertTrue(getNodeTyeRes.isLeft());
// serviceVertex = getNodeTyeRes.left().value();
@@ -436,7 +439,8 @@
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
assertTrue(createVFRes.isLeft());
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes = titanDao.getVertexById(createVFRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes = janusGraphDao
+ .getVertexById(createVFRes.left().value().getUniqueId());
assertTrue(getNodeTyeRes.isLeft());
vfVertex = getNodeTyeRes.left().value();
@@ -482,7 +486,7 @@
Either<GraphVertex, StorageOperationStatus> res = nodeTypeOperation.associateElementToData(vfVertex, VertexTypeEnum.CAPABILITIES_PROPERTIES, EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
- // exportGraphMl(titanDao.getGraph().left().value());
+ // exportGraphMl(janusGraphDao.getGraph().left().value());
List<String> pathKeys = new ArrayList<>();
pathKeys.add("capName");
@@ -542,7 +546,8 @@
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
assertTrue(createVFRes.isLeft());
- Either<GraphVertex, TitanOperationStatus> getNodeTyeRes = titanDao.getVertexById(createVFRes.left().value().getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes = janusGraphDao
+ .getVertexById(createVFRes.left().value().getUniqueId());
assertTrue(getNodeTyeRes.isLeft());
return getNodeTyeRes.left().value();
}
@@ -559,7 +564,7 @@
ownerV.setMetadataProperties(metadataProperties);
ownerV.updateMetadataJsonWithCurrentMetadataProperties();
ownerV.setJson(new HashMap<>());
- Either<GraphVertex, TitanOperationStatus> createUserRes = titanDao.createVertex(ownerV);
+ Either<GraphVertex, JanusGraphOperationStatus> createUserRes = janusGraphDao.createVertex(ownerV);
assertTrue(createUserRes.isLeft());
ownerVertex = createUserRes.left().value();
@@ -574,12 +579,12 @@
modifierV.setMetadataProperties(metadataProperties);
modifierV.updateMetadataJsonWithCurrentMetadataProperties();
modifierV.setJson(new HashMap<>());
- createUserRes = titanDao.createVertex(modifierV);
+ createUserRes = janusGraphDao.createVertex(modifierV);
assertTrue(createUserRes.isLeft());
modifierVertex = createUserRes.left().value();
- Either<GraphVertex, TitanOperationStatus> getOwnerRes = lifecycleOperation.findUser(ownerVertex.getUniqueId());
+ Either<GraphVertex, JanusGraphOperationStatus> getOwnerRes = lifecycleOperation.findUser(ownerVertex.getUniqueId());
assertTrue(getOwnerRes.isLeft());
}
@@ -602,17 +607,17 @@
}
private void clearGraph() {
- Either<TitanGraph, TitanOperationStatus> graphResult = titanDao.getGraph();
- TitanGraph graph = graphResult.left().value();
+ Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphDao.getGraph();
+ JanusGraph graph = graphResult.left().value();
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
- TitanVertex vertex = iterator.next();
+ JanusGraphVertex vertex = iterator.next();
vertex.remove();
}
}
- titanDao.commit();
+ janusGraphDao.commit();
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperationTest.java
index 5226a46..c094999 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperationTest.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.be.model.operations.impl;
-import com.thinkaurelius.titan.core.*;
-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.*;
+import org.janusgraph.graphdb.relations.StandardVertexProperty;
+import org.janusgraph.graphdb.types.system.EmptyVertex;
+import org.janusgraph.graphdb.types.system.ImplicitKey;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.*;
import org.junit.Before;
@@ -34,9 +34,9 @@
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
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.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
@@ -59,9 +59,10 @@
import static org.mockito.Mockito.*;
public class UserAdminOperationTest extends ModelTestBase {
- private static final TitanGenericDao titanGenericDao = mock(TitanGenericDao.class);
+ private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class);
@InjectMocks
- private static final UserAdminOperation userAdminOperation = new UserAdminOperation(titanGenericDao);
+ private static final UserAdminOperation userAdminOperation = new UserAdminOperation(
+ JANUS_GRAPH_GENERIC_DAO);
private static final String ADMIN = "admin";
@BeforeClass
@@ -72,20 +73,20 @@
@Before
public void initMocks() {
MockitoAnnotations.initMocks(this);
- Mockito.reset(titanGenericDao);
- mockTitanUpdate();
- mockTitanDelete();
+ Mockito.reset(JANUS_GRAPH_GENERIC_DAO);
+ mockJanusGraphUpdate();
+ mockJanusGraphDelete();
}
@Test
public void testDeActivateUserDataSuccess() {
- UserData userData = mockTitanGet(ADMIN, UserRoleEnum.ADMIN, true);
+ UserData userData = mockJanusGraphGet(ADMIN, UserRoleEnum.ADMIN, true);
Either<User, StorageOperationStatus> eitherUser = userAdminOperation.deActivateUser(userAdminOperation.convertToUser(userData));
- verify(titanGenericDao, times(1)).updateNode(eq(userData), eq(UserData.class));
- verify(titanGenericDao, times(0)).deleteNode(any(UserData.class), eq(UserData.class));
+ verify(JANUS_GRAPH_GENERIC_DAO, times(1)).updateNode(eq(userData), eq(UserData.class));
+ verify(JANUS_GRAPH_GENERIC_DAO, times(0)).deleteNode(any(UserData.class), eq(UserData.class));
assertTrue(eitherUser.isLeft());
User user = eitherUser.left().value();
assertSame(user.getStatus(), UserStatusEnum.INACTIVE);
@@ -93,33 +94,33 @@
@Test
public void testDeleteUserWithoutResources() {
- UserData userData = mockTitanGet(ADMIN, UserRoleEnum.ADMIN, true);
+ UserData userData = mockJanusGraphGet(ADMIN, UserRoleEnum.ADMIN, true);
List<Edge> edgesList = new ArrayList<>();
- Either<List<Edge>, TitanOperationStatus> eitherResult = Either.left(edgesList);
- when(titanGenericDao.getEdgesForNode(userData, Direction.BOTH)).thenReturn(eitherResult);
+ Either<List<Edge>, JanusGraphOperationStatus> eitherResult = Either.left(edgesList);
+ when(JANUS_GRAPH_GENERIC_DAO.getEdgesForNode(userData, Direction.BOTH)).thenReturn(eitherResult);
Either<User, ActionStatus> eitherUser = userAdminOperation.deleteUserData(ADMIN);
- verify(titanGenericDao, times(0)).updateNode(any(UserData.class), eq(UserData.class));
- verify(titanGenericDao, times(1)).deleteNode(userData, UserData.class);
+ verify(JANUS_GRAPH_GENERIC_DAO, times(0)).updateNode(any(UserData.class), eq(UserData.class));
+ verify(JANUS_GRAPH_GENERIC_DAO, times(1)).deleteNode(userData, UserData.class);
assertTrue(eitherUser.isLeft());
}
@Test
public void testDeleteUserWithResources() {
- UserData userData = mockTitanGet(ADMIN, UserRoleEnum.ADMIN, true);
+ UserData userData = mockJanusGraphGet(ADMIN, UserRoleEnum.ADMIN, true);
List<Edge> edgesList = new ArrayList<>();
edgesList.add(getEmptyEdgeImpl());
- Either<List<Edge>, TitanOperationStatus> eitherResult = Either.left(edgesList);
- when(titanGenericDao.getEdgesForNode(userData, Direction.BOTH)).thenReturn(eitherResult);
+ Either<List<Edge>, JanusGraphOperationStatus> eitherResult = Either.left(edgesList);
+ when(JANUS_GRAPH_GENERIC_DAO.getEdgesForNode(userData, Direction.BOTH)).thenReturn(eitherResult);
Either<User, ActionStatus> eitherUser = userAdminOperation.deleteUserData(ADMIN);
- verify(titanGenericDao, times(0)).updateNode(any(UserData.class), eq(UserData.class));
- verify(titanGenericDao, times(0)).deleteNode(any(UserData.class), eq(UserData.class));
+ verify(JANUS_GRAPH_GENERIC_DAO, times(0)).updateNode(any(UserData.class), eq(UserData.class));
+ verify(JANUS_GRAPH_GENERIC_DAO, times(0)).deleteNode(any(UserData.class), eq(UserData.class));
assertTrue(eitherUser.isRight());
assertSame(eitherUser.right().value(), ActionStatus.USER_HAS_ACTIVE_ELEMENTS);
@@ -131,7 +132,7 @@
String userKey = UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User);
User user = new User();
user.setUserId(userId);
- TitanVertex userVertex = null;
+ JanusGraphVertex userVertex = null;
TestVertex component1 = new TestVertex(null);
TestVertex component2 = new TestVertex(true);
TestVertex component3 = new TestVertex(false);
@@ -142,8 +143,8 @@
edges.add(edge1);
edges.add(edge2);
edges.add(edge3);
- when(titanGenericDao.getVertexByProperty(userKey, userId)).thenReturn(Either.left(userVertex));
- when(titanGenericDao.getOutgoingEdgesByCriteria(any(), any(), any())).thenReturn(Either.left(edges));
+ when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(userKey, userId)).thenReturn(Either.left(userVertex));
+ when(JANUS_GRAPH_GENERIC_DAO.getOutgoingEdgesByCriteria(any(), any(), any())).thenReturn(Either.left(edges));
Either<List<Edge>, StorageOperationStatus> result = userAdminOperation.getUserPendingTasksList(user, new HashMap<>());
assertThat(result.isLeft()).isTrue();
List<Edge> pendingTasks = result.left().value();
@@ -152,7 +153,7 @@
assertThat(((TestEdge)pendingTasks.get(1)).getName()).isNotEqualTo("2");
}
- private class TestVertex implements TitanVertex {
+ private class TestVertex implements JanusGraphVertex {
private final Boolean isDeleted;
@@ -161,12 +162,12 @@
}
@Override
- public TitanEdge addEdge(String s, Vertex vertex, Object... objects) {
+ public JanusGraphEdge addEdge(String s, Vertex vertex, Object... objects) {
return null;
}
@Override
- public <V> TitanVertexProperty<V> property(String s, V v, Object... objects) {
+ public <V> JanusGraphVertexProperty<V> property(String s, V v, Object... objects) {
return null;
}
@@ -181,7 +182,7 @@
}
@Override
- public <V> TitanVertexProperty<V> property(VertexProperty.Cardinality cardinality, String s, V v, Object... objects) {
+ public <V> JanusGraphVertexProperty<V> property(VertexProperty.Cardinality cardinality, String s, V v, Object... objects) {
return null;
}
@@ -221,7 +222,7 @@
}
@Override
- public TitanVertexQuery<? extends TitanVertexQuery> query() {
+ public JanusGraphVertexQuery<? extends JanusGraphVertexQuery> query() {
return null;
}
@@ -231,7 +232,7 @@
}
@Override
- public TitanTransaction graph() {
+ public JanusGraphTransaction graph() {
return null;
}
@@ -369,27 +370,28 @@
};
}
- private UserData mockTitanGet(String userId, UserRoleEnum role, boolean isActive) {
+ private UserData mockJanusGraphGet(String userId, UserRoleEnum role, boolean isActive) {
UserData userData = buildUserData(userId, role, isActive);
- Either<UserData, TitanOperationStatus> eitherUserData = Either.left(userData);
- when(titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class)).thenReturn(eitherUserData);
+ Either<UserData, JanusGraphOperationStatus> eitherUserData = Either.left(userData);
+ when(JANUS_GRAPH_GENERIC_DAO
+ .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class)).thenReturn(eitherUserData);
return userData;
}
- private static void mockTitanUpdate() {
- doAnswer((Answer<Either<UserData, TitanOperationStatus>>) invocation -> {
+ private static void mockJanusGraphUpdate() {
+ doAnswer((Answer<Either<UserData, JanusGraphOperationStatus>>) invocation -> {
Object[] args = invocation.getArguments();
UserData retValue = (UserData) args[0];
return Either.left(retValue);
- }).when(titanGenericDao).updateNode(any(UserData.class), eq(UserData.class));
+ }).when(JANUS_GRAPH_GENERIC_DAO).updateNode(any(UserData.class), eq(UserData.class));
}
- private static void mockTitanDelete() {
- doAnswer((Answer<Either<UserData, TitanOperationStatus>>) invocation -> {
+ private static void mockJanusGraphDelete() {
+ doAnswer((Answer<Either<UserData, JanusGraphOperationStatus>>) invocation -> {
Object[] args = invocation.getArguments();
UserData retValue = (UserData) args[0];
return Either.left(retValue);
- }).when(titanGenericDao).deleteNode(any(UserData.class), eq(UserData.class));
+ }).when(JANUS_GRAPH_GENERIC_DAO).deleteNode(any(UserData.class), eq(UserData.class));
}
private static UserData buildUserData(String userId, UserRoleEnum role, boolean isActive) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
index a0b6ea6..71dc5d9 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
@@ -21,9 +21,9 @@
package org.openecomp.sdc.be.model.operations.impl.util;
import fj.data.Either;
+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.titan.TitanGenericDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -36,20 +36,20 @@
public class OperationTestsUtil {
- public static String deleteAndCreateServiceCategory(String category, TitanGenericDao titanDao) {
+ public static String deleteAndCreateServiceCategory(String category, JanusGraphGenericDao janusGraphDao) {
CategoryData categoryData = new CategoryData(NodeTypeEnum.ServiceNewCategory);
categoryData.getCategoryDataDefinition().setName(category);
categoryData.getCategoryDataDefinition()
.setNormalizedName(ValidationUtils.normalizeCategoryName4Uniqueness(category));
categoryData.getCategoryDataDefinition().setUniqueId(UniqueIdBuilder.buildCategoryUid(
ValidationUtils.normalizeCategoryName4Uniqueness(category), NodeTypeEnum.ServiceNewCategory));
- titanDao.deleteNode(categoryData, CategoryData.class);
- Either<CategoryData, TitanOperationStatus> createNode = titanDao.createNode(categoryData, CategoryData.class);
+ janusGraphDao.deleteNode(categoryData, CategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> createNode = janusGraphDao.createNode(categoryData, CategoryData.class);
return (String) createNode.left().value().getUniqueId();
}
public static String deleteAndCreateResourceCategory(String category, String subcategory,
- TitanGenericDao titanDao) {
+ JanusGraphGenericDao janusGraphDao) {
CategoryData categoryData = new CategoryData(NodeTypeEnum.ResourceNewCategory);
categoryData.getCategoryDataDefinition().setName(category);
@@ -64,22 +64,22 @@
.setNormalizedName(ValidationUtils.normalizeCategoryName4Uniqueness(subcategory));
subcategoryData.getSubCategoryDataDefinition().setUniqueId(UniqueIdBuilder
.buildSubCategoryUid(categoryData.getCategoryDataDefinition().getUniqueId(), subcategory));
- titanDao.deleteNode(categoryData, CategoryData.class);
- titanDao.deleteNode(subcategoryData, SubCategoryData.class);
- Either<CategoryData, TitanOperationStatus> createNode = titanDao.createNode(categoryData, CategoryData.class);
- titanDao.createNode(subcategoryData, SubCategoryData.class);
- titanDao.createRelation(categoryData, subcategoryData, GraphEdgeLabels.SUB_CATEGORY, null);
+ janusGraphDao.deleteNode(categoryData, CategoryData.class);
+ janusGraphDao.deleteNode(subcategoryData, SubCategoryData.class);
+ Either<CategoryData, JanusGraphOperationStatus> createNode = janusGraphDao.createNode(categoryData, CategoryData.class);
+ janusGraphDao.createNode(subcategoryData, SubCategoryData.class);
+ janusGraphDao.createRelation(categoryData, subcategoryData, GraphEdgeLabels.SUB_CATEGORY, null);
return (String) createNode.left().value().getUniqueId();
}
- public static void deleteServiceCategory(String category, TitanGenericDao titanDao) {
+ public static void deleteServiceCategory(String category, JanusGraphGenericDao janusGraphDao) {
ServiceCategoryData categoryData = new ServiceCategoryData(category);
- titanDao.deleteNode(categoryData, ServiceCategoryData.class);
+ janusGraphDao.deleteNode(categoryData, ServiceCategoryData.class);
}
- public static void deleteResourceCategory(String category, String subcategory, TitanGenericDao titanDao) {
+ public static void deleteResourceCategory(String category, String subcategory, JanusGraphGenericDao janusGraphDao) {
ResourceCategoryData categoryData = new ResourceCategoryData(category, subcategory);
- titanDao.deleteNode(categoryData, ResourceCategoryData.class);
+ janusGraphDao.deleteNode(categoryData, ResourceCategoryData.class);
}
public static User convertUserDataToUser(UserData modifierData) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
index 7ba2e09..6bd2067 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.be.model.operations.impl.util;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
@@ -40,12 +40,12 @@
public class PrintGraph {
- public void printGraphVertices(TitanGraph graph) {
+ public void printGraphVertices(JanusGraph graph) {
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
}
@@ -55,11 +55,11 @@
graph.tx().commit();
}
- public void printGraphEdges(TitanGraph graph) {
- Iterable<TitanEdge> vertices = graph.query().edges();
+ public void printGraphEdges(JanusGraph graph) {
+ Iterable<JanusGraphEdge> vertices = graph.query().edges();
if (vertices != null) {
- Iterator<TitanEdge> iterator = vertices.iterator();
+ Iterator<JanusGraphEdge> iterator = vertices.iterator();
while (iterator.hasNext()) {
Edge edge = iterator.next();
@@ -69,16 +69,16 @@
graph.tx().commit();
}
- public String buildGraphForWebgraphWiz(TitanGraph graph) {
+ public String buildGraphForWebgraphWiz(JanusGraph graph) {
StringBuilder builder = new StringBuilder();
builder.append("digraph finite_state_machine {\n");
builder.append("rankdir=LR;\n");
builder.append("size=\"15,10\" \n");
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
@@ -98,10 +98,10 @@
}
- Iterable<TitanEdge> edges = graph.query().edges();
+ Iterable<JanusGraphEdge> edges = graph.query().edges();
if (edges != null) {
- Iterator<TitanEdge> iterator = edges.iterator();
+ Iterator<JanusGraphEdge> iterator = edges.iterator();
while (iterator.hasNext()) {
Edge edge = iterator.next();
@@ -309,12 +309,12 @@
return key;
}
- public int getNumberOfVertices(TitanGraph graph) {
+ public int getNumberOfVertices(JanusGraph graph) {
int counter = 0;
- Iterable<TitanVertex> vertices = graph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = graph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
counter++;
@@ -323,14 +323,14 @@
return counter;
}
- public Set<String> getVerticesSet(TitanGraph titanGraph) {
+ public Set<String> getVerticesSet(JanusGraph janusGraph) {
Set<String> set = new HashSet<>();
- Iterable<TitanVertex> vertices = titanGraph.query().vertices();
+ Iterable<JanusGraphVertex> vertices = janusGraph.query().vertices();
if (vertices != null) {
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
diff --git a/catalog-model/src/test/resources/application-context-test.xml b/catalog-model/src/test/resources/application-context-test.xml
index a39a1ee..475760f 100644
--- a/catalog-model/src/test/resources/application-context-test.xml
+++ b/catalog-model/src/test/resources/application-context-test.xml
@@ -7,12 +7,12 @@
<context:component-scan
base-package="org.openecomp.sdc.be.model.operations.impl,
- org.openecomp.sdc.be.model.jsontitan.operations,
+ org.openecomp.sdc.be.model.jsonjanusgraph.operations,
org.openecomp.sdc.be.dao.jsongraph,
org.openecomp.sdc.be.model.cache,
- org.openecomp.sdc.be.dao.titan,
+ org.openecomp.sdc.be.dao.janusgraph,
org.openecomp.sdc.be.dao.cassandra,
- org.openecomp.sdc.be.model.jsontitan.utils
+ org.openecomp.sdc.be.model.jsonjanusgraph.utils
">
diff --git a/catalog-model/src/test/resources/config/catalog-model/configuration.yaml b/catalog-model/src/test/resources/config/catalog-model/configuration.yaml
index 0dbd739..96fb28b 100644
--- a/catalog-model/src/test/resources/config/catalog-model/configuration.yaml
+++ b/catalog-model/src/test/resources/config/catalog-model/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 janus graph 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
diff --git a/catalog-model/src/test/resources/config/configuration.yaml b/catalog-model/src/test/resources/config/configuration.yaml
index c95715d..3dc326e 100644
--- a/catalog-model/src/test/resources/config/configuration.yaml
+++ b/catalog-model/src/test/resources/config/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 janus graph 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
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
index 3cb7974..bf6a022 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
@@ -71,8 +71,8 @@
processEcompError(context, EcompErrorEnum.BeHealthCheckRecovery);
}
- public void logBeHealthCheckTitanRecovery(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckTitanRecovery);
+ public void logBeHealthCheckJanusGraphRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphRecovery);
}
public void logBeHealthCheckElasticSearchRecovery(String context) {
@@ -99,8 +99,8 @@
processEcompError(context, EcompErrorEnum.BeHealthCheckError);
}
- public void logBeHealthCheckTitanError(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckTitanError);
+ public void logBeHealthCheckJanusGraphError(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphError);
}
public void logBeHealthCheckElasticSearchError(String context) {
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index a9c4ed3..05e705c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -69,14 +69,14 @@
private Map<String, String> users;
private Map<String, Object> neo4j;
private ElasticSearchConfig elasticSearch;
- private String titanCfgFile;
- private String titanMigrationKeySpaceCfgFile;
- private Boolean titanInMemoryGraph;
+ private String janusGraphCfgFile;
+ private String janusGraphMigrationKeySpaceCfgFile;
+ private Boolean janusGraphInMemoryGraph;
private int startMigrationFrom;
- private Long titanLockTimeout;
- private Long titanReconnectIntervalInSeconds;
+ private Long janusGraphLockTimeout;
+ private Long janusGraphReconnectIntervalInSeconds;
private List<String> healthStatusExclude;
- private Long titanHealthCheckReadTimeout;
+ private Long janusGraphHealthCheckReadTimeout;
private Long esReconnectIntervalInSeconds;
private Long uebHealthCheckReconnectIntervalInSeconds;
private Long uebHealthCheckReadTimeout;
@@ -374,28 +374,28 @@
this.elasticSearch = elasticSearch;
}
- public String getTitanCfgFile() {
- return titanCfgFile;
+ public String getJanusGraphCfgFile() {
+ return janusGraphCfgFile;
}
- public void setTitanCfgFile(String titanCfgFile) {
- this.titanCfgFile = titanCfgFile;
+ public void setJanusGraphCfgFile(String janusGraphCfgFile) {
+ this.janusGraphCfgFile = janusGraphCfgFile;
}
- public String getTitanMigrationKeySpaceCfgFile() {
- return titanMigrationKeySpaceCfgFile;
+ public String getJanusGraphMigrationKeySpaceCfgFile() {
+ return janusGraphMigrationKeySpaceCfgFile;
}
- public void setTitanMigrationKeySpaceCfgFile(String titanMigrationKeySpaceCfgFile) {
- this.titanMigrationKeySpaceCfgFile = titanMigrationKeySpaceCfgFile;
+ public void setJanusGraphMigrationKeySpaceCfgFile(String janusGraphMigrationKeySpaceCfgFile) {
+ this.janusGraphMigrationKeySpaceCfgFile = janusGraphMigrationKeySpaceCfgFile;
}
- public Boolean getTitanInMemoryGraph() {
- return titanInMemoryGraph;
+ public Boolean getJanusGraphInMemoryGraph() {
+ return janusGraphInMemoryGraph;
}
- public void setTitanInMemoryGraph(Boolean titanInMemoryGraph) {
- this.titanInMemoryGraph = titanInMemoryGraph;
+ public void setJanusGraphInMemoryGraph(Boolean janusGraphInMemoryGraph) {
+ this.janusGraphInMemoryGraph = janusGraphInMemoryGraph;
}
public int getStartMigrationFrom() {
@@ -406,36 +406,36 @@
this.startMigrationFrom = startMigrationFrom;
}
- public Long getTitanLockTimeout() {
- return titanLockTimeout;
+ public Long getJanusGraphLockTimeout() {
+ return janusGraphLockTimeout;
}
- public void setTitanLockTimeout(Long titanLockTimeout) {
- this.titanLockTimeout = titanLockTimeout;
+ public void setJanusGraphLockTimeout(Long janusGraphLockTimeout) {
+ this.janusGraphLockTimeout = janusGraphLockTimeout;
}
- public Long getTitanHealthCheckReadTimeout() {
- return titanHealthCheckReadTimeout;
+ public Long getJanusGraphHealthCheckReadTimeout() {
+ return janusGraphHealthCheckReadTimeout;
}
- public Long getTitanHealthCheckReadTimeout(long defaultVal) {
- return titanHealthCheckReadTimeout == null ? defaultVal : titanHealthCheckReadTimeout;
+ public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) {
+ return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout;
}
- public void setTitanHealthCheckReadTimeout(Long titanHealthCheckReadTimeout) {
- this.titanHealthCheckReadTimeout = titanHealthCheckReadTimeout;
+ public void setJanusGraphHealthCheckReadTimeout(Long janusGraphHealthCheckReadTimeout) {
+ this.janusGraphHealthCheckReadTimeout = janusGraphHealthCheckReadTimeout;
}
- public Long getTitanReconnectIntervalInSeconds() {
- return titanReconnectIntervalInSeconds;
+ public Long getJanusGraphReconnectIntervalInSeconds() {
+ return janusGraphReconnectIntervalInSeconds;
}
- public Long getTitanReconnectIntervalInSeconds(long defaultVal) {
- return titanReconnectIntervalInSeconds == null ? defaultVal : titanReconnectIntervalInSeconds;
+ public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) {
+ return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds;
}
- public void setTitanReconnectIntervalInSeconds(Long titanReconnectIntervalInSeconds) {
- this.titanReconnectIntervalInSeconds = titanReconnectIntervalInSeconds;
+ public void setJanusGraphReconnectIntervalInSeconds(Long janusGraphReconnectIntervalInSeconds) {
+ this.janusGraphReconnectIntervalInSeconds = janusGraphReconnectIntervalInSeconds;
}
public Long getEsReconnectIntervalInSeconds() {
@@ -1365,10 +1365,11 @@
.append(format("Released: %s%n", released)).append(format("Supported protocols: %s%n", protocols))
.append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j))
.append(format("ElasticSearch: %s%n", elasticSearch))
- .append(format("Titan Cfg File: %s%n", titanCfgFile))
- .append(format("Titan In memory: %s%n", titanInMemoryGraph))
- .append(format("Titan lock timeout: %s%n", titanLockTimeout))
- .append(format("Titan reconnect interval seconds: %s%n", titanReconnectIntervalInSeconds))
+ .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile))
+ .append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
+ .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
+ .append(format("JanusGraph reconnect interval seconds: %s%n",
+ janusGraphReconnectIntervalInSeconds))
.append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
.append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
.append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
index b106472..646c655 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
@@ -133,7 +133,7 @@
//SDC HealthCheck components
public static final String HC_COMPONENT_FE = "FE";
public static final String HC_COMPONENT_BE = "BE";
- public static final String HC_COMPONENT_TITAN = "TITAN";
+ public static final String HC_COMPONENT_JANUSGRAPH = "JANUSGRAPH";
public static final String HC_COMPONENT_ES = "ES";
public static final String HC_COMPONENT_CASSANDRA = "CASSANDRA";
public static final String HC_COMPONENT_DISTRIBUTION_ENGINE = "DE";
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
index c887c09..4d2fb00 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
@@ -94,7 +94,7 @@
}
/*public enum HealthCheckComponent {
- FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, DCAE,
+ FE, BE, JANUSGRAPH, DE, ON_BOARDING, CASSANDRA, DCAE,
CAS, ZU;//Amdocs components
}*/
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
index aabd6d9..a423354 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
@@ -26,16 +26,16 @@
"An Authentication failure occured during access to UEB server. Please check that UEB keys are configured correctly in ASDC BE distribution configuration."), E_199(
"Internal authentication problem. Description: %s"),
- E_200("ASDC Backend probably lost connectivity to either one of the following components: Titan DB, Cassandra, Onboarding, UEB Cluster. Please check the logs for more information."), E_201(
- "ASDC Backend probably lost connectivity to Titan DB. Please check the logs for more information."), E_202(
+ E_200("ASDC Backend probably lost connectivity to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster. Please check the logs for more information."), E_201(
+ "ASDC Backend probably lost connectivity to JanusGraph DB. Please check the logs for more information."), E_202(
"ASDC Backend probably lost connectivity to ElasticSearch. Please check the logs for more information."), E_203(
"ASDC Backend probably lost connectivity to UEB Cluster. Please check the logs for more information.",
"Check connectivity to UEB cluster which is configured under parameter uebServers in distribution-configuration.yaml."), E_204(
"Unable to connect to a valid ASDC Backend Server",
"Please check connectivity from this FE instance towards BE or BE Load Balancer. Please check that parameters in FE configuration.yaml: beHost, beHttpPort and beSslPort point to a valid host and port values."),
- E_205("ASDC Backend Recovery to either one of the following components: Titan DB, Cassandra, Onboarding, UEB Cluster."), E_206(
- "ASDC Backend connection recovery to Titan DB."), E_207(
+ E_205("ASDC Backend Recovery to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster."), E_206(
+ "ASDC Backend connection recovery to JanusGraph DB."), E_207(
"ASDC Backend connection recovery to ElasticSearch."), E_208(
"ASDC Backend connection recovery to UEB Cluster."), E_209(
"Connectivity to ASDC BE Server is recovered."), E_210(
@@ -82,7 +82,7 @@
"System Error occured in ASDC Distribution Engine. Please check ASDC logs for more details."), E_504(
"Failed adding node of type %s to graph."), E_505(
"Operation towards database failed.",
- "Please check Titan DB health or look at the logs for more details."), E_506(
+ "Please check JanusGraph DB health or look at the logs for more details."), E_506(
"Unexpected error during operation"), E_507(
"Going to execute rollback on graph."), E_508(
"Failed to lock object for update. Type = %s, Id = %s"), E_509(
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
index 575cbe9..9d53f7b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
@@ -40,7 +40,7 @@
EcompClassification.FATAL),
BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION, null), BeHealthCheckTitanRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
+ EcompClassification.INFORMATION, null), BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
null), BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207, ErrorType.RECOVERY,
AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
@@ -54,8 +54,8 @@
AlarmSeverity.CRITICAL, EcompClassification.ERROR,
BeHealthCheckRecovery),
- BeHealthCheckTitanError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR, BeHealthCheckTitanRecovery), BeHealthCheckElasticSearchError(
+ BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR, BeHealthCheckJanusGraphRecovery), BeHealthCheckElasticSearchError(
EcompErrorCode.E_202, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
BeHealthCheckElasticSearchRecovery), BeHealthCheckUebClusterError(EcompErrorCode.E_203,
ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
@@ -245,7 +245,7 @@
*
* BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY,
* AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
- * BeHealthCheckTitanRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
+ * BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
* AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
* BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207,
* ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
@@ -258,9 +258,9 @@
* AlarmSeverity.CRITICAL, EcompClassification.ERROR,
* BeHealthCheckRecovery),
*
- * BeHealthCheckTitanError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR,
+ * BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR,
* AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- * BeHealthCheckTitanRecovery),
+ * BeHealthCheckJanusGraphRecovery),
* BeHealthCheckElasticSearchError(EcompErrorCode.E_202,
* ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
* EcompClassification.ERROR, BeHealthCheckElasticSearchRecovery),
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java b/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
index 49caf61..9faaaf9 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
@@ -43,7 +43,7 @@
configurationManager = new ConfigurationManager(configurationSource);
- configurationManager.getConfiguration().setTitanInMemoryGraph(true);
+ configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true);
}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java
index 440f758..fec9714 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java
@@ -58,13 +58,13 @@
@Test
- public void testLogBeHealthCheckTitanRecovery() throws Exception {
+ public void testLogBeHealthCheckJanusGraphRecovery() throws Exception {
BeEcompErrorManager testSubject;
String context = "";
// default test
testSubject = createTestSubject();
- testSubject.logBeHealthCheckTitanRecovery(context);
+ testSubject.logBeHealthCheckJanusGraphRecovery(context);
}
@@ -113,13 +113,13 @@
@Test
- public void testLogBeHealthCheckTitanError() throws Exception {
+ public void testLogBeHealthCheckJanusGraphError() throws Exception {
BeEcompErrorManager testSubject;
String context = "";
// default test
testSubject = createTestSubject();
- testSubject.logBeHealthCheckTitanError(context);
+ testSubject.logBeHealthCheckJanusGraphError(context);
}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
index 0604e80..49b93c5 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
@@ -402,68 +402,68 @@
@Test
- public void testGetTitanCfgFile() throws Exception {
+ public void testGetJanusGraphCfgFile() throws Exception {
Configuration testSubject;
String result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanCfgFile();
+ result = testSubject.getJanusGraphCfgFile();
}
@Test
- public void testSetTitanCfgFile() throws Exception {
+ public void testSetJanusGraphCfgFile() throws Exception {
Configuration testSubject;
- String titanCfgFile = "";
+ String janusGraphCfgFile = "";
// default test
testSubject = createTestSubject();
- testSubject.setTitanCfgFile(titanCfgFile);
+ testSubject.setJanusGraphCfgFile(janusGraphCfgFile);
}
@Test
- public void testGetTitanMigrationKeySpaceCfgFile() throws Exception {
+ public void testGetJanusGraphMigrationKeySpaceCfgFile() throws Exception {
Configuration testSubject;
String result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanMigrationKeySpaceCfgFile();
+ result = testSubject.getJanusGraphMigrationKeySpaceCfgFile();
}
@Test
- public void testSetTitanMigrationKeySpaceCfgFile() throws Exception {
+ public void testSetJanusGraphMigrationKeySpaceCfgFile() throws Exception {
Configuration testSubject;
- String titanMigrationKeySpaceCfgFile = "";
+ String janusGraphMigrationKeySpaceCfgFile = "";
// default test
testSubject = createTestSubject();
- testSubject.setTitanMigrationKeySpaceCfgFile(titanMigrationKeySpaceCfgFile);
+ testSubject.setJanusGraphMigrationKeySpaceCfgFile(janusGraphMigrationKeySpaceCfgFile);
}
@Test
- public void testGetTitanInMemoryGraph() throws Exception {
+ public void testGetJanusGraphInMemoryGraph() throws Exception {
Configuration testSubject;
Boolean result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanInMemoryGraph();
+ result = testSubject.getJanusGraphInMemoryGraph();
}
@Test
- public void testSetTitanInMemoryGraph() throws Exception {
+ public void testSetJanusGraphInMemoryGraph() throws Exception {
Configuration testSubject;
- Boolean titanInMemoryGraph = null;
+ Boolean janusGraphInMemoryGraph = null;
// default test
testSubject = createTestSubject();
- testSubject.setTitanInMemoryGraph(titanInMemoryGraph);
+ testSubject.setJanusGraphInMemoryGraph(janusGraphInMemoryGraph);
}
@@ -490,72 +490,72 @@
@Test
- public void testGetTitanLockTimeout() throws Exception {
+ public void testGetJanusGraphLockTimeout() throws Exception {
Configuration testSubject;
Long result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanLockTimeout();
+ result = testSubject.getJanusGraphLockTimeout();
}
@Test
- public void testSetTitanLockTimeout() throws Exception {
+ public void testSetJanusGraphLockTimeout() throws Exception {
Configuration testSubject;
- Long titanLockTimeout = null;
+ Long janusGraphLockTimeout = null;
// default test
testSubject = createTestSubject();
- testSubject.setTitanLockTimeout(titanLockTimeout);
+ testSubject.setJanusGraphLockTimeout(janusGraphLockTimeout);
}
@Test
- public void testGetTitanHealthCheckReadTimeout() throws Exception {
+ public void testGetJanusGraphHealthCheckReadTimeout() throws Exception {
Configuration testSubject;
Long result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanHealthCheckReadTimeout();
+ result = testSubject.getJanusGraphHealthCheckReadTimeout();
}
@Test
- public void testSetTitanHealthCheckReadTimeout() throws Exception {
+ public void testSetJanusGraphHealthCheckReadTimeout() throws Exception {
Configuration testSubject;
- Long titanHealthCheckReadTimeout = null;
+ Long janusGraphHealthCheckReadTimeout = null;
// default test
testSubject = createTestSubject();
- testSubject.setTitanHealthCheckReadTimeout(titanHealthCheckReadTimeout);
+ testSubject.setJanusGraphHealthCheckReadTimeout(janusGraphHealthCheckReadTimeout);
}
@Test
- public void testGetTitanReconnectIntervalInSeconds() throws Exception {
+ public void testGetJanusGraphReconnectIntervalInSeconds() throws Exception {
Configuration testSubject;
Long result;
// default test
testSubject = createTestSubject();
- result = testSubject.getTitanReconnectIntervalInSeconds();
+ result = testSubject.getJanusGraphReconnectIntervalInSeconds();
}
@Test
- public void testSetTitanReconnectIntervalInSeconds() throws Exception {
+ public void testSetJanusGraphReconnectIntervalInSeconds() throws Exception {
Configuration testSubject;
- Long titanReconnectIntervalInSeconds = null;
+ Long janusGraphReconnectIntervalInSeconds = null;
// default test
testSubject = createTestSubject();
- testSubject.setTitanReconnectIntervalInSeconds(titanReconnectIntervalInSeconds);
+ testSubject.setJanusGraphReconnectIntervalInSeconds(janusGraphReconnectIntervalInSeconds);
}
diff --git a/common-app-api/src/test/resources/config/common/configuration.yaml b/common-app-api/src/test/resources/config/common/configuration.yaml
index 59d4121..24c7936 100644
--- a/common-app-api/src/test/resources/config/common/configuration.yaml
+++ b/common-app-api/src/test/resources/config/common/configuration.yaml
@@ -22,15 +22,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
diff --git a/docs/configuration.rst b/docs/configuration.rst
index d9aaea1..10bab0d 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -125,7 +125,7 @@
"commitlog_dir": "/var/lib/cassandra/commitlog",
"socket_read_timeout": "20000",
"socket_connect_timeout": "20000",
- "titan_connection_timeout": "10000"
+ "janusgraph_connection_timeout": "10000"
}
}
}
@@ -180,20 +180,20 @@
# Catalog minimum tosca conformance version
minToscaConformanceLevel: 3.0
- # Titan configuration file location
- titanCfgFile: /var/lib/jetty/config/catalog-be/titan.properties
+ # JanusGraph configuration file location
+ janusGraphCfgFile: /var/lib/jetty/config/catalog-be/janusgraph.properties
- # Does titan hold the persistence data in memory
- titanInMemoryGraph: false
+ # Does JanusGraph hold the persistence data in memory
+ janusGraphInMemoryGraph: false
- # The timeout for titan to lock on an object in a transaction
- titanLockTimeout: 1800
+ # The timeout for JanusGraph to lock on an object in a transaction
+ janusGraphLockTimeout: 1800
- # The interval to try and reconnect to titan DB when it is down during SDC startup
- titanReconnectIntervalInSeconds: 3
+ # The interval to try and reconnect to JanusGraph DB when it is down during SDC 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 SDC startup
esReconnectIntervalInSeconds: 3
@@ -1118,42 +1118,42 @@
currentArtifactInstallationTimeout: 120
-BE-titan.properties
+BE-janusgraph.properties
*******************
::
- # Titan storage backend
+ # JanusGraph storage backend
storage.backend=cassandra
- # Titan storage hostname
+ # JanusGraph storage hostname
storage.hostname=<%= @CASSANDRA_IP %>
- # Titan storage port
+ # JanusGraph storage port
storage.port=9160
- # Titan storage username
+ # JanusGraph storage username
storage.username=<%= @CASSANDRA_USR %>
- # Titan storage password
+ # JanusGraph storage password
storage.password=<%= @CASSANDRA_PWD %>
- # Titan storage connection timeout
+ # JanusGraph storage connection timeout
storage.connection-timeout=10000
- # Titan cassandra keyspace name
+ # JanusGraph cassandra keyspace name
storage.cassandra.keyspace=sdctitan
- # Is Titan cassandra ssl is enabled
+ # Is JanusGraph cassandra ssl is enabled
storage.cassandra.ssl.enabled=false
- # Titan cassandra ssl truststore file location
+ # JanusGraph cassandra ssl truststore file location
storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/.truststore
- # Titan cassandra ssl truststore file password
+ # JanusGraph cassandra ssl truststore file password
storage.cassandra.ssl.truststore.password=Aa123456
- # Should titan use cache
+ # Should JanusGraph use cache
cache.db-cache = false
# How long in milliseconds should the cache keep entries before flushing them
@@ -1162,22 +1162,22 @@
# Default expiration time in milliseconds for entries in the cache
cache.db-cache-time = 180000
- # Size of titan database cache
+ # Size of JanusGraph database cache
cache.db-cache-size = 0.5
- # Titan cassandra read consistency level
+ # JanusGraph cassandra read consistency level
storage.cassandra.read-consistency-level=LOCAL_QUORUM
- # Titan cassandra write consistency level
+ # JanusGraph cassandra write consistency level
storage.cassandra.write-consistency-level=LOCAL_QUORUM
- # Titan cassandra replication strategy class name
+ # JanusGraph cassandra replication strategy class name
storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.NetworkTopologyStrategy
- # Titan cassandra replication startegy options
+ # JanusGraph cassandra replication startegy options
storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,<%= @rep_factor %>
- # Titan cassandra local data center name
+ # JanusGraph cassandra local data center name
storage.cassandra.astyanax.local-datacenter=<%= @DC_NAME %>
# Number of times the system attempts to acquire a lock before giving up and throwing an exception
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 38e7d73..38eea46 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -399,7 +399,6 @@
- [`SDC-951 <https://jira.onap.org/browse/SDC-951>`__\ ] - update SDC-TOSCA packages
- [`SDC-952 <https://jira.onap.org/browse/SDC-952>`__\ ] - update SDC-DISTRIBUTION-CLIENT packages
- [`SDC-953 <https://jira.onap.org/browse/SDC-953>`__\ ] - update SDC-DOCKER-BASE packages
-- [`SDC-954 <https://jira.onap.org/browse/SDC-954>`__\ ] - update SDC-TITAN-CASSANDRA packages
- [`SDC-955 <https://jira.onap.org/browse/SDC-955>`__\ ] - configuration ovriding capabilities.
- [`SDC-957 <https://jira.onap.org/browse/SDC-957>`__\ ] - add ignore conformance level option
- [`SDC-969 <https://jira.onap.org/browse/SDC-969>`__\ ] - sync1802E to ONAP part 1
diff --git a/docs/sdcsdks.rst b/docs/sdcsdks.rst
index df8815f..67f76cb 100644
--- a/docs/sdcsdks.rst
+++ b/docs/sdcsdks.rst
@@ -14,7 +14,6 @@
- sdc-tosca
- sdc-jtosca
- sdc-distribution-client
-- sdc-titan-cassandra
SDC SDKs Explanations
=====================
@@ -26,16 +25,3 @@
| The link describes the use of distribution client and the sdc-tosca.
| jtosca is used by sdc-tosca as a dependency and is not used separately
-SDC-TITAN-CASSANDRA
--------------------
-
-| This is a link to the github page of Titan Project for extra reading regarding Titan DB: `<https://github.com/thinkaurelius/titan>`_
-|
-| SDC forked part of the project to override the default Titan configuration for Cassandra.
-| The change allows the use of Titan as an active passive deployment for geo-redundancy.
-|
-| Titan by default uses QUORUM in Cassandra on write and read operations.
-| Using our change allows the use of local QUORUM to read and write only to a specific data center.
-| Since the project is at the end of life state the change cannot be merged back to the project.
-
-
diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb
index 9865f80..844af46 100644
--- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb
+++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb
@@ -17,7 +17,7 @@
default['cassandra']['cluster_name'] = "SDC-CS-"
default['cassandra']['socket_read_timeout'] = 20000
default['cassandra']['socket_connect_timeout'] = 20000
-default['cassandra']['titan_connection_timeout'] = 10000
+default['cassandra']['janusgraph_connection_timeout'] = 10000
#ExternalTesting
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
index 1551d86..75f2cc8 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/resources/configuration.yaml
@@ -22,11 +22,11 @@
version: 1.0
released: 2012-11-30
-titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
-titanInMemoryGraph: false
-titanLockTimeout: 30
-titanReconnectIntervalInSeconds: 3
-titanHealthCheckReadTimeout: 1
+janusGraphCfgFile: /home/vagrant/catalog-be/config/catalog-be/janusgraph.properties
+janusGraphInMemoryGraph: false
+janusGraphLockTimeout: 30
+janusGraphReconnectIntervalInSeconds: 3
+janusGraphHealthCheckReadTimeout: 1
esReconnectIntervalInSeconds: 3
uebHealthCheckReconnectIntervalInSeconds: 15
uebHealthCheckReadTimeout: 4
diff --git a/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml b/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml
index 6636e20..ecfdfe0 100644
--- a/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml
+++ b/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml
@@ -22,11 +22,11 @@
version: 1.0
released: 2012-11-30
-titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
-titanInMemoryGraph: false
-titanLockTimeout: 30
-titanReconnectIntervalInSeconds: 3
-titanHealthCheckReadTimeout: 1
+janusGraphCfgFile: /home/vagrant/catalog-be/config/catalog-be/janusgraph.properties
+janusGraphInMemoryGraph: false
+janusGraphLockTimeout: 30
+janusGraphReconnectIntervalInSeconds: 3
+janusGraphHealthCheckReadTimeout: 1
esReconnectIntervalInSeconds: 3
uebHealthCheckReconnectIntervalInSeconds: 15
uebHealthCheckReadTimeout: 4
diff --git a/pom.xml b/pom.xml
index 04d4a24..0df3e36 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,8 +38,7 @@
<lang3.version>3.3.2</lang3.version>
<lang3.version>3.3.2</lang3.version>
<guava.version>18.0</guava.version>
- <titan.version>1.0.0</titan.version>
- <sdc.titan.version>1.2.0</sdc.titan.version>
+ <janusgraph.version>0.3.1</janusgraph.version>
<spring.version>4.3.18.RELEASE</spring.version>
<spring.security.version>3.2.3.RELEASE</spring.security.version>
<spring.ldap.version>2.0.1.RELEASE</spring.ldap.version>
diff --git a/sdc-os-chef/environments/Template.json b/sdc-os-chef/environments/Template.json
index 6946a0c..e049258 100644
--- a/sdc-os-chef/environments/Template.json
+++ b/sdc-os-chef/environments/Template.json
@@ -88,7 +88,7 @@
"commitlog_dir": "/var/lib/cassandra/commitlog",
"socket_read_timeout": "20000",
"socket_connect_timeout": "20000",
- "titan_connection_timeout": "10000",
+ "janusgraph_connection_timeout": "10000",
"replication_factor": "1"
}
}
diff --git a/sdc-os-chef/kubernetes/sdc/templates/configmaps/sdc-environment-configmap.yaml b/sdc-os-chef/kubernetes/sdc/templates/configmaps/sdc-environment-configmap.yaml
index 56cb854..0eb5289 100644
--- a/sdc-os-chef/kubernetes/sdc/templates/configmaps/sdc-environment-configmap.yaml
+++ b/sdc-os-chef/kubernetes/sdc/templates/configmaps/sdc-environment-configmap.yaml
@@ -103,7 +103,7 @@
"commitlog_dir": "/var/lib/cassandra/commitlog",
"socket_read_timeout": "20000",
"socket_connect_timeout": "20000",
- "titan_connection_timeout": "10000"
+ "janusgraph_connection_timeout": "10000"
}
}
}
diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml
index 6c1f807..f5b3659 100644
--- a/test-apis-ci/pom.xml
+++ b/test-apis-ci/pom.xml
@@ -224,11 +224,10 @@
<scope>compile</scope>
</dependency>
- <!-- TITAN -->
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-core</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -247,9 +246,9 @@
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
+ <groupId>org.janusgraph</groupId>
+ <artifactId>janusgraph-cassandra</artifactId>
+ <version>${janusgraph.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties
index d313e92..02f7830 100644
--- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/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/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
index 5fdc55f..782bba2 100644
--- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
@@ -12,7 +12,7 @@
:catalogBE_port => node['BE'][:http_port],
:webportal_ip => node['Nodes']['FE'],
:webportal_port => node['FE'][:http_port],
- :titan_file => "#{tests_base}/conf/titan.properties",
+ :janusgraph_file => "#{tests_base}/conf/janusgraph.properties",
:tests_base_ci => "#{tests_base}/CI/tests",
:components_path => "#{tests_base}/CI/components",
:importResourceConfigDir => "#{tests_base}/CI/importResource",
@@ -26,9 +26,9 @@
})
end
-template "titan.properties" do
- path "/#{tests_base}/conf/titan.properties"
- source "BE-titan.properties.erb"
+template "janusgraph.properties" do
+ path "/#{tests_base}/conf/janusgraph.properties"
+ source "BE-janusgraph.properties.erb"
owner "root"
group "root"
mode "0755"
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-titan.properties.erb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-janusgraph.properties.erb
similarity index 100%
rename from test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-titan.properties.erb
rename to test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-janusgraph.properties.erb
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb
index 3684b38..ce20180 100644
--- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb
@@ -25,7 +25,7 @@
errorConfigurationFile: <%= @errorConfigurationFile %>
configurationFile: <%= @ConfigurationFile %>
importTypesConfigDir: <%= @importTypesDir %>
-titanPropertiesFile: <%= @titan_file %>
+janusGraphPropertiesFile: <%= @janusgraph_file %>
systemUnderDebug: true
cassandraHost: <%= @CASSANDRA_IP %>
@@ -42,7 +42,7 @@
stopOnClassFailure: false
-#List of non-abstract resources to keep during titan cleanup between tests
+#List of non-abstract resources to keep during JanusGraph cleanup between tests
#Only 1.0 version will be kept
resourcesNotToDelete:
- Compute
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
diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml
index be40b04..afaf491 100644
--- a/ui-ci/pom.xml
+++ b/ui-ci/pom.xml
@@ -144,31 +144,6 @@
<scope>compile</scope>
</dependency>
- <!-- TITAN -->
- <dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-core</artifactId>
- <version>${titan.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>commons-collections</artifactId>
- <groupId>commons-collections</groupId>
- </exclusion>
- <exclusion>
- <artifactId>groovy</artifactId>
- <groupId>org.codehaus.groovy</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.onap.sdc.sdc-titan-cassandra</groupId>
- <artifactId>sdc-titan-cassandra</artifactId>
- <version>${sdc.titan.version}</version>
- <scope>compile</scope>
- </dependency>
-
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties
index d313e92..02f7830 100644
--- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties
+++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/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/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb
index 1d4c6d6..04a6541 100644
--- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb
+++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb
@@ -11,7 +11,7 @@
:catalogBE_port => node['BE'][:http_port],
:webportal_ip => node['Nodes']['FE'],
:webportal_port => node['FE'][:http_port],
- :titan_file => "#{tests_base}/conf/titan.properties",
+ :janusgraph_file => "#{tests_base}/conf/janusgraph.properties",
:tests_base_ci => "#{tests_base}/CI/tests",
:components_path => "#{tests_base}/CI/components",
:importResourceConfigDir => "#{tests_base}/CI/importResource",
@@ -26,9 +26,9 @@
})
end
-template "titan.properties" do
- path "/#{tests_base}/conf/titan.properties"
- source "BE-titan.properties.erb"
+template "janusgraph.properties" do
+ path "/#{tests_base}/conf/janusgraph.properties"
+ source "BE-janusgraph.properties.erb"
owner "root"
group "root"
mode "0755"
diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/BE-titan.properties.erb b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/BE-janusgraph.properties.erb
similarity index 100%
rename from ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/BE-titan.properties.erb
rename to ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/BE-janusgraph.properties.erb
diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/sdc-sanity.yaml.erb b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/sdc-sanity.yaml.erb
index 70063e0..c8a3258 100644
--- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/sdc-sanity.yaml.erb
+++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/templates/default/sdc-sanity.yaml.erb
@@ -40,4 +40,4 @@
errorConfigurationFile: <%= @errorConfigurationFile %>
configurationFile: <%= @ConfigurationFile %>
importTypesConfigDir: <%= @importTypesDir %>
-titanPropertiesFile: <%= @titan_file %>
\ No newline at end of file
+janusGraphPropertiesFile: <%= @janusgraph_file %>
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/attsdc.yaml b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
index e679093..36018d7 100644
--- a/ui-ci/src/main/resources/ci/conf/attsdc.yaml
+++ b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -45,13 +45,13 @@
useBrowserMobProxy: false
captureTraffic: false
-titanPropertiesFile: src/main/resources/ci/conf/titan.properties
+janusGraphPropertiesFile: src/main/resources/ci/conf/janusgraph.properties
stopOnClassFailure: false
#todo
onboardingBeHost: 192.168.33.10
onboardingBePort: 8080
-#List of non-abstract resources to keep during titan cleanup between tests
+#List of non-abstract resources to keep during JanusGraph cleanup between tests
#Only 1.0 version will be kept
resourcesNotToDelete:
- tosca.nodes.Compute
diff --git a/ui-ci/src/main/resources/ci/conf/log4j.properties b/ui-ci/src/main/resources/ci/conf/log4j.properties
index 3e159ec..0bdf0fa 100644
--- a/ui-ci/src/main/resources/ci/conf/log4j.properties
+++ b/ui-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=DEBUG
-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=TRACE, FILE, stdout
log4j.additivity.org.openecomp.sdc.ci.tests.utils=false