use of au.gov.asd.tac.constellation.graph.processing.GraphRecordStore 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.processing.GraphRecordStore 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.processing.GraphRecordStore in project constellation by constellation-app.
the class CompareGraphPluginNGTest method testCompareGraphsWithAnExtraNodeOnCompareGraph.
@Test
public void testCompareGraphsWithAnExtraNodeOnCompareGraph() throws Exception {
// mimic GraphRecordStoreUtilities.getAll()
final GraphRecordStore original = new GraphRecordStore();
original.add();
original.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
original.add();
original.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx1");
original.add();
original.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
original.set(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL, "vx1");
final GraphRecordStore compare = new GraphRecordStore();
compare.add();
compare.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
compare.add();
compare.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx1");
compare.add();
compare.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
compare.set(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL, "vx1");
compare.add();
compare.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx2");
final Set<String> vertexPrimaryKeys = new HashSet<>();
vertexPrimaryKeys.add(VisualConcept.VertexAttribute.LABEL.getName());
final List<String> ignoreVertexAttributes = new ArrayList<>();
final List<String> ignoreTransactionAttributes = new ArrayList<>();
ignoreVertexAttributes.add("[id]");
ignoreTransactionAttributes.add("[id]");
final CompareGraphPlugin instance = new CompareGraphPlugin();
final GraphRecordStore changes = instance.compareGraphs("", original, compare, vertexPrimaryKeys, new HashSet<>(), ignoreVertexAttributes, ignoreTransactionAttributes, ADDED_COLOUR, REMOVED_COLOUR, CHANGED_COLOUR, UNCHANGED_COLOUR);
System.out.println(changes.toStringVerbose());
assertEquals(changes.size(), 4);
changes.reset();
changes.next();
assertEquals("vx0", changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL));
assertEquals(CompareGraphPlugin.UNCHANGED, changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE));
changes.next();
assertEquals("vx1", changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL));
assertEquals(CompareGraphPlugin.UNCHANGED, changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE));
changes.next();
assertEquals("vx0", changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL));
assertEquals("vx1", changes.get(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL));
assertEquals(CompareGraphPlugin.UNCHANGED, changes.get(GraphRecordStoreUtilities.TRANSACTION + CompareGraphPlugin.COMPARE_ATTRIBUTE));
changes.next();
assertEquals("vx2", changes.get(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL));
assertEquals(CompareGraphPlugin.ADDED, changes.get(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE));
}
use of au.gov.asd.tac.constellation.graph.processing.GraphRecordStore 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());
}
}
use of au.gov.asd.tac.constellation.graph.processing.GraphRecordStore in project constellation by constellation-app.
the class CompareGraphPluginNGTest method testCompareGraphsWithIdenticalGraphs.
/**
* Test of compareGraphs method, of class CompareGraphPlugin.
*
* @throws java.lang.Exception
*/
@Test
public void testCompareGraphsWithIdenticalGraphs() throws Exception {
final GraphRecordStore original = new GraphRecordStore();
original.add();
original.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
original.set(GraphRecordStoreUtilities.DESTINATION + VisualConcept.VertexAttribute.LABEL, "vx1");
final List<String> ignoreVertexAttributes = new ArrayList<>();
final List<String> ignoreTransactionAttributes = new ArrayList<>();
ignoreVertexAttributes.add("[id]");
ignoreTransactionAttributes.add("[id]");
final CompareGraphPlugin instance = new CompareGraphPlugin();
final GraphRecordStore changes = instance.compareGraphs("", original, original, new HashSet<>(), new HashSet<>(), ignoreVertexAttributes, ignoreTransactionAttributes, ADDED_COLOUR, REMOVED_COLOUR, CHANGED_COLOUR, UNCHANGED_COLOUR);
assertEquals(changes.size(), 1);
final GraphRecordStore expResult = new GraphRecordStore();
expResult.add();
expResult.set(GraphRecordStoreUtilities.SOURCE + CompareGraphPlugin.COMPARE_ATTRIBUTE, CompareGraphPlugin.UNCHANGED);
expResult.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.OVERLAY_COLOR, UNCHANGED_COLOUR);
expResult.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.LABEL, "vx0");
System.out.println(expResult.toStringVerbose());
System.out.println(changes.toStringVerbose());
assertEquals(changes, expResult);
}
Aggregations