aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao/src/test/java')
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java70
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java545
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java329
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java606
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java332
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java11
6 files changed, 921 insertions, 972 deletions
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java
index b69165410b..4b9bc33c29 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java
@@ -25,46 +25,45 @@ import com.datastax.driver.core.Cluster.Builder;
import com.datastax.driver.core.Session;
import com.datastax.driver.mapping.MappingManager;
import fj.data.Either;
-import mockit.Deencapsulation;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.T;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.utils.CassandraTestHelper;
import org.openecomp.sdc.be.utils.DAOConfDependentTest;
-public class CassandraClientTest extends DAOConfDependentTest {
+class CassandraClientTest extends DAOConfDependentTest {
private CassandraClient createTestSubject() {
return new CassandraClient();
}
- @BeforeClass
+ @BeforeAll
public static void startServer() {
CassandraTestHelper.startServer();
}
@Test
- public void testSetLocalDc() throws Exception {
+ void testSetLocalDc() throws Exception {
CassandraClient testSubject;
Builder mock = Mockito.mock(Cluster.Builder.class);
Mockito.when(mock.withLoadBalancingPolicy(Mockito.any())).thenReturn(new Builder());
// default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "setLocalDc", new Object[]{Cluster.Builder.class});
+ Assertions.assertNotNull(testSubject);
- ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .setLocalDataCenter("mock");
+ ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setLocalDataCenter("mock");
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "setLocalDc", mock);
+ Assertions.assertNotNull(testSubject);
}
@Test
- public void testEnableSsl() throws Exception {
+ void testEnableSsl() throws Exception {
CassandraClient testSubject;
Cluster.Builder clusterBuilder = null;
@@ -72,39 +71,46 @@ public class CassandraClientTest extends DAOConfDependentTest {
Mockito.when(mock.withSSL()).thenReturn(new Builder());
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(false);
- // default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "enableSsl", mock);
+ Assertions.assertNotNull(testSubject);
+ Assertions.assertNull(System.getProperty("javax.net.ssl.trustStore"));
+ Assertions.assertNull(System.getProperty("javax.net.ssl.trustStorePassword"));
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(true);
- // default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "enableSsl", mock);
+ Assertions.assertNotNull(testSubject);
+ Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStore"));
+ Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStorePassword"));
+
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setTruststorePath(null);
- ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .setTruststorePassword(null);
- Deencapsulation.invoke(testSubject, "enableSsl", mock);
+ ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setTruststorePassword(null);
+ testSubject = createTestSubject();
+ Assertions.assertNotNull(testSubject);
+ Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStore"));
+ Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStorePassword"));
}
@Test
- public void testEnableAuthentication() throws Exception {
+ void testEnableAuthentication() throws Exception {
CassandraClient testSubject;
Builder mock = Mockito.mock(Cluster.Builder.class);
Mockito.when(mock.withCredentials(Mockito.any(), Mockito.any())).thenReturn(new Builder());
- // default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "enableAuthentication", Cluster.Builder.class);
+ Assertions.assertNotNull(testSubject);
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setAuthenticate(true);
- Deencapsulation.invoke(testSubject, "enableAuthentication", mock);
+ testSubject = createTestSubject();
+ Assertions.assertNotNull(testSubject);
+
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setUsername(null);
ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setPassword(null);
- Deencapsulation.invoke(testSubject, "enableAuthentication", mock);
+ testSubject = createTestSubject();
+ Assertions.assertNotNull(testSubject);
}
@Test
- public void testConnect() throws Exception {
+ void testConnect() throws Exception {
CassandraClient testSubject;
String keyspace = "";
Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> result;
@@ -112,10 +118,11 @@ public class CassandraClientTest extends DAOConfDependentTest {
// default test
testSubject = createTestSubject();
result = testSubject.connect(keyspace);
+ Assertions.assertNotNull(result);
}
@Test
- public void testSave() throws Exception {
+ void testSave() throws Exception {
CassandraClient testSubject;
T entity = null;
Class<T> clazz = null;
@@ -125,10 +132,11 @@ public class CassandraClientTest extends DAOConfDependentTest {
// default test
testSubject = createTestSubject();
result = testSubject.save(entity, clazz, manager);
+ Assertions.assertNotNull(result);
}
@Test
- public void testGetById() throws Exception {
+ void testGetById() throws Exception {
CassandraClient testSubject;
String id = "";
Class<T> clazz = null;
@@ -138,10 +146,11 @@ public class CassandraClientTest extends DAOConfDependentTest {
// default test
testSubject = createTestSubject();
result = testSubject.getById(id, clazz, manager);
+ Assertions.assertNotNull(result);
}
@Test
- public void testDelete() throws Exception {
+ void testDelete() throws Exception {
CassandraClient testSubject;
String id = "";
Class<T> clazz = null;
@@ -151,24 +160,27 @@ public class CassandraClientTest extends DAOConfDependentTest {
// default test
testSubject = createTestSubject();
result = testSubject.delete(id, clazz, manager);
+ Assertions.assertNotNull(result);
}
@Test
- public void testIsConnected() throws Exception {
+ void testIsConnected() throws Exception {
CassandraClient testSubject;
boolean result;
// default test
testSubject = createTestSubject();
result = testSubject.isConnected();
+ Assertions.assertTrue(result);
}
@Test
- public void testCloseClient() throws Exception {
+ void testCloseClient() throws Exception {
CassandraClient testSubject;
// default test
testSubject = createTestSubject();
testSubject.closeClient();
+ Assertions.assertNotNull(testSubject);
}
}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java
new file mode 100644
index 0000000000..a745567ab1
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java
@@ -0,0 +1,545 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.dao.janusgraph;
+
+import fj.data.Either;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.utils.DAOConfDependentTest;
+
+class JanusGraphDaoMockTest extends DAOConfDependentTest {
+
+ @InjectMocks
+ private JanusGraphDao testSubject;
+
+ @Mock
+ private JanusGraphClient janusGraphClient;
+
+ @BeforeEach
+ void BeforeEach() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ void testCommit() throws Exception {
+ JanusGraphOperationStatus result;
+
+ // default test
+ result = testSubject.commit();
+ }
+
+ @Test
+ void testRollback() throws Exception {
+ JanusGraphOperationStatus result;
+
+ // default test
+ result = testSubject.rollback();
+ }
+
+ @Test
+ void testGetGraph() throws Exception {
+
+ Either<JanusGraph, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.getGraph();
+ }
+
+ @Test
+ void testCreateVertex() throws Exception {
+
+ GraphVertex graphVertex = new GraphVertex();
+ graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ JanusGraph tg = Mockito.mock(JanusGraph.class);
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
+ // default test
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(tg.addVertex()).thenReturn(value2);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+ result = testSubject.createVertex(graphVertex);
+ }
+
+ @Test
+ void testCreateVertexErrorGetGraph() throws Exception {
+
+ GraphVertex graphVertex = new GraphVertex();
+ graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ // default test
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+ result = testSubject.createVertex(graphVertex);
+ }
+
+ @Test
+ void testCreateVertexException() throws Exception {
+
+ GraphVertex graphVertex = new GraphVertex();
+ graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ JanusGraph tg = Mockito.mock(JanusGraph.class);
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
+ // default test
+ Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+ result = testSubject.createVertex(graphVertex);
+ }
+
+ @Test
+ void testGetVertexByPropertyAndLabel() throws Exception {
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR));
+ result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock",
+ VertexTypeEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testGetVertexById_1Exception() throws Exception {
+
+ String id = "mock";
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ JanusGraph tg = Mockito.mock(JanusGraph.class);
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
+ // default test
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(tg.addVertex()).thenReturn(value2);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // test 1
+ result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
+ // Assert.assertEquals(null, result);
+ }
+
+ @Test
+ void testGetVertexById_1GraphClosed() throws Exception {
+
+ String id = "mock";
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ Object b;
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ // default test
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // test 1
+ result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
+ // Assert.assertEquals(null, result);
+ }
+
+ @Test
+ void testSetVertexProperties_1() throws Exception {
+ Vertex vertex = Mockito.mock(Vertex.class);
+ Map<String, Object> properties = new HashMap<>();
+ properties.put("mock", "mock");
+
+ // default test
+ testSubject.setVertexProperties(vertex, properties);
+ }
+
+ @Test
+ void testParseVertexProperties() throws Exception {
+
+ GraphVertex graphVertex = new GraphVertex();
+ JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
+ graphVertex.setVertex(vertex);
+ JsonParseFlagEnum parseFlag = null;
+
+ // default test
+
+ testSubject.parseVertexProperties(graphVertex, JsonParseFlagEnum.NoParse);
+ }
+
+ @Test
+ void testCreateEdge() throws Exception {
+
+ GraphVertex from = Mockito.mock(GraphVertex.class);
+ GraphVertex to = Mockito.mock(GraphVertex.class);
+
+ JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(from.getVertex()).thenReturn(value);
+ Mockito.when(to.getVertex()).thenReturn(value);
+ Map<EdgePropertyEnum, Object> properties = new HashMap<>();
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
+ from = new GraphVertex();
+ to = new GraphVertex();
+ result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
+ }
+
+ @Test
+ void testSetEdgeProperties() throws Exception {
+
+ Element element = Mockito.mock(Element.class);
+ Map<EdgePropertyEnum, Object> properties = new HashMap<>();
+
+ // test 1
+
+ properties.put(EdgePropertyEnum.STATE, "mock");
+ testSubject.setEdgeProperties(element, properties);
+ }
+
+ @Test
+ void testGetByCriteria() throws Exception {
+ Map<GraphPropertyEnum, Object> props = new HashMap<>();
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
+
+ JanusGraph tg = Mockito.mock(JanusGraph.class);
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(tg.addVertex()).thenReturn(value2);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props);
+ }
+
+ @Test
+ void testGetByCriteria_1() throws Exception {
+
+ Map<GraphPropertyEnum, Object> props = new HashMap<>();
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse);
+ }
+
+ @Test
+ void testGetCatalogVerticies() throws Exception {
+ Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ // default test
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.getCatalogOrArchiveVerticies(true);
+ }
+
+ @Test
+ void testGetChildVertex() throws Exception {
+
+ GraphVertex parentVertex = new GraphVertex();
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse);
+ }
+
+ @Test
+ void testGetChildVertex_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<Vertex, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testGetParentVertex_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<Vertex, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testGetParentVertecies_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<Vertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.getParentVertices(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testGetChildrenVertecies_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<Vertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.getChildrenVertices(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testDeleteBelongingEdgeByCriteria() throws Exception {
+
+ GraphVertex vertex = null;
+ EdgeLabelEnum label = null;
+ Map<GraphPropertyEnum, Object> properties = null;
+ Either<Edge, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.deleteBelongingEdgeByCriteria(vertex, label, properties);
+ }
+
+ @Test
+ void testDeleteEdge() throws Exception {
+
+ GraphVertex fromVertex = new GraphVertex();
+ GraphVertex toVertex = new GraphVertex();
+ Either<Edge, JanusGraphOperationStatus> result;
+
+ Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
+ JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
+ Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
+
+ // default test
+ result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testDeleteEdgeByDirection() throws Exception {
+ GraphVertex fromVertex = new GraphVertex();
+ JanusGraphOperationStatus result;
+
+ // default test
+ result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testDeleteEdgeByDirectionMock() throws Exception {
+ GraphVertex fromVertex = Mockito.mock(GraphVertex.class);
+ JanusGraphOperationStatus result;
+
+ JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
+ ;
+ Mockito.when(fromVertex.getVertex()).thenReturn(value);
+ Iterator<Edge> value2 = Mockito.mock(Iterator.class);
+ ;
+ Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2);
+ Mockito.when(value2.hasNext()).thenReturn(true, false);
+ Edge value3 = Mockito.mock(Edge.class);
+ ;
+ Mockito.when(value2.next()).thenReturn(value3);
+ // default test
+ result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testUpdateVertex() throws Exception {
+
+ GraphVertex graphVertex = new GraphVertex();
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = testSubject.updateVertex(graphVertex);
+ }
+
+ @Test
+ void testGetVerticesByUniqueIdAndParseFlag() throws Exception {
+
+ Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet = new HashMap<>();
+ Either<Map<String, GraphVertex>, JanusGraphOperationStatus> result;
+
+ // default test
+ result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
+ ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum> value3 = ImmutablePair.of(GraphPropertyEnum.COMPONENT_TYPE, JsonParseFlagEnum.NoParse);
+ verticesToGet.put("mock", value3);
+ try {
+ result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ void testCreateEdge_2() throws Exception {
+
+ Vertex from = null;
+ Vertex to = null;
+ EdgeLabelEnum label = null;
+ Edge edgeToCopy = null;
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = testSubject.createEdge(from, to, label, edgeToCopy);
+ }
+
+ @Test
+ void testReplaceEdgeLabel() throws Exception {
+
+ Vertex fromVertex = null;
+ Vertex toVertex = null;
+ Edge prevEdge = null;
+ EdgeLabelEnum prevLabel = null;
+ EdgeLabelEnum newLabel = null;
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = testSubject.replaceEdgeLabel(fromVertex, toVertex, prevEdge, prevLabel, newLabel);
+ }
+
+ @Test
+ void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
+
+ Vertex vertex = Mockito.mock(Vertex.class);
+ ;
+ Map<GraphPropertyEnum, Object> properties = new HashMap<>();
+ properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock");
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties);
+ }
+
+ //TODO Last
+ @Test
+ void testDisassociateAndDeleteLast() throws Exception {
+
+ GraphVertex vertex = Mockito.mock(GraphVertex.class);
+ JanusGraphOperationStatus result;
+
+ JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
+ Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
+ Edge nextmock = Mockito.mock(Edge.class);
+ Mockito.when(vertex.getVertex()).thenReturn(value);
+ Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
+ Mockito.when(mockiter.hasNext()).thenReturn(true, false);
+ Mockito.when(mockiter.next()).thenReturn(nextmock);
+ Vertex secondVertex = Mockito.mock(Vertex.class);
+ Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
+ Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
+ Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
+ Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
+ Mockito.when(restOfEdges.hasNext()).thenReturn(false);
+
+ // default test
+ result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testDisassociateAndDeleteLastOut() throws Exception {
+
+ GraphVertex vertex = Mockito.mock(GraphVertex.class);
+ JanusGraphOperationStatus result;
+
+ JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
+ Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
+ Edge nextmock = Mockito.mock(Edge.class);
+ Mockito.when(vertex.getVertex()).thenReturn(value);
+ Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
+ Mockito.when(mockiter.hasNext()).thenReturn(true, false);
+ Mockito.when(mockiter.next()).thenReturn(nextmock);
+ Vertex secondVertex = Mockito.mock(Vertex.class);
+ Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
+ Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
+ Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
+ Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
+ Mockito.when(restOfEdges.hasNext()).thenReturn(false);
+
+ // default test
+ result = testSubject.disassociateAndDeleteLast(vertex, Direction.IN, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testDisassociateAndDeleteLastException() throws Exception {
+
+ GraphVertex vertex = Mockito.mock(GraphVertex.class);
+ JanusGraphOperationStatus result;
+
+ Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class);
+
+ // default test
+ result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testMoveEdge() throws Exception {
+
+ GraphVertex vertexA = new GraphVertex();
+ GraphVertex vertexB = new GraphVertex();
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = testSubject.moveEdge(vertexA, vertexB, EdgeLabelEnum.ADDITIONAL_INFORMATION, Direction.BOTH);
+ }
+}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java
new file mode 100644
index 0000000000..fae514a2df
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java
@@ -0,0 +1,329 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.dao.janusgraph;
+
+import fj.data.Either;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.janusgraph.core.JanusGraph;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.utils.DAOConfDependentTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class JanusGraphDaoTest extends DAOConfDependentTest {
+
+ private static final Logger logger = LoggerFactory.getLogger(JanusGraphDaoTest.class);
+ private final JanusGraphDao dao = new JanusGraphDao(new JanusGraphClient(new DAOJanusGraphStrategy()));
+
+ @BeforeEach
+ void init() {
+ dao.janusGraphClient.createGraph();
+ }
+
+ @AfterEach
+ void end() {
+ dao.janusGraphClient.cleanupGraph();
+ }
+
+ @Test
+ void testCreateVertex() throws Exception {
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+ GraphVertex graphVertex = new GraphVertex(VertexTypeEnum.REQUIREMENTS);
+ result = dao.createVertex(graphVertex);
+
+ graphVertex = new GraphVertex();
+ result = dao.createVertex(graphVertex);
+ }
+
+ @Test
+ void testGetVertexByLabel() throws Exception {
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ dao.createVertex(new GraphVertex(VertexTypeEnum.ADDITIONAL_INFORMATION));
+ // default test
+ result = dao.getVertexByLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testCommit() throws Exception {
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = dao.commit();
+ }
+
+ @Test
+ void testRollback() throws Exception {
+
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = dao.rollback();
+ }
+
+ @Test
+ void testGetGraph() throws Exception {
+
+ Either<JanusGraph, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getGraph();
+ }
+
+ @Test
+ void testGetVertexByPropertyAndLabel() throws Exception {
+
+ GraphPropertyEnum name = null;
+ Object value = null;
+ VertexTypeEnum label = null;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getVertexByPropertyAndLabel(name, value, label);
+
+ result = dao.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, new Object(), VertexTypeEnum.ADDITIONAL_INFORMATION);
+ }
+
+ @Test
+ void testGetVertexByPropertyAndLabel_1() throws Exception {
+
+ GraphPropertyEnum name = null;
+ Object value = null;
+ VertexTypeEnum label = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getVertexByPropertyAndLabel(name, value, label, parseFlag);
+ }
+
+ @Test
+ void testGetVertexById() throws Exception {
+
+ String id = "";
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getVertexById(id);
+ }
+
+ @Test
+ void testGetVertexById_1() throws Exception {
+
+ String id = "";
+ JsonParseFlagEnum parseFlag = null;
+ Either<GraphVertex, JanusGraphOperationStatus> result;
+
+ // test 1
+
+ id = null;
+ result = dao.getVertexById(id, parseFlag);
+
+ // test 2
+
+ id = "";
+ result = dao.getVertexById(id, parseFlag);
+ }
+
+ @Test
+ void testGetVertexProperties() throws Exception {
+
+ Element element = null;
+ Map<GraphPropertyEnum, Object> result;
+
+ // test 1
+
+ element = null;
+ result = dao.getVertexProperties(element);
+ }
+
+ @Test
+ void testGetEdgeProperties() throws Exception {
+
+ Element element = null;
+ Map<EdgePropertyEnum, Object> result;
+
+ // test 1
+
+ element = null;
+ result = dao.getEdgeProperties(element);
+ }
+
+ @Test
+ void testGetByCriteria() throws Exception {
+
+ VertexTypeEnum type = null;
+ Map<GraphPropertyEnum, Object> props = null;
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getByCriteria(type, props);
+ }
+
+ @Test
+ void testGetByCriteria_1() throws Exception {
+
+ VertexTypeEnum type = null;
+ Map<GraphPropertyEnum, Object> props = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getByCriteria(type, props, parseFlag);
+ }
+
+ @Test
+ void testGetByCriteria_2() throws Exception {
+
+ VertexTypeEnum type = null;
+ Map<GraphPropertyEnum, Object> props = null;
+ Map<GraphPropertyEnum, Object> hasNotProps = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<GraphVertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getByCriteria(type, props, hasNotProps, parseFlag);
+ }
+
+ @Test
+ void testGetCatalogVerticies() throws Exception {
+
+ Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getCatalogOrArchiveVerticies(true);
+ }
+
+ @Test
+ void testGetParentVertecies_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<Vertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getParentVertices(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testGetChildrenVertecies_1() throws Exception {
+
+ Vertex parentVertex = null;
+ EdgeLabelEnum edgeLabel = null;
+ JsonParseFlagEnum parseFlag = null;
+ Either<List<Vertex>, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getChildrenVertices(parentVertex, edgeLabel, parseFlag);
+ }
+
+ @Test
+ void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
+
+ Vertex vertex = null;
+ Map<GraphPropertyEnum, Object> properties = null;
+ JanusGraphOperationStatus result;
+
+ // default test
+
+ result = dao.updateVertexMetadataPropertiesWithJson(vertex, properties);
+ }
+
+ @Test
+ void testGetProperty() throws Exception {
+ Edge edge = Mockito.mock(Edge.class);
+ ;
+ Object result;
+
+ Property<Object> value = Mockito.mock(Property.class);
+ Mockito.when(edge.property(Mockito.any())).thenReturn(value);
+
+ // default test
+ result = dao.getProperty(edge, EdgePropertyEnum.STATE);
+ }
+
+ @Test
+ void testGetProperty_1() throws Exception {
+ Edge edge = Mockito.mock(Edge.class);
+ ;
+ Object result;
+
+ // default test
+ result = dao.getProperty(edge, EdgePropertyEnum.STATE);
+ }
+
+ @Test
+ void testGetPropertyexception() throws Exception {
+ Edge edge = Mockito.mock(Edge.class);
+ ;
+ Object result;
+
+ Property<Object> value = Mockito.mock(Property.class);
+ Mockito.when(edge.property(Mockito.any())).thenThrow(RuntimeException.class);
+
+ // default test
+ result = dao.getProperty(edge, EdgePropertyEnum.STATE);
+ }
+
+ @Test
+ void testGetBelongingEdgeByCriteria_1() throws Exception {
+
+ String parentId = "";
+ EdgeLabelEnum label = null;
+ Map<GraphPropertyEnum, Object> properties = null;
+ Either<Edge, JanusGraphOperationStatus> result;
+
+ // default test
+
+ result = dao.getBelongingEdgeByCriteria(parentId, label, properties);
+ }
+}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java
deleted file mode 100644
index f1bac6ce1f..0000000000
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java
+++ /dev/null
@@ -1,606 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.dao.jsongraph;
-
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
-import fj.data.Either;
-import mockit.Deencapsulation;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
-import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class JanusGraphDaoMockTest {
-
- @InjectMocks
- JanusGraphDao testSubject;
-
- @Mock
- JanusGraphClient janusGraphClient;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testCommit() throws Exception {
- JanusGraphOperationStatus result;
-
- // default test
- result = testSubject.commit();
- }
-
- @Test
- public void testRollback() throws Exception {
- JanusGraphOperationStatus result;
-
- // default test
- result = testSubject.rollback();
- }
-
- @Test
- public void testGetGraph() throws Exception {
-
- Either<JanusGraph, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.getGraph();
- }
-
- @Test
- public void testCreateVertex() throws Exception {
-
- GraphVertex graphVertex = new GraphVertex();
- graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- JanusGraph tg = Mockito.mock(JanusGraph.class);
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
- // default test
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(tg.addVertex()).thenReturn(value2);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
- result = testSubject.createVertex(graphVertex);
- }
-
- @Test
- public void testCreateVertexErrorGetGraph() throws Exception {
-
- GraphVertex graphVertex = new GraphVertex();
- graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- // default test
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
- result = testSubject.createVertex(graphVertex);
- }
-
- @Test
- public void testCreateVertexException() throws Exception {
-
- GraphVertex graphVertex = new GraphVertex();
- graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- JanusGraph tg = Mockito.mock(JanusGraph.class);
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
- // default test
- Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
- result = testSubject.createVertex(graphVertex);
- }
-
- @Test
- public void testGetVertexByPropertyAndLabel() throws Exception {
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
- Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR));
- result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock",
- VertexTypeEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testGetFirstFoundVertex() throws Exception {
- Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class);
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class);
- Mockito.when(vertices.iterator()).thenReturn(value);
- Mockito.when(value.hasNext()).thenReturn(true);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(value.next()).thenReturn(value2);
-
- // default test
- result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices);
- }
-
- @Test
- public void testGetFirstFoundVertexNotFound() throws Exception {
- Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class);
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class);
- Mockito.when(vertices.iterator()).thenReturn(value);
- Mockito.when(value.hasNext()).thenReturn(false);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(value.next()).thenReturn(value2);
-
- // default test
- result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices);
- }
-
- @Test
- public void testGetVertexById_1Exception() throws Exception {
-
- String id = "mock";
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- JanusGraph tg = Mockito.mock(JanusGraph.class);
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
- // default test
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(tg.addVertex()).thenReturn(value2);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // test 1
- result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
- // Assert.assertEquals(null, result);
- }
-
- @Test
- public void testGetVertexById_1GraphClosed() throws Exception {
-
- String id = "mock";
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- Object b;
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- // default test
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // test 1
- result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
- // Assert.assertEquals(null, result);
- }
-
- @Test
- public void testSetVertexProperties_1() throws Exception {
- Vertex vertex = Mockito.mock(Vertex.class);
- Map<String, Object> properties = new HashMap<>();
- properties.put("mock", "mock");
-
- // default test
- testSubject.setVertexProperties(vertex, properties);
- }
-
- @Test
- public void testCreateAndFill() throws Exception {
-
- JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
- JsonParseFlagEnum parseFlag = null;
- GraphVertex result;
-
- // default test
-
- result = Deencapsulation.invoke(testSubject, "createAndFill", vertex, JsonParseFlagEnum.NoParse);
- }
-
- @Test
- public void testParseVertexProperties() throws Exception {
-
- GraphVertex graphVertex = new GraphVertex();
- JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
- graphVertex.setVertex(vertex);
- JsonParseFlagEnum parseFlag = null;
-
- // default test
-
- testSubject.parseVertexProperties(graphVertex, JsonParseFlagEnum.NoParse);
- }
-
-
- @Test
- public void testCreateEdge() throws Exception {
-
- GraphVertex from = Mockito.mock(GraphVertex.class);
- GraphVertex to = Mockito.mock(GraphVertex.class);
-
- JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(from.getVertex()).thenReturn(value);
- Mockito.when(to.getVertex()).thenReturn(value);
- Map<EdgePropertyEnum, Object> properties = new HashMap<>();
- JanusGraphOperationStatus result;
-
- // default test
-
- result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
- from = new GraphVertex();
- to = new GraphVertex();
- result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
- }
-
- @Test
- public void testSetEdgeProperties() throws Exception {
-
- Element element = Mockito.mock(Element.class);
- Map<EdgePropertyEnum, Object> properties = new HashMap<>();
-
- // test 1
-
- properties.put(EdgePropertyEnum.STATE, "mock");
- testSubject.setEdgeProperties(element, properties);
- }
-
- @Test
- public void testGetByCriteria() throws Exception {
- Map<GraphPropertyEnum, Object> props = new HashMap<>();
- Either<List<GraphVertex>, JanusGraphOperationStatus> result;
-
- JanusGraph tg = Mockito.mock(JanusGraph.class);
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(tg.addVertex()).thenReturn(value2);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props);
- }
-
- @Test
- public void testGetByCriteria_1() throws Exception {
-
- Map<GraphPropertyEnum, Object> props = new HashMap<>();
- Either<List<GraphVertex>, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse);
- }
-
- @Test
- public void testGetCatalogVerticies() throws Exception {
- Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- // default test
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.getCatalogOrArchiveVerticies(true);
- }
-
- @Test
- public void testGetChildVertex() throws Exception {
-
- GraphVertex parentVertex = new GraphVertex();
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse);
- }
-
- @Test
- public void testGetChildVertex_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<Vertex, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag);
- }
-
-
- @Test
- public void testGetParentVertex_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<Vertex, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag);
- }
-
- @Test
- public void testGetParentVertecies_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<Vertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.getParentVertices(parentVertex, edgeLabel, parseFlag);
- }
-
- @Test
- public void testGetAdjacentVerticies() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Direction direction = null;
- Either<List<Vertex>, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
- // default test
- result = Deencapsulation.invoke(testSubject, "getAdjacentVertices",
- new Object[] { Vertex.class, EdgeLabelEnum.class, JsonParseFlagEnum.class, Direction.class });
- }
-
- @Test
- public void testGetChildrenVertecies_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<Vertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.getChildrenVertices(parentVertex, edgeLabel, parseFlag);
- }
-
-
- @Test
- public void testDeleteBelongingEdgeByCriteria() throws Exception {
-
- GraphVertex vertex = null;
- EdgeLabelEnum label = null;
- Map<GraphPropertyEnum, Object> properties = null;
- Either<Edge, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.deleteBelongingEdgeByCriteria(vertex, label, properties);
- }
-
- @Test
- public void testDeleteEdge() throws Exception {
-
- GraphVertex fromVertex = new GraphVertex();
- GraphVertex toVertex = new GraphVertex();
- Either<Edge, JanusGraphOperationStatus> result;
-
- Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
- JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
- Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
-
- // default test
- result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testDeleteEdgeByDirection() throws Exception {
- GraphVertex fromVertex = new GraphVertex();
- JanusGraphOperationStatus result;
-
- // default test
- result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testDeleteEdgeByDirectionMock() throws Exception {
- GraphVertex fromVertex = Mockito.mock(GraphVertex.class);
- JanusGraphOperationStatus result;
-
- JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);;
- Mockito.when(fromVertex.getVertex()).thenReturn(value);
- Iterator<Edge> value2 = Mockito.mock(Iterator.class);;
- Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2);
- Mockito.when(value2.hasNext()).thenReturn(true, false);
- Edge value3 = Mockito.mock(Edge.class);;
- Mockito.when(value2.next()).thenReturn(value3);
- // default test
- result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testUpdateVertex() throws Exception {
-
- GraphVertex graphVertex = new GraphVertex();
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
-
- result = testSubject.updateVertex(graphVertex);
- }
-
- @Test
- public void testGetVerticesByUniqueIdAndParseFlag() throws Exception {
-
- Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet = new HashMap<>();
- Either<Map<String, GraphVertex>, JanusGraphOperationStatus> result;
-
- // default test
- result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
- ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum> value3 = ImmutablePair.of(GraphPropertyEnum.COMPONENT_TYPE, JsonParseFlagEnum.NoParse);
- verticesToGet.put("mock", value3);
- try {
- result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCreateEdge_2() throws Exception {
-
- Vertex from = null;
- Vertex to = null;
- EdgeLabelEnum label = null;
- Edge edgeToCopy = null;
- JanusGraphOperationStatus result;
-
- // default test
-
- result = testSubject.createEdge(from, to, label, edgeToCopy);
- }
-
-
- @Test
- public void testReplaceEdgeLabel() throws Exception {
-
- Vertex fromVertex = null;
- Vertex toVertex = null;
- Edge prevEdge = null;
- EdgeLabelEnum prevLabel = null;
- EdgeLabelEnum newLabel = null;
- JanusGraphOperationStatus result;
-
- // default test
-
- result = testSubject.replaceEdgeLabel(fromVertex, toVertex, prevEdge, prevLabel, newLabel);
- }
-
- @Test
- public void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
-
- Vertex vertex = Mockito.mock(Vertex.class);;
- Map<GraphPropertyEnum, Object> properties = new HashMap<>();
- properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock");
- JanusGraphOperationStatus result;
-
- // default test
-
- result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties);
- }
-
- //TODO Last
- @Test
- public void testDisassociateAndDeleteLast() throws Exception {
-
- GraphVertex vertex = Mockito.mock(GraphVertex.class);
- JanusGraphOperationStatus result;
-
- JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
- Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
- Edge nextmock = Mockito.mock(Edge.class);
- Mockito.when(vertex.getVertex()).thenReturn(value);
- Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
- Mockito.when(mockiter.hasNext()).thenReturn(true, false);
- Mockito.when(mockiter.next()).thenReturn(nextmock);
- Vertex secondVertex = Mockito.mock(Vertex.class);
- Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
- Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
- Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
- Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
- Mockito.when(restOfEdges.hasNext()).thenReturn(false);
-
- // default test
- result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testDisassociateAndDeleteLastOut() throws Exception {
-
- GraphVertex vertex = Mockito.mock(GraphVertex.class);
- JanusGraphOperationStatus result;
-
- JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
- Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
- Edge nextmock = Mockito.mock(Edge.class);
- Mockito.when(vertex.getVertex()).thenReturn(value);
- Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
- Mockito.when(mockiter.hasNext()).thenReturn(true, false);
- Mockito.when(mockiter.next()).thenReturn(nextmock);
- Vertex secondVertex = Mockito.mock(Vertex.class);
- Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
- Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
- Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
- Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
- Mockito.when(restOfEdges.hasNext()).thenReturn(false);
-
- // default test
- result = testSubject.disassociateAndDeleteLast(vertex, Direction.IN, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testDisassociateAndDeleteLastException() throws Exception {
-
- GraphVertex vertex = Mockito.mock(GraphVertex.class);
- JanusGraphOperationStatus result;
-
- Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class);
-
- // default test
- result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testMoveEdge() throws Exception {
-
- GraphVertex vertexA = new GraphVertex();
- GraphVertex vertexB = new GraphVertex();
- JanusGraphOperationStatus result;
-
- // default test
-
- result = testSubject.moveEdge(vertexA, vertexB, EdgeLabelEnum.ADDITIONAL_INFORMATION, Direction.BOTH);
- }
-}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java
deleted file mode 100644
index 2a3a4e8309..0000000000
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.dao.jsongraph;
-
-import org.janusgraph.core.JanusGraph;
-import fj.data.Either;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.utils.DAOConfDependentTest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class JanusGraphDaoTest extends DAOConfDependentTest{
-
-
- private static Logger logger = LoggerFactory.getLogger(JanusGraphDaoTest.class);
- private JanusGraphDao dao = new JanusGraphDao(new JanusGraphClient(new DAOJanusGraphStrategy()));
-
- @Before
- public void init(){
- dao.janusGraphClient.createGraph();
- }
-
- @After
- public void end(){
- dao.janusGraphClient.cleanupGraph();
- }
-
- @Test
- public void testCreateVertex() throws Exception {
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
- GraphVertex graphVertex = new GraphVertex(VertexTypeEnum.REQUIREMENTS);
- result = dao.createVertex(graphVertex);
-
- graphVertex = new GraphVertex();
- result = dao.createVertex(graphVertex);
- }
-
- @Test
- public void testGetVertexByLabel() throws Exception {
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
- result = dao.getVertexByLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testCommit() throws Exception {
- JanusGraphOperationStatus result;
-
- // default test
-
- result = dao.commit();
- }
-
-
- @Test
- public void testRollback() throws Exception {
-
- JanusGraphOperationStatus result;
-
- // default test
-
- result = dao.rollback();
- }
-
- @Test
- public void testGetGraph() throws Exception {
-
- Either<JanusGraph, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getGraph();
- }
-
- @Test
- public void testGetVertexByPropertyAndLabel() throws Exception {
-
- GraphPropertyEnum name = null;
- Object value = null;
- VertexTypeEnum label = null;
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getVertexByPropertyAndLabel(name, value, label);
-
- result = dao.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, new Object(), VertexTypeEnum.ADDITIONAL_INFORMATION);
- }
-
- @Test
- public void testGetVertexByPropertyAndLabel_1() throws Exception {
-
- GraphPropertyEnum name = null;
- Object value = null;
- VertexTypeEnum label = null;
- JsonParseFlagEnum parseFlag = null;
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getVertexByPropertyAndLabel(name, value, label, parseFlag);
- }
-
-
- @Test
- public void testGetVertexById() throws Exception {
-
- String id = "";
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getVertexById(id);
- }
-
- @Test
- public void testGetVertexById_1() throws Exception {
-
- String id = "";
- JsonParseFlagEnum parseFlag = null;
- Either<GraphVertex, JanusGraphOperationStatus> result;
-
- // test 1
-
- id = null;
- result = dao.getVertexById(id, parseFlag);
-
- // test 2
-
- id = "";
- result = dao.getVertexById(id, parseFlag);
- }
-
- @Test
- public void testGetVertexProperties() throws Exception {
-
- Element element = null;
- Map<GraphPropertyEnum, Object> result;
-
- // test 1
-
- element = null;
- result = dao.getVertexProperties(element);
- }
-
-
- @Test
- public void testGetEdgeProperties() throws Exception {
-
- Element element = null;
- Map<EdgePropertyEnum, Object> result;
-
- // test 1
-
- element = null;
- result = dao.getEdgeProperties(element);
- }
-
- @Test
- public void testGetByCriteria() throws Exception {
-
- VertexTypeEnum type = null;
- Map<GraphPropertyEnum, Object> props = null;
- Either<List<GraphVertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getByCriteria(type, props);
- }
-
- @Test
- public void testGetByCriteria_1() throws Exception {
-
- VertexTypeEnum type = null;
- Map<GraphPropertyEnum, Object> props = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<GraphVertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getByCriteria(type, props, parseFlag);
- }
-
-
- @Test
- public void testGetByCriteria_2() throws Exception {
-
- VertexTypeEnum type = null;
- Map<GraphPropertyEnum, Object> props = null;
- Map<GraphPropertyEnum, Object> hasNotProps = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<GraphVertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getByCriteria(type, props, hasNotProps, parseFlag);
- }
-
- @Test
- public void testGetCatalogVerticies() throws Exception {
-
- Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getCatalogOrArchiveVerticies(true);
- }
-
- @Test
- public void testGetParentVertecies_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<Vertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getParentVertices(parentVertex, edgeLabel, parseFlag);
- }
-
- @Test
- public void testGetChildrenVertecies_1() throws Exception {
-
- Vertex parentVertex = null;
- EdgeLabelEnum edgeLabel = null;
- JsonParseFlagEnum parseFlag = null;
- Either<List<Vertex>, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getChildrenVertices(parentVertex, edgeLabel, parseFlag);
- }
-
- @Test
- public void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
-
- Vertex vertex = null;
- Map<GraphPropertyEnum, Object> properties = null;
- JanusGraphOperationStatus result;
-
- // default test
-
- result = dao.updateVertexMetadataPropertiesWithJson(vertex, properties);
- }
-
- @Test
- public void testGetProperty() throws Exception {
- Edge edge = Mockito.mock(Edge.class);;
- Object result;
-
- Property<Object> value = Mockito.mock(Property.class);
- Mockito.when(edge.property(Mockito.any())).thenReturn(value);
-
- // default test
- result = dao.getProperty(edge, EdgePropertyEnum.STATE);
- }
-
- @Test
- public void testGetProperty_1() throws Exception {
- Edge edge = Mockito.mock(Edge.class);;
- Object result;
-
- // default test
- result = dao.getProperty(edge, EdgePropertyEnum.STATE);
- }
-
- @Test
- public void testGetPropertyexception() throws Exception {
- Edge edge = Mockito.mock(Edge.class);;
- Object result;
-
- Property<Object> value = Mockito.mock(Property.class);
- Mockito.when(edge.property(Mockito.any())).thenThrow(RuntimeException.class);
-
- // default test
- result = dao.getProperty(edge, EdgePropertyEnum.STATE);
- }
-
- @Test
- public void testGetBelongingEdgeByCriteria_1() throws Exception {
-
- String parentId = "";
- EdgeLabelEnum label = null;
- Map<GraphPropertyEnum, Object> properties = null;
- Either<Edge, JanusGraphOperationStatus> result;
-
- // default test
-
- result = dao.getBelongingEdgeByCriteria(parentId, label, properties);
- }
-}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java
index b0cc95f290..874b3a63e1 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,12 +20,13 @@
package org.openecomp.sdc.be.utils;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
import org.openecomp.sdc.common.test.BaseConfDependent;
public class DAOConfDependentTest extends BaseConfDependent {
- @BeforeClass
- public static void setupBeforeClass() {
+
+ @BeforeAll
+ static void setupBeforeClass() {
componentName = "catalog-dao";
confPath = "src/test/resources/config";
setUp();