use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class GraphAttributePluginNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graph2 = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
graphMap.put(graph2.getId(), graph2);
try {
WritableGraph wg = graph.getWritableGraph("", true);
// Create Selected Attributes
selectedV = VisualConcept.VertexAttribute.SELECTED.ensure(wg);
labelV = VisualConcept.VertexAttribute.LABEL.ensure(wg);
identifierV = VisualConcept.VertexAttribute.IDENTIFIER.ensure(wg);
xV = VisualConcept.VertexAttribute.X.ensure(wg);
selectedT = VisualConcept.TransactionAttribute.SELECTED.ensure(wg);
labelT = VisualConcept.TransactionAttribute.LABEL.ensure(wg);
identiferT = VisualConcept.TransactionAttribute.IDENTIFIER.ensure(wg);
widthT = VisualConcept.TransactionAttribute.WIDTH.ensure(wg);
vxId1 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId1, false);
wg.setStringValue(labelV, vxId1, "label name");
wg.setStringValue(identifierV, vxId1, "identifer name");
wg.setIntValue(xV, vxId1, 1);
vxId2 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId2, false);
wg.setStringValue(labelV, vxId2, "label name");
wg.setStringValue(identifierV, vxId2, "identifer name");
wg.setIntValue(xV, vxId1, 1);
vxId3 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId3, false);
wg.setStringValue(labelV, vxId3, "label name");
wg.setStringValue(identifierV, vxId3, "identifer name");
wg.setIntValue(xV, vxId3, 1);
vxId4 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId4, false);
wg.setStringValue(labelV, vxId4, "label name");
wg.setStringValue(identifierV, vxId4, "identifer name");
wg.setIntValue(xV, vxId4, 1);
txId1 = wg.addTransaction(vxId1, vxId1, false);
wg.setBooleanValue(selectedT, txId1, false);
wg.setStringValue(labelT, txId1, "label name");
wg.setStringValue(identiferT, txId1, "identifer name");
wg.setIntValue(widthT, txId1, 1);
txId2 = wg.addTransaction(vxId1, vxId2, false);
wg.setBooleanValue(selectedT, txId2, false);
wg.setStringValue(labelT, txId2, "label name");
wg.setStringValue(identiferT, txId2, "identifer name");
wg.setIntValue(widthT, txId2, 1);
txId3 = wg.addTransaction(vxId1, vxId3, false);
wg.setBooleanValue(selectedT, txId3, false);
wg.setStringValue(labelT, txId3, "label name");
wg.setStringValue(identiferT, txId3, "identifer name");
wg.setIntValue(widthT, txId3, 1);
txId4 = wg.addTransaction(vxId1, vxId4, false);
wg.setBooleanValue(selectedT, txId4, false);
wg.setStringValue(labelT, txId4, "label name");
wg.setStringValue(identiferT, txId4, "identifer name");
wg.setIntValue(widthT, txId4, 1);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class ReplacePluginNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graph2 = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
graphMap.put(graph2.getId(), graph2);
try {
WritableGraph wg = graph.getWritableGraph("", true);
// Create Selected Attributes
selectedV = VisualConcept.VertexAttribute.SELECTED.ensure(wg);
labelV = VisualConcept.VertexAttribute.LABEL.ensure(wg);
identifierV = VisualConcept.VertexAttribute.IDENTIFIER.ensure(wg);
xV = VisualConcept.VertexAttribute.X.ensure(wg);
selectedT = VisualConcept.TransactionAttribute.SELECTED.ensure(wg);
labelT = VisualConcept.TransactionAttribute.LABEL.ensure(wg);
identiferT = VisualConcept.TransactionAttribute.IDENTIFIER.ensure(wg);
widthT = VisualConcept.TransactionAttribute.WIDTH.ensure(wg);
vxId1 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId1, false);
wg.setStringValue(labelV, vxId1, "label name");
wg.setStringValue(identifierV, vxId1, "identifer name");
wg.setIntValue(xV, vxId1, 1);
vxId2 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId2, false);
wg.setStringValue(labelV, vxId2, "label name");
wg.setStringValue(identifierV, vxId2, "identifer name");
wg.setIntValue(xV, vxId1, 1);
vxId3 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId3, false);
wg.setStringValue(labelV, vxId3, "label name");
wg.setStringValue(identifierV, vxId3, "identifer name");
wg.setIntValue(xV, vxId3, 1);
vxId4 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId4, false);
wg.setStringValue(labelV, vxId4, "label name");
wg.setStringValue(identifierV, vxId4, "identifer name");
wg.setIntValue(xV, vxId4, 1);
vxId5UpperCase = wg.addVertex();
wg.setBooleanValue(selectedV, vxId5UpperCase, false);
wg.setStringValue(labelV, vxId5UpperCase, "LABEL NAME");
wg.setStringValue(identifierV, vxId5UpperCase, "IDENTIFIER NAME");
wg.setIntValue(xV, vxId5UpperCase, 1);
vxId6 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId6, false);
wg.setStringValue(labelV, vxId6, "test");
wg.setStringValue(identifierV, vxId6, "a vertex");
wg.setIntValue(xV, vxId6, 1);
vxId7 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId7, false);
wg.setStringValue(labelV, vxId7, "experiment");
wg.setStringValue(identifierV, vxId7, "a vertex");
wg.setIntValue(xV, vxId7, 1);
vxId8 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId8, false);
wg.setStringValue(labelV, vxId8, "test");
wg.setStringValue(identifierV, vxId8, "a node");
wg.setIntValue(xV, vxId8, 1);
txId1 = wg.addTransaction(vxId1, vxId1, false);
wg.setBooleanValue(selectedT, txId1, false);
wg.setStringValue(labelT, txId1, "label name");
wg.setStringValue(identiferT, txId1, "identifer name");
wg.setIntValue(widthT, txId1, 1);
txId2 = wg.addTransaction(vxId1, vxId2, false);
wg.setBooleanValue(selectedT, txId2, false);
wg.setStringValue(labelT, txId2, "label name");
wg.setStringValue(identiferT, txId2, "identifer name");
wg.setIntValue(widthT, txId2, 1);
txId3 = wg.addTransaction(vxId1, vxId3, false);
wg.setBooleanValue(selectedT, txId3, false);
wg.setStringValue(labelT, txId3, "label name");
wg.setStringValue(identiferT, txId3, "identifer name");
wg.setIntValue(widthT, txId3, 1);
txId4 = wg.addTransaction(vxId1, vxId4, false);
wg.setBooleanValue(selectedT, txId4, false);
wg.setStringValue(labelT, txId4, "label name");
wg.setStringValue(identiferT, txId4, "identifer name");
wg.setIntValue(widthT, txId4, 1);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class CompareGraphPluginNGTest method testReadWithNodesInDifferentOrder.
@Test
public void testReadWithNodesInDifferentOrder() {
int vx0, vx1, vx2, vx3, tx0;
int labelAttribute;
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
final StoreGraph originalGraph = new StoreGraph(schema);
labelAttribute = originalGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "Name", "", "", null);
originalGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
vx0 = originalGraph.addVertex();
vx1 = originalGraph.addVertex();
vx2 = originalGraph.addVertex();
vx3 = originalGraph.addVertex();
tx0 = originalGraph.addTransaction(vx0, vx1, true);
originalGraph.setStringValue(labelAttribute, vx0, "vx0");
originalGraph.setStringValue(labelAttribute, vx1, "vx1");
originalGraph.setStringValue(labelAttribute, vx2, "vx2");
originalGraph.setStringValue(labelAttribute, vx3, "vx3");
final StoreGraph compareGraph = new StoreGraph(schema);
labelAttribute = compareGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "Name", "", "", null);
compareGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
vx0 = compareGraph.addVertex();
vx1 = compareGraph.addVertex();
vx2 = compareGraph.addVertex();
vx3 = compareGraph.addVertex();
tx0 = compareGraph.addTransaction(vx3, vx2, true);
compareGraph.setStringValue(labelAttribute, vx0, "vx3");
compareGraph.setStringValue(labelAttribute, vx1, "vx2");
compareGraph.setStringValue(labelAttribute, vx2, "vx1");
compareGraph.setStringValue(labelAttribute, vx3, "vx0");
final GraphRecordStore originalAll = GraphRecordStoreUtilities.getAll(originalGraph, false, true);
final GraphRecordStore compareAll = GraphRecordStoreUtilities.getAll(compareGraph, false, true);
final Set<String> vertexPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.VERTEX);
final Set<String> transactionPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.TRANSACTION);
final List<String> ignoreVertexAttributes = new ArrayList<>();
final List<String> ignoreTransactionAttributes = new ArrayList<>();
ignoreVertexAttributes.add("[id]");
ignoreTransactionAttributes.add("[id]");
// debug
System.out.println("originalAll ==>\n" + originalAll.toStringVerbose());
System.out.println("compareAll ==>\n" + compareAll.toStringVerbose());
final CompareGraphPlugin instance = new CompareGraphPlugin();
GraphRecordStore changes = new GraphRecordStore();
try {
changes = instance.compareGraphs("", originalAll, compareAll, vertexPrimaryKeys, transactionPrimaryKeys, ignoreVertexAttributes, ignoreTransactionAttributes, ADDED_COLOUR, REMOVED_COLOUR, CHANGED_COLOUR, UNCHANGED_COLOUR);
System.out.println("changes ==>\n" + changes.toStringVerbose());
assertEquals(changes.size(), 5);
} catch (PluginException ex) {
Assert.fail(ex.getLocalizedMessage());
}
try {
final Graph finalGraph = instance.createComparisonGraph(new DualGraph(originalGraph, true), changes);
} catch (InterruptedException ex) {
Assert.fail(ex.getLocalizedMessage());
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class CompareGraphPluginNGTest method testReadWithTransactionsInBothDirections.
@Test
public void testReadWithTransactionsInBothDirections() {
int vx0, vx1, vx2, vx3, tx0, tx1;
int labelAttribute;
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
final StoreGraph originalGraph = new StoreGraph(schema);
labelAttribute = VisualConcept.VertexAttribute.LABEL.ensure(originalGraph);
originalGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
vx0 = originalGraph.addVertex();
vx1 = originalGraph.addVertex();
vx2 = originalGraph.addVertex();
vx3 = originalGraph.addVertex();
tx0 = originalGraph.addTransaction(vx0, vx1, true);
tx1 = originalGraph.addTransaction(vx1, vx2, true);
originalGraph.setStringValue(labelAttribute, vx0, "vx0");
originalGraph.setStringValue(labelAttribute, vx1, "vx1");
originalGraph.setStringValue(labelAttribute, vx2, "vx2");
originalGraph.setStringValue(labelAttribute, vx3, "vx3");
final StoreGraph compareGraph = new StoreGraph(schema);
labelAttribute = VisualConcept.VertexAttribute.LABEL.ensure(compareGraph);
compareGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
vx0 = compareGraph.addVertex();
vx1 = compareGraph.addVertex();
vx2 = compareGraph.addVertex();
vx3 = compareGraph.addVertex();
tx0 = compareGraph.addTransaction(vx0, vx1, true);
// this is the change
tx1 = compareGraph.addTransaction(vx2, vx1, true);
compareGraph.setStringValue(labelAttribute, vx0, "vx0");
compareGraph.setStringValue(labelAttribute, vx1, "vx1");
compareGraph.setStringValue(labelAttribute, vx2, "vx2");
compareGraph.setStringValue(labelAttribute, vx3, "vx3");
final GraphRecordStore originalAll = GraphRecordStoreUtilities.getAll(originalGraph, false, true);
final GraphRecordStore compareAll = GraphRecordStoreUtilities.getAll(compareGraph, false, true);
final Set<String> vertexPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.VERTEX);
final Set<String> transactionPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.TRANSACTION);
final List<String> ignoreVertexAttributes = new ArrayList<>();
final List<String> ignoreTransactionAttributes = new ArrayList<>();
ignoreVertexAttributes.add("[id]");
ignoreTransactionAttributes.add("[id]");
// debug
System.out.println("originalAll ==>\n" + originalAll.toStringVerbose());
System.out.println("compareAll ==>\n" + compareAll.toStringVerbose());
final CompareGraphPlugin instance = new CompareGraphPlugin();
GraphRecordStore changes = new GraphRecordStore();
try {
changes = instance.compareGraphs("", originalAll, compareAll, vertexPrimaryKeys, transactionPrimaryKeys, ignoreVertexAttributes, ignoreTransactionAttributes, ADDED_COLOUR, REMOVED_COLOUR, CHANGED_COLOUR, UNCHANGED_COLOUR);
System.out.println("changes ==>\n" + changes.toStringVerbose());
assertEquals(changes.size(), 7);
} catch (PluginException ex) {
Assert.fail(ex.getLocalizedMessage());
}
changes.reset();
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx2");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx3");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx2");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.REMOVED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx2");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.ADDED);
try {
final Graph finalGraph = instance.createComparisonGraph(new DualGraph(originalGraph, true), changes);
SaveGraphUtilities.saveGraphToTemporaryDirectory(finalGraph, "testReadWithTransactionsInBothDirections", true);
} catch (InterruptedException | IOException ex) {
Assert.fail(ex.getLocalizedMessage());
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class CompareGraphPluginNGTest method testReadWithMultipleChangesToVerticies.
@Test
public void testReadWithMultipleChangesToVerticies() {
int vx0, vx1, vx2, vx3, vx4, vx5, tx0, tx1, tx2;
int labelAttribute, fooAttribute, lineStyleAttribute;
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
final StoreGraph originalGraph = new StoreGraph(schema);
labelAttribute = originalGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "Label", "", "", null);
lineStyleAttribute = VisualConcept.TransactionAttribute.LINE_STYLE.ensure(originalGraph);
fooAttribute = originalGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "foo", "", "", null);
originalGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
originalGraph.setPrimaryKey(GraphElementType.TRANSACTION, lineStyleAttribute);
vx0 = originalGraph.addVertex();
vx1 = originalGraph.addVertex();
vx2 = originalGraph.addVertex();
vx3 = originalGraph.addVertex();
vx4 = originalGraph.addVertex();
tx0 = originalGraph.addTransaction(vx0, vx1, true);
tx1 = originalGraph.addTransaction(vx0, vx4, true);
originalGraph.setStringValue(labelAttribute, vx0, "vx0");
originalGraph.setStringValue(labelAttribute, vx1, "vx1");
originalGraph.setStringValue(labelAttribute, vx2, "vx2");
originalGraph.setStringValue(labelAttribute, vx3, "vx3");
originalGraph.setStringValue(labelAttribute, vx4, "vx4");
final StoreGraph compareGraph = new StoreGraph(schema);
labelAttribute = compareGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "Label", "", "", null);
fooAttribute = compareGraph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "foo", "", "", null);
lineStyleAttribute = VisualConcept.TransactionAttribute.LINE_STYLE.ensure(compareGraph);
compareGraph.setPrimaryKey(GraphElementType.VERTEX, labelAttribute);
compareGraph.setPrimaryKey(GraphElementType.TRANSACTION, lineStyleAttribute);
vx0 = compareGraph.addVertex();
vx1 = compareGraph.addVertex();
vx2 = compareGraph.addVertex();
// vx3 = compareGraph.addVertex();
vx4 = compareGraph.addVertex();
vx5 = compareGraph.addVertex();
tx0 = compareGraph.addTransaction(vx0, vx1, true);
// tx1 = originalGraph.addTransaction(vx0, vx4, true); // # change is REMOVE
// # change is ADDED
tx2 = compareGraph.addTransaction(vx0, vx5, true);
compareGraph.setStringValue(labelAttribute, vx0, "vx0");
compareGraph.setStringValue(labelAttribute, vx1, "vx1");
compareGraph.setStringValue(labelAttribute, vx2, "vx2");
// compareGraph.setStringValue(labelAttribute, vx3, "vx3"); // # change is REMOVE
compareGraph.setStringValue(labelAttribute, vx4, "vx4");
// # change is CHANGE
compareGraph.setStringValue(fooAttribute, vx4, "bar");
// # change is ADDED
compareGraph.setStringValue(labelAttribute, vx5, "vx5");
final GraphRecordStore originalAll = GraphRecordStoreUtilities.getAll(originalGraph, false, true);
final GraphRecordStore compareAll = GraphRecordStoreUtilities.getAll(compareGraph, false, true);
final Set<String> vertexPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.VERTEX);
final Set<String> transactionPrimaryKeys = PrimaryKeyUtilities.getPrimaryKeyNames(originalGraph, GraphElementType.TRANSACTION);
final List<String> ignoreVertexAttributes = new ArrayList<>();
ignoreVertexAttributes.add("[id]");
final List<String> ignoreTransactionAttributes = new ArrayList<>();
ignoreTransactionAttributes.add("[id]");
// debug
System.out.println("originalAll ==>\n" + originalAll.toStringVerbose());
System.out.println("compareAll ==>\n" + compareAll.toStringVerbose());
final CompareGraphPlugin instance = new CompareGraphPlugin();
Graph finalGraph = null;
GraphRecordStore changes = new GraphRecordStore();
try {
changes = instance.compareGraphs("", originalAll, compareAll, vertexPrimaryKeys, transactionPrimaryKeys, ignoreVertexAttributes, ignoreTransactionAttributes, ADDED_COLOUR, REMOVED_COLOUR, CHANGED_COLOUR, UNCHANGED_COLOUR);
System.out.println("changes ==>\n" + changes.toStringVerbose());
assertEquals(changes.size(), 9);
finalGraph = instance.createComparisonGraph(new DualGraph(originalGraph, true), changes);
} catch (InterruptedException | PluginException ex) {
Assert.fail(ex.getLocalizedMessage());
}
changes.reset();
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx2");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx3");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.REMOVED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx4");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.CHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx1");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.UNCHANGED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx4");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.REMOVED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx5");
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.ADDED);
changes.next();
assertEquals(changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL), "vx0");
assertEquals(changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL), "vx5");
assertEquals(changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE), CompareGraphPlugin.ADDED);
final ReadableGraph rg = finalGraph.getReadableGraph();
try {
int vxCount = rg.getVertexCount();
int txCount = rg.getTransactionCount();
assertEquals(vxCount, 6);
assertEquals(txCount, 3);
} finally {
rg.release();
}
try {
SaveGraphUtilities.saveGraphToTemporaryDirectory(originalGraph, "originalGraph");
SaveGraphUtilities.saveGraphToTemporaryDirectory(compareGraph, "compareGraph");
SaveGraphUtilities.saveGraphToTemporaryDirectory(finalGraph, "finalGraph", true);
} catch (IOException | InterruptedException ex) {
Assert.fail(ex.getLocalizedMessage());
}
}
Aggregations