From 2623c8402a57e2035db69a9d92d2851050916801 Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Mon, 20 May 2019 12:11:54 +0530 Subject: 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 --- .../java/org/openecomp/sdc/asdctool/UtilsTest.java | 4 +- .../GetConsumersConfigurationTest.java | 6 +-- .../sdc/asdctool/impl/ArtifactUuidFixTest.java | 26 +++++------ .../sdc/asdctool/impl/GraphJsonValidatorTest.java | 12 +++--- .../sdc/asdctool/impl/GraphMLConverterTest.java | 18 ++++---- .../sdc/asdctool/impl/GraphMLDataAnalyzerTest.java | 2 +- .../asdctool/impl/JanusGraphInitializerTest.java | 16 +++++++ .../sdc/asdctool/impl/ProductLogicTest.java | 4 +- .../asdctool/impl/TitanGraphInitializerTest.java | 16 ------- .../asdctool/impl/UpdatePropertyOnVertexTest.java | 10 ++--- .../sdc/asdctool/impl/VrfObjectFixHandlerTest.java | 24 ++++++----- .../impl/internal/tool/CsarGeneratorTest.java | 11 ++--- .../internal/tool/DeleteComponentHandlerTest.java | 14 +++--- .../config/ValidationToolConfigurationTest.java | 18 ++++---- .../tasks/moduleJson/ModuleJsonTaskTest.java | 4 +- .../tasks/mig1710/UpgradeMigration1710Test.java | 50 +++++++++++----------- .../tasks/mig1802/SdcCatalogMigrationTest.java | 8 ++-- .../tasks/mig1806/ForwardPathMigrationTest.java | 8 ++-- .../mig1806/ResourceLifecycleMigrationTest.java | 6 +-- .../tasks/mig1806/SDCInstancesMigrationTest.java | 19 ++++---- .../tasks/mig1806/SdcArchiveMigrationTest.java | 6 +-- .../ExportImportJanusGraphServletTest.java | 38 ++++++++++++++++ .../servlets/ExportImportTitanServletTest.java | 38 ---------------- 23 files changed, 183 insertions(+), 175 deletions(-) create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java (limited to 'asdctool/src/test/java/org/openecomp') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java index 8a9b1357ea..cefda717aa 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.asdctool; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import org.apache.commons.configuration.Configuration; import org.apache.tinkerpop.gremlin.structure.Element; import org.junit.Assert; @@ -34,7 +34,7 @@ public class UtilsTest { @Test public void testOpenGraph() throws Exception { Configuration conf = null; - TitanGraph result; + JanusGraph result; // default test with null result = Utils.openGraph(conf); diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java index 5495d11827..7c661ae808 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java @@ -1,7 +1,7 @@ package org.openecomp.sdc.asdctool.configuration; import org.junit.Test; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation; public class GetConsumersConfigurationTest { @@ -13,11 +13,11 @@ public class GetConsumersConfigurationTest { @Test public void testConsumerOperation() throws Exception { GetConsumersConfiguration testSubject; - TitanGenericDao titanGenericDao = null; + JanusGraphGenericDao janusGraphGenericDao = null; ConsumerOperation result; // default test testSubject = createTestSubject(); - result = testSubject.consumerOperation(titanGenericDao); + result = testSubject.consumerOperation(janusGraphGenericDao); } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java index 891946d26c..858538250d 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java @@ -1,8 +1,7 @@ package org.openecomp.sdc.asdctool.impl; -import com.thinkaurelius.titan.core.TitanVertex; +import org.janusgraph.core.JanusGraphVertex; import fj.data.Either; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; @@ -12,14 +11,14 @@ import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.Constants; @@ -40,10 +39,10 @@ public class ArtifactUuidFixTest { private ArtifactUuidFix test; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock - private TitanVertex vertex; + private JanusGraphVertex vertex; @Mock ToscaOperationFacade toscaOperationFacade; @@ -70,25 +69,26 @@ public class ArtifactUuidFixTest { graphVertex.setUniqueId(uniqueId); graphVertex.setMetadataProperties(hasProps1); list.add(graphVertex); - when(titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, hasProps1)).thenReturn(Either.left(list)); + when(janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, hasProps1)).thenReturn(Either.left(list)); Map hasProps2 = new HashMap<>(); hasProps2.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); hasProps2.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF); hasProps2.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps2)).thenReturn(Either.left(list)); + when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps2)).thenReturn(Either.left(list)); Map hasProps3 = new HashMap<>(); hasProps3.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); hasProps3.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps3)).thenReturn(Either.left(list)); + when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps3)).thenReturn(Either.left(list)); Map hasProps = new HashMap<>(); hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF.name()); Map hasNotProps = new HashMap<>(); hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); + when(janusGraphDao + .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); Resource resource = new Resource(); resource.setName(uniqueId); Map deployArtifact = new HashMap<>(); @@ -155,7 +155,8 @@ public class ArtifactUuidFixTest { componentInstances.add(componentInstance); service.setComponentInstances(componentInstances); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); + when(janusGraphDao + .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); when(toscaOperationFacade.getToscaElement(ArgumentMatchers.eq(graphVertex.getUniqueId()),any(ComponentParametersView.class))) .thenReturn(Either.left(service)); byte[] payload = "value".getBytes(); @@ -188,7 +189,8 @@ public class ArtifactUuidFixTest { hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); Map hasNotProps = new HashMap<>(); hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); + when(janusGraphDao + .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list)); result = test.doFix(fixComponent, runMode); assertEquals(false,result); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java index 06beb8d409..87d95ed997 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java @@ -14,33 +14,33 @@ public class GraphJsonValidatorTest { } @Test - public void testVerifyTitanJson() throws Exception { + public void testVerifyJanusGraphJson() throws Exception { GraphJsonValidator testSubject; boolean result; // default test testSubject = createTestSubject(); - result = testSubject.verifyTitanJson("src/test/resources/graph.json"); + result = testSubject.verifyJanusGraphJson("src/test/resources/graph.json"); assertTrue(result); } @Test - public void testVerifyTitanJsonErrorFile() throws Exception { + public void testVerifyJanusGraphJsonErrorFile() throws Exception { GraphJsonValidator testSubject; boolean result; // default test testSubject = createTestSubject(); - result = testSubject.verifyTitanJson("src/test/resources/graphError.json"); + result = testSubject.verifyJanusGraphJson("src/test/resources/graphError.json"); assertFalse(result); } @Test(expected=NoSuchFileException.class) - public void testVerifyTitanJsonNoFile() throws Exception { + public void testVerifyJanusGraphJsonNoFile() throws Exception { GraphJsonValidator testSubject; // default test testSubject = createTestSubject(); - testSubject.verifyTitanJson("stam"); + testSubject.verifyJanusGraphJson("stam"); } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java index 5ade4faef8..111f66d540 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.asdctool.impl; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Element; import org.junit.Test; @@ -61,18 +61,18 @@ public class GraphMLConverterTest { @Test(expected=IllegalArgumentException.class) public void testOpenGraph() throws Exception { GraphMLConverter testSubject; - String titanFileLocation = ""; - TitanGraph result; + String janusGraphFileLocation = ""; + JanusGraph result; // default test testSubject = createTestSubject(); - result = testSubject.openGraph("src/main/resources/config/titan.properties"); + result = testSubject.openGraph("src/main/resources/config/janusgraph.properties"); } @Test(expected=NullPointerException.class) public void testExportJsonGraph() throws Exception { GraphMLConverter testSubject; - TitanGraph graph = null; + JanusGraph graph = null; String outputDirectory = ""; String result; @@ -84,7 +84,7 @@ public class GraphMLConverterTest { @Test(expected=NullPointerException.class) public void testExportGraphMl_1() throws Exception { GraphMLConverter testSubject; - TitanGraph graph = null; + JanusGraph graph = null; String outputDirectory = ""; String result; @@ -96,7 +96,7 @@ public class GraphMLConverterTest { @Test public void testImportJsonGraph() throws Exception { GraphMLConverter testSubject; - TitanGraph graph = null; + JanusGraph graph = null; String graphJsonFile = ""; List> propertiesCriteriaToDelete = null; boolean result; @@ -109,7 +109,7 @@ public class GraphMLConverterTest { @Test(expected=NullPointerException.class) public void testFindErrorInJsonGraph_1() throws Exception { GraphMLConverter testSubject; - TitanGraph graph = null; + JanusGraph graph = null; String outputDirectory = ""; String result; @@ -122,7 +122,7 @@ public class GraphMLConverterTest { @Test(expected=NullPointerException.class) public void testExportUsers() throws Exception { GraphMLConverter testSubject; - TitanGraph graph = null; + JanusGraph graph = null; String outputDirectory = ""; String result; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java index c6905a939d..c2605a6946 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java @@ -11,7 +11,7 @@ public class GraphMLDataAnalyzerTest { @Test public void testAnalyzeGraphMLData() throws Exception { GraphMLDataAnalyzer testSubject; - String[] args = new String[] { "export", "src/main/resources/config/titan.properties", "./" }; + String[] args = new String[] { "export", "src/main/resources/config/janusgraph.properties", "./" }; String result; // default test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java new file mode 100644 index 0000000000..5be99c382a --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializerTest.java @@ -0,0 +1,16 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; + +public class JanusGraphInitializerTest { + + @Test(expected=IllegalArgumentException.class) + public void testCreateGraph() throws Exception { + String janusGraphCfgFile = ""; + boolean result; + + // default test + result = JanusGraphInitializer.createGraph(""); + + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java index 982c85b060..09c8b08db6 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java @@ -12,7 +12,7 @@ public class ProductLogicTest { @Test public void testDeleteAllProducts() throws Exception { ProductLogic testSubject; - String titanFile = ""; + String janusGraphFile = ""; String beHost = ""; String bePort = ""; String adminUser = ""; @@ -20,7 +20,7 @@ public class ProductLogicTest { // default test testSubject = createTestSubject(); - result = testSubject.deleteAllProducts(titanFile, beHost, bePort, adminUser); + result = testSubject.deleteAllProducts(janusGraphFile, beHost, bePort, adminUser); assertFalse(result); } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java deleted file mode 100644 index 431c59f591..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.openecomp.sdc.asdctool.impl; - -import org.junit.Test; - -public class TitanGraphInitializerTest { - - @Test(expected=IllegalArgumentException.class) - public void testCreateGraph() throws Exception { - String titanCfgFile = ""; - boolean result; - - // default test - result = TitanGraphInitializer.createGraph(""); - - } -} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java index 4db5c06262..4e52ad527e 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.asdctool.impl; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import org.junit.Test; import java.util.List; @@ -15,8 +15,8 @@ public class UpdatePropertyOnVertexTest { @Test(expected=IllegalArgumentException.class) public void testOpenGraph() throws Exception { UpdatePropertyOnVertex testSubject; - String titanFileLocation = ""; - TitanGraph result; + String janusGraphFileLocation = ""; + JanusGraph result; // default test testSubject = createTestSubject(); @@ -26,13 +26,13 @@ public class UpdatePropertyOnVertexTest { @Test(expected=NullPointerException.class) public void testUpdatePropertyOnServiceAtLeastCertified() throws Exception { UpdatePropertyOnVertex testSubject; - String titanFile = ""; + String janusGraphFile = ""; Map keyValueToSet = null; List> orCriteria = null; Integer result; // default test testSubject = createTestSubject(); - result = testSubject.updatePropertyOnServiceAtLeastCertified(titanFile, keyValueToSet, orCriteria); + result = testSubject.updatePropertyOnServiceAtLeastCertified(janusGraphFile, keyValueToSet, orCriteria); } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java index c0ae55a607..b6ab4f5b55 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java @@ -6,9 +6,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyMap; @@ -18,14 +18,14 @@ import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class VrfObjectFixHandlerTest { - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; private VrfObjectFixHandler vrfObjectFixHandler; @Before public void init(){ - titanDao = Mockito.mock(TitanDao.class); - vrfObjectFixHandler = new VrfObjectFixHandler(titanDao); + janusGraphDao = Mockito.mock(JanusGraphDao.class); + vrfObjectFixHandler = new VrfObjectFixHandler(janusGraphDao); } @Test @@ -35,25 +35,29 @@ public class VrfObjectFixHandlerTest { @Test public void handleDetectNotFoundTest(){ - when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_FOUND)); assertThat(vrfObjectFixHandler.handle("detect", null)).isTrue(); } @Test - public void handleDetectTitanNotConnectedTest(){ - when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_CONNECTED)); + public void handleDetectJanusGraphNotConnectedTest(){ + when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_CONNECTED)); assertThat(vrfObjectFixHandler.handle("detect", null)).isFalse(); } @Test public void handleFixNotFoundTest(){ - when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_FOUND)); assertThat(vrfObjectFixHandler.handle("fix", null)).isTrue(); } @Test public void handleFixNotCreatedTest(){ - when(titanDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right(TitanOperationStatus.NOT_CREATED)); + when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), anyMap())).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_CREATED)); assertThat(vrfObjectFixHandler.handle("fix", null)).isFalse(); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java index 4e80f8e119..109aa9d102 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java @@ -37,7 +37,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; @@ -45,7 +45,7 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.*; @@ -58,7 +58,7 @@ public class CsarGeneratorTest { private CsarGenerator test; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private Component component; @@ -83,9 +83,10 @@ public class CsarGeneratorTest { props.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); graphVertex.setMetadataProperties(props); - when(titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props)).thenReturn(Either.left(list)); + when(janusGraphDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props)).thenReturn(Either.left(list)); when(toscaOperationFacade.getToscaFullElement(any(String.class))).thenReturn(Either.left(component)); - when(titanDao.getChildVertex(graphVertex, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson)).thenReturn(Either.left(graphVertex)); + when(janusGraphDao + .getChildVertex(graphVertex, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson)).thenReturn(Either.left(graphVertex)); test.generateCsar(uuid,scanner); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java index 315f615fb4..b7e8eae560 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java @@ -29,7 +29,7 @@ */ package org.openecomp.sdc.asdctool.impl.internal.tool; -import com.thinkaurelius.titan.core.TitanVertex; +import org.janusgraph.core.JanusGraphVertex; import fj.data.Either; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,11 +39,11 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.HashMap; @@ -58,7 +58,7 @@ public class DeleteComponentHandlerTest { private DeleteComponentHandler test; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private TopologyTemplateOperation topologyTemplateOperation; @@ -74,7 +74,7 @@ public class DeleteComponentHandlerTest { Scanner scanner = new Scanner(in); String id = "start"; GraphVertex loc = new GraphVertex(); - TitanVertex vertex = Mockito.mock(TitanVertex.class); + JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); loc.setVertex(vertex); Map metadataProperties = new HashMap<>(); @@ -83,7 +83,7 @@ public class DeleteComponentHandlerTest { metadataProperties.put(GraphPropertyEnum.NAME, "user1"); loc.setMetadataProperties(metadataProperties); - when(titanDao.getVertexById(id)).thenReturn(Either.left(loc)); + when(janusGraphDao.getVertexById(id)).thenReturn(Either.left(loc)); when(topologyTemplateOperation.deleteToscaElement(ArgumentMatchers.any(GraphVertex.class))).thenReturn(Either.left(toscaElement)); test.deleteComponent(id,scanner); diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java index 0d91f1a29e..cf064ee04d 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java @@ -8,13 +8,13 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidat import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask; -import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; -import org.openecomp.sdc.be.model.jsontitan.operations.*; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*; public class ValidationToolConfigurationTest { @@ -125,7 +125,7 @@ public class ValidationToolConfigurationTest { @Test public void testDaoStrategy() { ValidationToolConfiguration testSubject; - TitanClientStrategy result; + JanusGraphClientStrategy result; // default test testSubject = createTestSubject(); @@ -174,14 +174,14 @@ public class ValidationToolConfigurationTest { } @Test - public void testTitanDao() { + public void testJanusGraphDao() { ValidationToolConfiguration testSubject; - TitanGraphClient titanGraphClient = null; - TitanDao result; + JanusGraphClient janusGraphClient = null; + JanusGraphDao result; // default test testSubject = createTestSubject(); - result = testSubject.titanDao(titanGraphClient); + result = testSubject.janusGraphDao(janusGraphClient); } @Test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java index 5799b6d03d..e4fb979620 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java @@ -15,8 +15,8 @@ import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; import java.util.HashMap; import java.util.Map; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java index 8d46e61011..64e06ac5fb 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java @@ -41,18 +41,18 @@ import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLog import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CsarOperation; @@ -95,7 +95,7 @@ public class UpgradeMigration1710Test { @Mock private LifecycleBusinessLogic lifecycleBusinessLogic; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private ComponentsUtils componentUtils; @Mock @@ -179,8 +179,8 @@ public class UpgradeMigration1710Test { public void nodeTypesUpgradeFailed() { migration.setNodeTypesSupportOnly(true); resolveUserAndDefineUpgradeLevel(); - when(titanDao.getByCriteria(any(), any(), any(), any())) - .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(janusGraphDao.getByCriteria(any(), any(), any(), any())) + .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); } @@ -189,8 +189,8 @@ public class UpgradeMigration1710Test { configurationManager.getConfiguration().setEnableAutoHealing(false); migration.init(); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(0)).commit(); - verify(titanDao, times(0)).rollback(); + verify(janusGraphDao, times(0)).commit(); + verify(janusGraphDao, times(0)).rollback(); } @Test @@ -213,8 +213,8 @@ public class UpgradeMigration1710Test { migration.setNodeTypesSupportOnly(true); upgradeAllScenario(false); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(2)).commit(); - verify(titanDao, times(0)).rollback(); + verify(janusGraphDao, times(2)).commit(); + verify(janusGraphDao, times(0)).rollback(); } @Test @@ -230,8 +230,8 @@ public class UpgradeMigration1710Test { resolveUserAndDefineUpgradeLevel(); upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeVFC, isFailed); assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(1)).commit(); - verify(titanDao, times(2)).rollback(); + verify(janusGraphDao, times(1)).commit(); + verify(janusGraphDao, times(2)).rollback(); } @@ -247,8 +247,8 @@ public class UpgradeMigration1710Test { upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeVFC, isFailed); migration.init(); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(2)).commit(); - verify(titanDao, times(0)).rollback(); + verify(janusGraphDao, times(2)).commit(); + verify(janusGraphDao, times(0)).rollback(); } @Test @@ -262,8 +262,8 @@ public class UpgradeMigration1710Test { resolveUserAndDefineUpgradeLevel(); upgradeRules(failOnVfUpgrade, exceptionOnFvUpgrade, upgradeServices, upgradeVFC, isFailed); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(3)).commit(); - verify(titanDao, times(1)).rollback(); + verify(janusGraphDao, times(3)).commit(); + verify(janusGraphDao, times(1)).rollback(); } @@ -271,8 +271,8 @@ public class UpgradeMigration1710Test { public void upgradeAll() { upgradeAllScenario(true); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(4)).commit(); - verify(titanDao, times(0)).rollback(); + verify(janusGraphDao, times(4)).commit(); + verify(janusGraphDao, times(0)).rollback(); } @Test @@ -282,8 +282,8 @@ public class UpgradeMigration1710Test { .thenReturn(StorageOperationStatus.OK); upgradeAllScenario(true); assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); - verify(titanDao, times(4)).commit(); - verify(titanDao, times(0)).rollback(); + verify(janusGraphDao, times(4)).commit(); + verify(janusGraphDao, times(0)).rollback(); } @Test @@ -302,7 +302,7 @@ public class UpgradeMigration1710Test { @Test public void migrationFailedWhenUserNotResolved() { when(userAdminOperation.getUserData(anyString(), eq(false))).thenReturn(Either.right(ActionStatus.MISSING_INFORMATION)); - when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); } @@ -523,13 +523,13 @@ public class UpgradeMigration1710Test { List components = Lists.newArrayList(); components.add(component); - when(titanDao.getByCriteria(any(), any(), any(), any())) + when(janusGraphDao.getByCriteria(any(), any(), any(), any())) .thenReturn(Either.left(components)); - when(titanDao.getParentVertecies(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class))) + when(janusGraphDao.getParentVertecies(any(GraphVertex.class), any(EdgeLabelEnum.class), any(JsonParseFlagEnum.class))) //1th node to upgrade .thenReturn(Either.left(components)) //parent of the 1th node - stop recursion - .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); } private GraphVertex createComponent() { @@ -601,7 +601,7 @@ public class UpgradeMigration1710Test { components.add(component); when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(Either.left(resource)); - when(titanDao.getByCriteria(any(), any(), any(), any())) + when(janusGraphDao.getByCriteria(any(), any(), any(), any())) .thenReturn(Either.left(components)); when(csarOperation.getCsarLatestVersion(anyString(), any())) .thenReturn(Either.left("2.0")); diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java index 00b6d573af..47481f8f46 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java @@ -3,14 +3,14 @@ package org.openecomp.sdc.asdctool.migration.tasks.mig1802; import org.junit.Test; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; public class SdcCatalogMigrationTest { private SdcCatalogMigration createTestSubject() { - return new SdcCatalogMigration(new TopologyTemplateOperation(), new TitanDao(new TitanGraphClient())); + return new SdcCatalogMigration(new TopologyTemplateOperation(), new JanusGraphDao(new JanusGraphClient())); } @Test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java index c10291b198..581ae09c26 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java @@ -8,8 +8,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.openecomp.sdc.asdctool.migration.core.DBVersion; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation; public class ForwardPathMigrationTest { @@ -17,7 +17,7 @@ public class ForwardPathMigrationTest { ForwardPathMigration forwardPathMigration = null; @Mock - TitanDao titanDao; + JanusGraphDao janusGraphDao; @Mock UserAdminOperation userAdminOperation; @@ -27,7 +27,7 @@ public class ForwardPathMigrationTest { @Before public void setUp() throws Exception { - forwardPathMigration = new ForwardPathMigration(titanDao, userAdminOperation, toscaOperationFacade); + forwardPathMigration = new ForwardPathMigration(janusGraphDao, userAdminOperation, toscaOperationFacade); } @Test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java index b7f014039e..c3266f9ce2 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java @@ -11,14 +11,14 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation; @RunWith(MockitoJUnitRunner.class) public class ResourceLifecycleMigrationTest { @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private LifecycleBusinessLogic lifecycleBusinessLogic; @Mock @@ -29,7 +29,7 @@ public class ResourceLifecycleMigrationTest { @Before public void setUp() throws Exception { resourceLifecycleMigration = - new ResourceLifecycleMigration(titanDao, lifecycleBusinessLogic, userAdminOperation); + new ResourceLifecycleMigration(janusGraphDao, lifecycleBusinessLogic, userAdminOperation); } @Test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java index d040d66496..2a55aaf1fa 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java @@ -7,14 +7,14 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.ArrayList; @@ -29,15 +29,16 @@ import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class SDCInstancesMigrationTest{ @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private NodeTemplateOperation nodeTemplateOperation; @Test public void testFailedMigration(){ - SDCInstancesMigration instancesMigration = new SDCInstancesMigration(titanDao, nodeTemplateOperation); - when(titanDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR)); + SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation); + when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.right( + JanusGraphOperationStatus.GENERAL_ERROR)); MigrationResult migrate = instancesMigration.migrate(); MigrationStatus migrationStatus = migrate.getMigrationStatus(); @@ -45,7 +46,7 @@ public class SDCInstancesMigrationTest{ } @Test public void testSuccessMigration(){ - SDCInstancesMigration instancesMigration = new SDCInstancesMigration(titanDao, nodeTemplateOperation); + SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation); List list = new ArrayList<>(); GraphVertex vertexOrig = new GraphVertex(); Map jsonComposition = new HashMap<>(); @@ -59,7 +60,7 @@ public class SDCInstancesMigrationTest{ vertexOrig.setType(ComponentTypeEnum.SERVICE); list.add(vertexOrig); - when(titanDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.left(list)); + when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.left(list)); when(nodeTemplateOperation.createInstanceEdge(vertexOrig, instance)).thenReturn(StorageOperationStatus.OK); MigrationResult migrate = instancesMigration.migrate(); diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java index 0ea3b91083..1d3e7612ac 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java @@ -10,18 +10,18 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.asdctool.migration.core.DBVersion; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; @RunWith(MockitoJUnitRunner.class) public class SdcArchiveMigrationTest { @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; SdcArchiveMigration sdcArchiveMigration = null; @Before public void setUp() throws Exception { - sdcArchiveMigration = new SdcArchiveMigration(titanDao); + sdcArchiveMigration = new SdcArchiveMigration(janusGraphDao); } @Test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java new file mode 100644 index 0000000000..93606e271d --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.asdctool.servlets; + +import org.janusgraph.core.JanusGraph; +import org.junit.Test; + +import javax.ws.rs.core.Response; +import java.io.File; + +public class ExportImportJanusGraphServletTest { + + private ExportImportJanusGraphServlet createTestSubject() { + return new ExportImportJanusGraphServlet(); + } + + @Test(expected=NullPointerException.class) + public void testExport() throws Exception { + ExportImportJanusGraphServlet testSubject; + File janusGraphPropertiesFile = null; + String exportGraphMetadata = ""; + Response result; + + // default test + testSubject = createTestSubject(); + result = testSubject.export(janusGraphPropertiesFile, exportGraphMetadata); + } + + @Test(expected=NullPointerException.class) + public void testExportGraph() throws Exception { + ExportImportJanusGraphServlet testSubject; + JanusGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportGraph(graph, outputDirectory); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java deleted file mode 100644 index 9f104632dd..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openecomp.sdc.asdctool.servlets; - -import com.thinkaurelius.titan.core.TitanGraph; -import org.junit.Test; - -import javax.ws.rs.core.Response; -import java.io.File; - -public class ExportImportTitanServletTest { - - private ExportImportTitanServlet createTestSubject() { - return new ExportImportTitanServlet(); - } - - @Test(expected=NullPointerException.class) - public void testExport() throws Exception { - ExportImportTitanServlet testSubject; - File titanPropertiesFile = null; - String exportGraphMetadata = ""; - Response result; - - // default test - testSubject = createTestSubject(); - result = testSubject.export(titanPropertiesFile, exportGraphMetadata); - } - - @Test(expected=NullPointerException.class) - public void testExportGraph() throws Exception { - ExportImportTitanServlet testSubject; - TitanGraph graph = null; - String outputDirectory = ""; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.exportGraph(graph, outputDirectory); - } -} \ No newline at end of file -- cgit 1.2.3-korg