summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test/java/org
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2019-05-20 12:11:54 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-06-12 08:05:21 +0000
commit2623c8402a57e2035db69a9d92d2851050916801 (patch)
treef7311f32a5566702921a2e650b476f1ff6bf0de1 /catalog-model/src/test/java/org
parent799bc7e3c75de762dea7448c6f8f5d6e5f3f9671 (diff)
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>
Diffstat (limited to 'catalog-model/src/test/java/org')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java18
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCacheTest.java24
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java3
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/NodeTypeTest.java)2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplateTest.java)3
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElementTypeEnumTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/datamodel/ToscaElementTypeEnumTest.java)2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/enums/JsonConstantKeysEnumTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/enums/JsonConstantKeysEnumTest.java)2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArchiveOperationTest.java)139
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperationsTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperationsTest.java)8
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/CapabilitiesOperationTest.java)16
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java)45
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/GroupsOperationTest.java)16
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperationTest.java)46
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationGraphTest.java)36
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java)54
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java)23
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java)15
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java)19
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java)72
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationCatalogTest.java)14
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTest.java)56
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTestImpl.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperationTestImpl.java)14
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java)17
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java)88
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/UpgradeOperationTest.java)14
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/CapabilityTestUtils.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/CapabilityTestUtils.java)4
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/GraphTestUtils.java)46
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/IdMapperTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java)2
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java (renamed from catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverterTest.java)8
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java56
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java10
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java75
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java39
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java22
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java14
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java78
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java38
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java39
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java32
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java74
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java51
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java71
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UserAdminOperationTest.java86
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java30
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java40
48 files changed, 803 insertions, 764 deletions
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 9efdc95bce..046161ab40 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 @@ public class ModelTestBase {
Configuration configuration = new Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setJanusGraphInMemoryGraph(true);
Map<String, Object> deploymentRIArtifacts = new HashMap<>();
ArtifactDataDefinition artifactInfo = new ArtifactDataDefinition();
@@ -66,13 +66,13 @@ public class ModelTestBase {
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 48681867f9..82c8ae603d 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.InjectMocks;
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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
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 @@ public class ApplicationDataTypeCacheTest extends ModelConfDependentTest{
@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 49e847acf6..62155e2be5 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.Component;
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 2e2f36b9c7..8c4d9d5378 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 5347bc0d76..4e54ba7a29 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.Component;
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 d6b2dd61e7..7e0a72e474 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 @@ import org.springframework.context.annotation.PropertySource;
@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
index 493cb74a25..e4e377ff78 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
index c13ddd3970..4875ca69f7 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
index 918b0328a9..f175aa3d51 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
index b00b13e162..a37a157428 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
index b906604037..ce208d9b3a 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.BeforeClass;
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.JsonPresentationFields;
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 @@ public class ArchiveOperationTest extends ModelTestBase {
private ArchiveOperation archiveOperation;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private boolean isInitialized;
@@ -88,7 +88,7 @@ public class ArchiveOperationTest extends ModelTestBase {
@Before
public void beforeTest() {
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
@@ -247,13 +247,13 @@ public class ArchiveOperationTest extends ModelTestBase {
}
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 @@ public class ArchiveOperationTest extends ModelTestBase {
*************************/
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 @@ public class ArchiveOperationTest extends ModelTestBase {
}
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 @@ public class ArchiveOperationTest extends ModelTestBase {
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 @@ public class ArchiveOperationTest extends ModelTestBase {
*******************************/
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 @@ public class ArchiveOperationTest extends ModelTestBase {
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 @@ public class ArchiveOperationTest extends ModelTestBase {
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.compositionResource1 = GraphTestUtils.createResourceVertex(titanDao, propsForHighestVersion(), ResourceTypeEnum.CP);
- this.compositionResource2 = GraphTestUtils.createResourceVertex(titanDao, propsForHighestVersion(), ResourceTypeEnum.VL);
- this.compositionServiceProxy = GraphTestUtils.createResourceVertex(titanDao, 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);
+ this.compositionService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
+ this.compositionAnotherService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
+
+ this.compositionResource1 = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.CP);
+ this.compositionResource2 = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.VL);
+ this.compositionServiceProxy = GraphTestUtils.createResourceVertex(janusGraphDao, propsForHighestVersion(), ResourceTypeEnum.ServiceProxy);
+
+ 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 @@ public class ArchiveOperationTest extends ModelTestBase {
//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
index 410cef9ae8..160957d1f6 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 @@ public class ArtifactsOperationsTest {
@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 @@ public class ArtifactsOperationsTest {
@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
index 0c9c35b62a..5fc2ef2cae 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.InjectMocks;
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 @@ public class CapabilitiesOperationTest {
@InjectMocks
CapabilitiesOperation operation = new CapabilitiesOperation();
@Mock
- private TitanDao mockTitanDao;
+ private JanusGraphDao mockJanusGraphDao;
@Mock
private TopologyTemplateOperation topologyTemplateOperation;
@@ -53,8 +53,8 @@ public class CapabilitiesOperationTest {
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
index e580fd51bb..8900377bb2 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.Test;
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
private ExternalReferencesOperation externalReferenceOperation;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private boolean isInitialized;
@@ -74,7 +74,7 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
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
index 575fbbca59..e93ec3c616 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.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.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 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@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 class GroupsOperationTest extends ModelTestBase {
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
index fe2ea209f9..31d3f86967 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.Before;
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.Operation;
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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
@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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
.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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
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 @@ public class InterfaceOperationTest extends ModelTestBase {
@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
index 1887891f2b..0131783bea 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.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.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.ContextConfiguration;
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 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
@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 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
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 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
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 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
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
index bddebea630..1455d1e984 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.BeforeClass;
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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
private static NodeTemplateOperation operation;
@Mock
- private static TitanDao titanDao;
+ private static JanusGraphDao janusGraphDao;
@Mock
private static TopologyTemplateOperation topologyTemplateOperation;
@@ -99,9 +99,9 @@ public class NodeTemplateOperationTest extends ModelTestBase {
@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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
@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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
@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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
@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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
@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 @@ public class NodeTemplateOperationTest extends ModelTestBase {
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
index ca8713fdf3..2740551b5c 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.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.PolicyDataDefinition;
@@ -21,8 +20,8 @@ import org.openecomp.sdc.be.model.ComponentParametersView;
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.apache.commons.collections.ListUtils.union;
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 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
@Resource
private TopologyTemplateOperation topologyTemplateOperation;
@Resource
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
@Resource
private PolicyOperation policyOperation;
private PropertyDataDefinition prop1, prop2;
@@ -76,15 +75,15 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
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
index 136f95b987..1df6721612 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.Captor;
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 @@ public class PolicyOperationTest {
@InjectMocks
private PolicyOperation testInstance;
@Mock
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Mock
private TopologyTemplateOperation topologyTemplateOperation;
@Captor
@@ -63,7 +63,8 @@ public class PolicyOperationTest {
@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 @@ public class PolicyOperationTest {
@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 @@ public class PolicyOperationTest {
@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
index 9936d45f62..f5dd3a0346 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.ComponentParametersView;
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 java.util.Map;
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 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
private TopologyTemplateOperation topologyTemplateOperation;
@Resource
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private CapabilityPropertyDataObject capabilityProperty1;
private CapabilityPropertyDataObject capabilityProperty2;
private CapabilityPropertyDataObject capabilityProperty3;
@@ -74,14 +73,14 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
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
index 4ace70b34f..bc3c7cc8bd 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.InjectMocks;
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.User;
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 @@ public class TopologyTemplateOperationTest {
@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 @@ public class TopologyTemplateOperationTest {
@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 @@ public class TopologyTemplateOperationTest {
@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 @@ public class TopologyTemplateOperationTest {
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 @@ public class TopologyTemplateOperationTest {
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 @@ public class TopologyTemplateOperationTest {
}
};
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 @@ public class TopologyTemplateOperationTest {
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
index bffefd86cd..eeb7e17323 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.junit.runner.RunWith;
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 @@ public class ToscaElementOperationCatalogTest {
@Mock
Vertex vertex;
@Mock
- TitanDao titanDao;
+ JanusGraphDao janusGraphDao;
@Mock
VertexProperty<Object> property;
@@ -41,9 +41,9 @@ public class ToscaElementOperationCatalogTest {
@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
index e77f8e108c..205899d52f 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.Test;
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 @@ public class ToscaElementOperationTest extends ModelTestBase{
private ToscaElementOperationTestImpl toscaElementOperation;
@javax.annotation.Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@BeforeClass
public static void initTest(){
@@ -56,8 +56,8 @@ public class ToscaElementOperationTest extends ModelTestBase{
@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 @@ public class ToscaElementOperationTest extends ModelTestBase{
}
private void initGraphForTest() {
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
Map<GraphPropertyEnum, Object> highstVerticesProps = new HashMap<GraphPropertyEnum, Object>() {
{
@@ -297,34 +297,34 @@ public class ToscaElementOperationTest extends ModelTestBase{
};
// 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
index 27fbce4776..01e14cd588 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 @@ public class ToscaElementOperationTestImpl extends ToscaElementOperation {
@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 @@ public class ToscaElementOperationTestImpl extends ToscaElementOperation {
}
@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
index 95dca7f920..88d3db68c6 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.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.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.assertj.core.api.Assertions.assertThat;
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 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
@Test
@@ -121,7 +120,7 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
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
index b43b632ad1..1bbbd1c087 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.Mock;
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.Resource;
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.Mockito.when;
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 @@ public class ToscaOperationFacadeTest {
private ToscaOperationFacade testInstance;
@Mock
- private HealingTitanDao titanDaoMock;
+ private HealingJanusGraphDao janusGraphDaoMock;
@Mock
private TopologyTemplateOperation topologyTemplateOperationMock;
@@ -128,9 +126,9 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
@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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
} 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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
} 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 @@ public class ToscaOperationFacadeTest {
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 @@ public class ToscaOperationFacadeTest {
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
index acb9af6a33..68c87bb7e8 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.BeforeClass;
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.datatypes.enums.ResourceTypeEnum;
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 @@ public class UpgradeOperationTest extends ModelTestBase {
private boolean isInitialized;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Resource
private UpgradeOperation upgradeOperation;
@Resource
@@ -62,7 +62,7 @@ public class UpgradeOperationTest extends ModelTestBase {
@Before
public void beforeTest() {
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
@@ -102,7 +102,7 @@ public class UpgradeOperationTest extends ModelTestBase {
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
index 6f6b7eacad..8a17de4054 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.PropertyDataDefinition;
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
index 71dd472a1c..06e0b428b9 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 @@ import java.util.UUID;
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 @@ public final class GraphTestUtils {
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 @@ public final class GraphTestUtils {
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
index 39ea68c3fe..dca79c6041 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
index a927f5a461..740d148a79 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.datatypes.enums.ResourceTypeEnum;
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 6fd04c18bb..dedf84cd76 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.BeforeClass;
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 @@ import static org.mockito.Mockito.when;
@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 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
@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 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
@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 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
@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 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
}
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 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
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 9a3c66689e..24a263a89b 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.Before;
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 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
static final String NEW_DESCRIPTION = "new description";
@Resource
- private TitanGenericDao titanGenericDao;
+ private JanusGraphGenericDao janusGraphGenericDao;
@Resource
private CommonTypeOperations commonTypeOperations;
@@ -47,13 +47,13 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
@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 class AnnotationTypeOperationsTest extends ModelTestBase {
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 8e92549f4f..10553a0f89 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 @@ package org.openecomp.sdc.be.model.operations.impl;
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
// 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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 @@ public class ArtifactOperationTest extends ModelTestBase {
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 f853553911..b003c93fc1 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.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.util.ArrayList;
import java.util.HashMap;
@@ -44,10 +44,9 @@ import org.junit.BeforeClass;
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.openecomp.sdc.be.resources.data.CapabilityTypeData;
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 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
@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 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
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 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
}
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 849a442542..029c638711 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.InjectMocks;
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 @@ public class ComponentInstanceOperationTest {
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 class ComponentInstanceOperationTest {
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 @@ public class ComponentInstanceOperationTest {
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 @@ public class ComponentInstanceOperationTest {
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 9b2a5d93c9..2c00d3d952 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.BeforeClass;
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 @@ public class ElementOperationTest extends ModelTestBase {
@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 @@ public class ElementOperationTest extends ModelTestBase {
// @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 @@ public class ElementOperationTest extends ModelTestBase {
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 @@ public class ElementOperationTest extends ModelTestBase {
}
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 0f8e294459..8e1e5d3d04 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.BeforeClass;
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
@After
public void tearDown() {
- titanDao.rollback();
+ janusGraphDao.rollback();
cleanUp();
}
@@ -120,10 +119,12 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
}
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 @@ public class GroupTypeOperationTest extends ModelTestBase {
}
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 61504db727..958f7c878b 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.junit.Test;
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 @@ public class HeatParametersOperationTest extends ModelTestBase {
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 @@ public class HeatParametersOperationTest extends ModelTestBase {
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 @@ public class HeatParametersOperationTest extends ModelTestBase {
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 @@ public class HeatParametersOperationTest extends ModelTestBase {
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 3e8b087fb2..532e76bba8 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.Mockito;
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 @@ public class InterfaceLifecycleOperationTest {
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 ef1025f77e..f5197f05c5 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.assertj.core.api.Assertions.assertThat;
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.BeforeClass;
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 @@ public class PolicyTypeOperationTest extends ModelTestBase {
private PolicyTypeOperation policyTypeOperation;
@Autowired
- private HealingTitanGenericDao titanGenericDao;
+ private HealingJanusGraphGenericDao janusGraphGenericDao;
@BeforeClass
public static void setupBeforeClass() {
@@ -74,20 +74,20 @@ public class PolicyTypeOperationTest extends ModelTestBase {
@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 @@ public class PolicyTypeOperationTest extends ModelTestBase {
}
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 ae428bdaff..8535c3a9f3 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 @@ import static org.junit.Assert.*;
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 @@ public class PropertyOperationTest extends ModelTestBase {
*
* 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 @@ public class PropertyOperationTest extends ModelTestBase {
}
private PropertyOperation createTestSubject() {
- return new PropertyOperation(new HealingTitanGenericDao(new TitanGraphClient()), null);
+ return new PropertyOperation(new HealingJanusGraphGenericDao(new JanusGraphClient()), null);
}
@@ -572,7 +572,7 @@ public class PropertyOperationTest extends ModelTestBase {
String propertyName = "";
PropertyDefinition propertyDefinition = new PropertyDefinition();
String resourceId = "";
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -583,11 +583,11 @@ public class PropertyOperationTest extends ModelTestBase {
@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 @@ public class PropertyOperationTest extends ModelTestBase {
@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 @@ public class PropertyOperationTest extends ModelTestBase {
PropertyOperation testSubject;
String propertyId = "";
PropertyDefinition propertyDefinition = null;
- Either<PropertyData, TitanOperationStatus> result;
+ Either<PropertyData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -645,14 +645,14 @@ public class PropertyOperationTest extends ModelTestBase {
@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 @@ public class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
PropertyOperation testSubject;
String resourceInstanceId = "";
String propertyId = "";
- ImmutablePair<TitanOperationStatus, String> result;
+ ImmutablePair<JanusGraphOperationStatus, String> result;
// default test
testSubject = createTestSubject();
@@ -785,7 +785,7 @@ public class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
PropertyOperation testSubject;
String propertyValueUid = "";
String resourceInstanceId = "";
- Either<PropertyValueData, TitanOperationStatus> result;
+ Either<PropertyValueData, JanusGraphOperationStatus> result;
// default test
testSubject = createTestSubject();
@@ -882,7 +882,7 @@ public class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
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 class PropertyOperationTest extends ModelTestBase {
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 class PropertyOperationTest extends ModelTestBase {
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 class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
@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 class PropertyOperationTest extends ModelTestBase {
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 @@ public class PropertyOperationTest extends ModelTestBase {
@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 @@ public class PropertyOperationTest extends ModelTestBase {
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 3d60a650f3..30463e9982 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.Mockito;
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
private static final String PROP = "prop";
@Mock
- HealingTitanGenericDao titanGenericDao;
+ HealingJanusGraphGenericDao janusGraphGenericDao;
@Mock
PropertyOperation propertyOperation;
@@ -101,16 +100,16 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@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 class RelationshipTypeOperationTest extends ModelTestBase {
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
.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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
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 class RelationshipTypeOperationTest extends ModelTestBase {
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 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
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 c70e41b2f1..aef1642e3f 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.User;
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 @@ import static org.junit.Assert.assertTrue;
public class ToscaElementLifecycleOperationTest extends ModelTestBase {
@javax.annotation.Resource
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@javax.annotation.Resource
private NodeTypeOperation nodeTypeOperation;
@@ -105,7 +105,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
createUsers();
createResourceCategory();
createServiceCategory();
- GraphTestUtils.createRootCatalogVertex(titanDao);
+ GraphTestUtils.createRootCatalogVertex(janusGraphDao);
rootVertex = createRootNodeType();
createNodeType("firstVf");
serviceVertex = createTopologyTemplate("firstService");
@@ -263,7 +263,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
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 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
}
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 5226a468d7..c094999ebc 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.Mockito;
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.ArgumentMatchers.eq;
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 @@ public class UserAdminOperationTest extends ModelTestBase {
@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 @@ public class UserAdminOperationTest extends ModelTestBase {
@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 @@ public class UserAdminOperationTest extends ModelTestBase {
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 @@ public class UserAdminOperationTest extends ModelTestBase {
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 @@ public class UserAdminOperationTest extends ModelTestBase {
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 @@ public class UserAdminOperationTest extends ModelTestBase {
}
@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 @@ public class UserAdminOperationTest extends ModelTestBase {
}
@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 @@ public class UserAdminOperationTest extends ModelTestBase {
}
@Override
- public TitanVertexQuery<? extends TitanVertexQuery> query() {
+ public JanusGraphVertexQuery<? extends JanusGraphVertexQuery> query() {
return null;
}
@@ -231,7 +232,7 @@ public class UserAdminOperationTest extends ModelTestBase {
}
@Override
- public TitanTransaction graph() {
+ public JanusGraphTransaction graph() {
return null;
}
@@ -369,27 +370,28 @@ public class UserAdminOperationTest extends ModelTestBase {
};
}
- 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 a0b6ea6fd3..71dc5d9517 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 @@ import org.openecomp.sdc.common.util.ValidationUtils;
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 @@ public class OperationTestsUtil {
.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 7ba2e097c2..6bd206725b 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 @@ import java.util.Set;
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 @@ public class PrintGraph {
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 @@ public class PrintGraph {
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 @@ public class PrintGraph {
}
- 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 @@ public class PrintGraph {
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 @@ public class PrintGraph {
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();