summaryrefslogtreecommitdiffstats
path: root/aai-core/src/test/java
diff options
context:
space:
mode:
authorMuller, Andrew (am8383) <am8383@ems.att.com>2017-08-11 14:56:15 -0400
committerMuller, Andrew (am8383) <am8383@us.att.com>2017-08-11 14:59:40 -0400
commitcfa1951bcb9636da23d51fcdf89a5171b37096ba (patch)
tree142ccfbece5da840d73b3f014c774a680811e357 /aai-core/src/test/java
parent977df13b04fc6979a16afc229ae9644f29c704d6 (diff)
[AAI-154 Amsterdam] Check in titan refactor
Change-Id: I277417cfa608228f107ac94e0253a83667602040 Signed-off-by: Muller, Andrew (am8383) <am8383@us.att.com>
Diffstat (limited to 'aai-core/src/test/java')
-rw-r--r--aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java22
-rw-r--r--aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java24
-rw-r--r--aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java23
3 files changed, 35 insertions, 34 deletions
diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java
index 80b2c77d..0a66c481 100644
--- a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java
+++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java
@@ -33,13 +33,13 @@ import java.net.URISyntaxException;
import org.apache.commons.io.IOUtils;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-
import org.openecomp.aai.db.props.AAIProperties;
import org.openecomp.aai.dbmap.DBConnectionType;
import org.openecomp.aai.exceptions.AAIException;
@@ -56,9 +56,9 @@ import org.openecomp.aai.serialization.engines.TitanDBEngine;
import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper;
import org.openecomp.aai.util.AAIConstants;
+
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
@Ignore
public class DataCopyTest {
@@ -118,7 +118,7 @@ public class DataCopyTest {
obj.setValue("model-version-id", "key2");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -132,7 +132,7 @@ public class DataCopyTest {
assertEquals("value populated", "testValue", obj.getValue("persona-model-ver"));
- g.rollback();
+ g.tx().rollback();
}
@@ -147,7 +147,7 @@ public class DataCopyTest {
obj.setValue("persona-model-version", "testValue");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -161,7 +161,7 @@ public class DataCopyTest {
assertEquals("value populated", "key2", obj.getValue("model-version-id"));
- g.rollback();
+ g.tx().rollback();
}
@Test
@@ -172,7 +172,7 @@ public class DataCopyTest {
System.out.println(obj.marshal(true));
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.tx()).thenReturn(g);
when(spy.asAdmin()).thenReturn(adminSpy);
@@ -186,7 +186,7 @@ public class DataCopyTest {
assertEquals("nested value populated", "testValue", g.traversal().V().has("service-instance-id", "nested-instance-key").next().property("persona-model-version").orElse(""));
- g.rollback();
+ g.tx().rollback();
}
@@ -200,7 +200,7 @@ public class DataCopyTest {
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -224,7 +224,7 @@ public class DataCopyTest {
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -246,7 +246,7 @@ public class DataCopyTest {
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java
index 9232d1b5..ef3c3e47 100644
--- a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java
+++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java
@@ -31,13 +31,13 @@ import java.net.URISyntaxException;
import java.util.List;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-
import org.openecomp.aai.db.props.AAIProperties;
import org.openecomp.aai.dbmap.DBConnectionType;
import org.openecomp.aai.exceptions.AAIException;
@@ -53,9 +53,9 @@ import org.openecomp.aai.serialization.engines.TitanDBEngine;
import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper;
import org.openecomp.aai.util.AAIConstants;
+
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
@Ignore
public class DataLinkTest {
@@ -120,7 +120,7 @@ public class DataLinkTest {
obj.setValue("route-target-role", "key2");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -136,7 +136,7 @@ public class DataLinkTest {
assertEquals("route-target vertex found", true, traversal.V()
.has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "key1").has("route-target-role", "key2").has("linked", true).hasNext());
- g.rollback();
+ g.tx().rollback();
}
@@ -150,7 +150,7 @@ public class DataLinkTest {
obj.setValue("route-target-role", "modifyRoleKey2");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -167,7 +167,7 @@ public class DataLinkTest {
.has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext());
assertEquals("previous link removed", true, traversal.V()
.has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNot("linked").hasNext());
- g.rollback();
+ g.tx().rollback();
}
@@ -179,7 +179,7 @@ public class DataLinkTest {
obj.setValue("vpn-id", "deleteKey");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -194,7 +194,7 @@ public class DataLinkTest {
assertEquals("route-target vertex not found", false, traversal.V()
.has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "deleteTargetKey").has("route-target-role", "deleteRoleKey").has("linked", true).hasNext());
- g.rollback();
+ g.tx().rollback();
}
@@ -206,7 +206,7 @@ public class DataLinkTest {
obj.setValue("vpn-id", "getKey");
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.asAdmin()).thenReturn(adminSpy);
when(adminSpy.getTraversalSource()).thenReturn(traversal);
@@ -220,7 +220,7 @@ public class DataLinkTest {
runner.execute(obj, self);
assertEquals("both properties have been populated in target object", true, obj.getValue("global-route-target").equals("getTargetKey") && obj.getValue("route-target-role").equals("getRoleKey"));
- g.rollback();
+ g.tx().rollback();
}
@@ -241,7 +241,7 @@ public class DataLinkTest {
targets.add(routeTargetTwo.getUnderlyingObject());
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
- TitanTransaction g = graph.newTransaction();
+ Graph g = graph.newTransaction();
GraphTraversalSource traversal = g.traversal();
when(spy.tx()).thenReturn(g);
when(spy.asAdmin()).thenReturn(adminSpy);
@@ -259,7 +259,7 @@ public class DataLinkTest {
assertEquals("first route target put has linked", true, routeTargetOneV.property(AAIProperties.LINKED).orElse(false));
assertEquals("second route target put does not have linked", false, routeTargetTwoV.property(AAIProperties.LINKED).orElse(false));
- g.rollback();
+ g.tx().rollback();
}
}
diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java
index c96450c2..cc419c67 100644
--- a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java
+++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java
@@ -34,7 +34,6 @@ import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.After;
import org.junit.Before;
@@ -58,6 +57,9 @@ import com.thinkaurelius.titan.core.TitanGraph;
@Ignore
public class DbAliasTest {
+
+
+
private TitanGraph graph;
private final Version version = Version.v9;
private final ModelType introspectorFactoryType = ModelType.MOXY;
@@ -76,13 +78,13 @@ public class DbAliasTest {
type,
loader);
}
-
+
@After
public void tearDown() {
graph.tx().rollback();
graph.close();
}
-
+
@Test
public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException {
final String property = "persona-model-customization-id";
@@ -107,17 +109,17 @@ public class DbAliasTest {
if (map.containsKey(PropertyMetadata.DB_ALIAS)) {
dbPropertyName = map.get(PropertyMetadata.DB_ALIAS);
}
-
+
assertEquals("dbAlias is ", "model-customization-id", dbPropertyName);
assertEquals("dbAlias property exists", "hello", v.property(dbPropertyName).orElse(""));
assertEquals("model property does not", "missing", v.property(property).orElse("missing"));
-
+
}
-
+
@Test
public void checkOnRead() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException, MalformedURLException {
final String property = "persona-model-customization-id";
-
+
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
Vertex v = graph.traversal().addV("vnf-id", "key1", "model-customization-id", "hello").next();
@@ -129,10 +131,9 @@ public class DbAliasTest {
DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
Introspector obj = loader.introspectorFromName("generic-vnf");
serializer.dbToObject(Collections.singletonList(v), obj, 0, true, "false");
-
+
assertEquals("dbAlias property exists", "hello", obj.getValue(property));
-
+
}
-
-
+
}