use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class MergeNodeNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
graph = new DualGraph(null);
WritableGraph wg = graph.getWritableGraph("add", true);
try {
attrX = wg.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "x", "x", 0.0, null);
if (attrX == Graph.NOT_FOUND) {
fail();
}
attrY = wg.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "y", "y", 0.0, null);
if (attrY == Graph.NOT_FOUND) {
fail();
}
attrZ = wg.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "z", "z", 0.0, null);
if (attrZ == Graph.NOT_FOUND) {
fail();
}
vAttrId = wg.addAttribute(GraphElementType.VERTEX, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
if (vAttrId == Graph.NOT_FOUND) {
fail();
}
tAttrId = wg.addAttribute(GraphElementType.TRANSACTION, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
if (tAttrId == Graph.NOT_FOUND) {
fail();
}
vxId1 = wg.addVertex();
wg.setFloatValue(attrX, vxId1, 1.0f);
wg.setFloatValue(attrY, vxId1, 1.0f);
wg.setBooleanValue(vAttrId, vxId1, false);
vxId2 = wg.addVertex();
wg.setFloatValue(attrX, vxId2, 5.0f);
wg.setFloatValue(attrY, vxId2, 1.0f);
wg.setBooleanValue(vAttrId, vxId2, false);
vxId3 = wg.addVertex();
wg.setFloatValue(attrX, vxId3, 1.0f);
wg.setFloatValue(attrY, vxId3, 5.0f);
wg.setBooleanValue(vAttrId, vxId3, false);
vxId4 = wg.addVertex();
wg.setFloatValue(attrX, vxId4, 5.0f);
wg.setFloatValue(attrY, vxId4, 5.0f);
wg.setBooleanValue(vAttrId, vxId4, false);
vxId5 = wg.addVertex();
wg.setFloatValue(attrX, vxId5, 10.0f);
wg.setFloatValue(attrY, vxId5, 10.0f);
wg.setBooleanValue(vAttrId, vxId5, false);
vxId6 = wg.addVertex();
wg.setFloatValue(attrX, vxId6, 15.0f);
wg.setFloatValue(attrY, vxId6, 15.0f);
wg.setBooleanValue(vAttrId, vxId6, false);
vxId7 = wg.addVertex();
wg.setFloatValue(attrX, vxId7, 100.0f);
wg.setFloatValue(attrY, vxId7, 100.0f);
wg.setBooleanValue(vAttrId, vxId7, false);
txId1 = wg.addTransaction(vxId1, vxId2, false);
txId2 = wg.addTransaction(vxId1, vxId3, false);
txId3 = wg.addTransaction(vxId2, vxId4, true);
txId4 = wg.addTransaction(vxId4, vxId2, true);
txId5 = wg.addTransaction(vxId5, vxId6, false);
} finally {
wg.commit();
}
}
Aggregations