import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import com.att.eelf.configuration.Configuration;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.thinkaurelius.titan.core.TitanEdge;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
public class DataGrooming {
boolean executeFinalCommit = false;
Set<String> deleteCandidateList = new LinkedHashSet<>();
Set<String> processedVertices = new LinkedHashSet<>();
- TitanTransaction g = null;
- TitanTransaction g2 = null;
+ Graph g = null;
+ Graph g2 = null;
try {
AAIConfig.init();
String targetDir = AAIConstants.AAI_HOME + AAIConstants.AAI_FILESEP
if ( (thisNtDeleteCount > 0) && singleCommits ) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
}
ArrayList<Vertex> vertList = new ArrayList<>();
- Iterable<? extends Vertex> vIt3 = g.query().vertices();
- Iterator<? extends Vertex> vItor3 = vIt3.iterator();
+ Iterator<Vertex> vItor3 = g.traversal().V();
// Gotta hold these in a List - or else HBase times out as you cycle
// through these
while (vItor3.hasNext()) {
}
if( ! ghost2CheckOff ){
- Vertex connectedVert = g2.getVertex(vIdLong);
+ Vertex connectedVert = g2.traversal().V(vIdLong).next();
if( connectedVert == null ) {
LOGGER.warn( "GHOST2 -- got NULL when doing getVertex for vid = " + vIdLong);
cantGetUsingVid = true;
// it is still a ghost since even though we can get data about it using the FIRST graph
// object.
try {
- ghost2 = g.getVertex(vIdLong);
+ ghost2 = g.traversal().V(vIdLong).next();
}
catch( Exception ex){
LOGGER.warn( "GHOST2 -- Could not get the ghost info for a bad edge for vtxId = " + vIdLong, ex);
}
if (singleCommits) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
deleteCount++;
e.remove();
if (singleCommits) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
deleteCount++;
}
if( ! ghost2CheckOff ){
- Vertex connectedVert = g2.getVertex(vIdLong);
+ Vertex connectedVert = g2.traversal().V(vIdLong).next();
if( connectedVert == null ) {
cantGetUsingVid = true;
LOGGER.info( "GHOST2 -- got NULL when doing getVertex for vid = " + vIdLong);
// If we can get this ghost with the other graph-object, then get it -- it's still a ghost
try {
- ghost2 = g.getVertex(vIdLong);
+ ghost2 = g.traversal().V(vIdLong).next();
}
catch( Exception ex){
LOGGER.warn( "GHOST2 -- Could not get the ghost info for a bad edge for vtxId = " + vIdLong, ex);
}
if (singleCommits) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
deleteCount++;
e.remove();
if (singleCommits) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
deleteCount++;
}
}
- if (g != null && !g.isClosed()) {
+ if (g != null && g.tx().isOpen()) {
// Any changes that worked correctly should have already done
// their commits.
try {
if (executeFinalCommit) {
- g.commit();
+ g.tx().commit();
}
- g.rollback();
+ g.tx().rollback();
} catch (Exception ex) {
// Don't throw anything because Titan sometimes is just saying that the graph is already closed
LOGGER.warn("WARNING from final graphTransaction.rollback()", ex);
}
}
- if (g2 != null && !g2.isClosed()) {
+ if (g2 != null && g2.tx().isOpen()) {
// Any changes that worked correctly should have already done
// their commits.
try {
- g2.rollback();
+ g2.tx().rollback();
} catch (Exception ex) {
// Don't throw anything because Titan sometimes is just saying that the graph is already closed
LOGGER.warn("WARNING from final graphTransaction2.rollback()", ex);
* @return the array list
*/
private static List<String> checkAndProcessDupes(String transId,
- String fromAppId, TitanTransaction g, GraphTraversalSource source, String version, String nType,
+ String fromAppId, Graph g, GraphTraversalSource source, String version, String nType,
List<Vertex> passedVertList, Boolean dupeFixOn,
Set<String> deleteCandidateList, Boolean singleCommits,
ArrayList<String> alreadyFoundDupeGroups, Loader loader ) {
* @param singleCommits the single commits
* @return the boolean
*/
- private static Boolean deleteNonKeepersIfAppropriate(TitanTransaction g,
+ private static Boolean deleteNonKeepersIfAppropriate(Graph g,
String dupeInfoString, String vidToKeep,
Set<String> deleteCandidateList, Boolean singleCommits) {
long longVertId = Long
.parseLong(thisVid);
Vertex vtx = g
- .getVertex(longVertId);
+ .traversal().V(longVertId).next();
vtx.remove();
if (singleCommits) {
// NOTE - the singleCommits option is not used in normal processing
- g.commit();
+ g.tx().commit();
g = AAIGraph.getInstance().getGraph().newTransaction();
}
} catch (Exception e) {
retArr.add("No IN edges were found for this vertex. ");
}
while( eI.hasNext() ){
- TitanEdge ed = (TitanEdge) eI.next();
+ Edge ed = eI.next();
String lab = ed.label();
- Vertex vtx = ed.otherVertex(tVert);
+ Vertex vtx;
+ if (tVert.equals(ed.inVertex())) {
+ vtx = ed.outVertex();
+ } else {
+ vtx = ed.inVertex();
+ }
if( vtx == null ){
retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
}
retArr.add("No OUT edges were found for this vertex. ");
}
while( eI.hasNext() ){
- TitanEdge ed = (TitanEdge) eI.next();
+ Edge ed = eI.next();
String lab = ed.label();
- Vertex vtx = ed.otherVertex(tVert);
+ Vertex vtx;
+ if (tVert.equals(ed.inVertex())) {
+ vtx = ed.outVertex();
+ } else {
+ vtx = ed.inVertex();
+ }
if( vtx == null ){
retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
}
import java.util.Set;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-
import org.openecomp.aai.db.props.AAIProperties;
-import org.openecomp.aai.exceptions.AAIException;
import org.openecomp.aai.introspection.Introspector;
import org.openecomp.aai.introspection.Loader;
import org.openecomp.aai.introspection.LoaderFactory;
import org.openecomp.aai.serialization.db.EdgeRule;
import org.openecomp.aai.serialization.db.EdgeRules;
import org.openecomp.aai.util.AAIConfig;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.common.collect.Multimap;
String imsg = "-- About to call graphMgmt commit";
System.out.println(imsg);
LOGGER.info(imsg);
-
+
graphMgmt.commit();
}// End of loadSchemaIntoTitan()
import java.util.Properties;
import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-
import org.openecomp.aai.dbgen.SchemaGenerator;
import org.openecomp.aai.exceptions.AAIException;
import org.openecomp.aai.util.AAIConstants;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
import com.thinkaurelius.titan.core.schema.TitanManagement;
/**
try {
String location = System.getProperty("snapshot.location");
logAndPrint(logger, "Loading snapshot to inmemory graph.");
- TitanTransaction transaction = graph.newTransaction();
+ Graph transaction = graph.newTransaction();
transaction.io(IoCore.graphson()).readGraph(location);
- transaction.commit();
+ transaction.tx().commit();
logAndPrint(logger, "Snapshot loaded to inmemory graph.");
} catch (IOException e) {
graph.close();
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-
import org.openecomp.aai.dbmap.DBConnectionType;
import org.openecomp.aai.introspection.Loader;
import org.openecomp.aai.serialization.db.TitanGraphSingleton;
-import com.thinkaurelius.titan.core.TitanVertex;
public class TitanDBEngine extends TransactionalGraphEngine {
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-
import org.openecomp.aai.dbmap.DBConnectionType;
import org.openecomp.aai.introspection.Loader;
import org.openecomp.aai.query.builder.GremlinTraversal;
import org.openecomp.aai.serialization.db.GraphSingleton;
import org.openecomp.aai.serialization.engines.query.GraphTraversalQueryEngine;
import org.openecomp.aai.serialization.engines.query.QueryEngine;
+
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
import com.thinkaurelius.titan.core.schema.TitanManagement;
public abstract class TransactionalGraphEngine {
protected QueryStyle style = null;
protected final DBConnectionType connectionType;
protected final Loader loader;
- protected TitanTransaction currentTx = null;
+ protected Graph currentTx = null;
protected GraphTraversalSource currentTraversal = null;
protected GraphTraversalSource readOnlyTraversal = null;
private final Admin admin;
return queryBuilder;
}
- public TitanTransaction startTransaction() {
+ public Graph startTransaction() {
if (this.tx() == null) {
this.currentTx = this.getGraph().newTransaction();
this.currentTraversal = this.tx().traversal();
public void rollback() {
if (this.tx() != null) {
- this.tx().rollback();
+ this.tx().tx().rollback();
this.currentTx = null;
this.currentTraversal = null;
this.readOnlyTraversal = null;
}
public void commit() {
if (this.tx() != null) {
- this.tx().commit();
+ this.tx().tx().commit();
this.currentTx = null;
this.currentTraversal = null;
this.readOnlyTraversal = null;
}
}
- public TitanTransaction tx() {
+ public Graph tx() {
return this.currentTx;
}
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.openecomp.aai.exceptions.AAIException;
import org.slf4j.MDC;
-import org.openecomp.aai.exceptions.AAIException;
import com.att.eelf.configuration.Configuration;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.thinkaurelius.titan.core.TitanEdge;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
-import com.thinkaurelius.titan.core.TitanVertex;
System.exit(1);
}
String propertyName = args[0];
- TitanTransaction graph = null;
+ Graph graph = null;
try {
AAIConfig.init();
* @param logger the logger
* @return the boolean
*/
- public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, TitanTransaction graph,
+ public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, Graph graph,
String propertyName, EELFLogger logger ){
// Note - property can be found in more than one nodetype
int propCount = 0;
int dupeCount = 0;
- Iterable <?> vertItr = graph.query().has(propertyName).vertices();
- Iterator <?> vertItor = vertItr.iterator();
+ Iterator<Vertex> vertItor = graph.traversal().V().has(propertyName);
while( vertItor.hasNext() ){
propCount++;
- TitanVertex v = (TitanVertex)vertItor.next();
+ Vertex v = vertItor.next();
String thisVid = v.id().toString();
Object val = (v.<Object>property(propertyName)).orElse(null);
if( valuesAndVidHash.containsKey(val) ){
for( int i = 0; i < vidArr.length; i++ ){
String vidString = vidArr[i];
Long idLong = Long.valueOf(vidString);
- TitanVertex tvx = (TitanVertex)graph.getVertex(idLong);
+ Vertex tvx = graph.traversal().V(idLong).next();
showPropertiesAndEdges( TRANSID, FROMAPPID, tvx, logger );
}
}
}
finally {
if( graph != null ){
- graph.rollback();
+ graph.tx().rollback();
}
}
* @param tVert the t vert
* @param logger the logger
*/
- private static void showPropertiesAndEdges( String transId, String fromAppId, TitanVertex tVert,
+ private static void showPropertiesAndEdges( String transId, String fromAppId, Vertex tVert,
EELFLogger logger ){
if( tVert == null ){
logAndPrint(logger, "No edges were found for this vertex. ");
}
while( eI.hasNext() ){
- TitanEdge ed = (TitanEdge) eI.next();
+ Edge ed = eI.next();
String lab = ed.label();
- TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert);
+ Vertex vtx;
+ if (tVert.equals(ed.inVertex())) {
+ vtx = ed.outVertex();
+ } else {
+ vtx = ed.inVertex();
+ }
if( vtx == null ){
logAndPrint(logger, " >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
}
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;
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 {
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);
assertEquals("value populated", "testValue", obj.getValue("persona-model-ver"));
- g.rollback();
+ g.tx().rollback();
}
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);
assertEquals("value populated", "key2", obj.getValue("model-version-id"));
- g.rollback();
+ g.tx().rollback();
}
@Test
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);
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();
}
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);
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);
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);
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;
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 {
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);
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();
}
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);
.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();
}
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);
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();
}
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);
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();
}
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);
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();
}
}
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;
@Ignore
public class DbAliasTest {
+
+
+
private TitanGraph graph;
private final Version version = Version.v9;
private final ModelType introspectorFactoryType = ModelType.MOXY;
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";
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();
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));
-
+
}
-
-
+
}