use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class FindNGTest 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();
}
vNameAttr = wg.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "name", "descr", "", null);
if (vNameAttr == Graph.NOT_FOUND) {
fail();
}
tNameAttr = wg.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, "name", "descr", "", null);
if (tNameAttr == Graph.NOT_FOUND) {
fail();
}
vSelAttr = wg.addAttribute(GraphElementType.VERTEX, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
if (vSelAttr == Graph.NOT_FOUND) {
fail();
}
tSelAttr = wg.addAttribute(GraphElementType.TRANSACTION, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
if (tSelAttr == Graph.NOT_FOUND) {
fail();
}
vxId1 = wg.addVertex();
wg.setFloatValue(attrX, vxId1, 1.0f);
wg.setFloatValue(attrY, vxId1, 1.1f);
wg.setBooleanValue(vSelAttr, vxId1, false);
wg.setStringValue(vNameAttr, vxId1, "name1");
vxId2 = wg.addVertex();
wg.setFloatValue(attrX, vxId2, 2.0f);
wg.setFloatValue(attrY, vxId2, 2.2f);
wg.setBooleanValue(vSelAttr, vxId2, true);
wg.setStringValue(vNameAttr, vxId2, "name2");
vxId3 = wg.addVertex();
wg.setFloatValue(attrX, vxId3, 3.0f);
wg.setFloatValue(attrY, vxId3, 3.3f);
wg.setBooleanValue(vSelAttr, vxId3, false);
wg.setStringValue(vNameAttr, vxId3, "name3");
vxId4 = wg.addVertex();
wg.setFloatValue(attrX, vxId4, 4.0f);
wg.setFloatValue(attrY, vxId4, 4.4f);
wg.setBooleanValue(vSelAttr, vxId4, true);
wg.setStringValue(vNameAttr, vxId4, "name4");
vxId5 = wg.addVertex();
wg.setFloatValue(attrX, vxId5, 5.0f);
wg.setFloatValue(attrY, vxId5, 5.5f);
wg.setBooleanValue(vSelAttr, vxId5, false);
wg.setStringValue(vNameAttr, vxId5, "name5");
vxId6 = wg.addVertex();
wg.setFloatValue(attrX, vxId6, 6.0f);
wg.setFloatValue(attrY, vxId6, 6.60f);
wg.setBooleanValue(vSelAttr, vxId6, true);
wg.setStringValue(vNameAttr, vxId6, "name6");
vxId7 = wg.addVertex();
wg.setFloatValue(attrX, vxId7, 7.0f);
wg.setFloatValue(attrY, vxId7, 7.7f);
wg.setBooleanValue(vSelAttr, vxId7, false);
wg.setStringValue(vNameAttr, vxId7, "name7");
txId1 = wg.addTransaction(vxId1, vxId2, false);
wg.setBooleanValue(tSelAttr, txId1, false);
wg.setStringValue(tNameAttr, txId1, "name101");
txId2 = wg.addTransaction(vxId1, vxId3, false);
wg.setBooleanValue(tSelAttr, txId2, true);
wg.setStringValue(tNameAttr, txId2, "name102");
txId3 = wg.addTransaction(vxId2, vxId4, true);
wg.setBooleanValue(tSelAttr, txId3, false);
wg.setStringValue(tNameAttr, txId3, "name103");
txId4 = wg.addTransaction(vxId4, vxId2, true);
wg.setBooleanValue(tSelAttr, txId4, true);
wg.setStringValue(tNameAttr, txId4, "name104");
txId5 = wg.addTransaction(vxId5, vxId6, false);
wg.setBooleanValue(tSelAttr, txId5, false);
wg.setStringValue(tNameAttr, txId5, "name105");
} finally {
wg.commit();
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class FindViewControllerNGTest method setupEmptyGraph.
private void setupEmptyGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class ColourCriteriaPanelNGTest 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);
colorV = VisualConcept.VertexAttribute.COLOR.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.setFloatValue(xV, vxId1, 1);
wg.setObjectValue(colorV, vxId1, ConstellationColor.BLUE);
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 FloatCriteriaPanelNGTest 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.setFloatValue(xV, vxId1, 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 BasicFindTabNGTest 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);
/**
* Get the label and the identifier vertex attributes and add them
* to the attributes list
*/
GraphElementType elementType = GraphElementType.VERTEX;
// The label attribute
int attributeInt = wg.getAttribute(elementType, 1);
labelAttributeV = new GraphAttribute(wg, attributeInt);
basicFindTab.attributes.add(labelAttributeV);
// The identifier attribute
attributeInt = wg.getAttribute(elementType, 2);
identifierAttributeV = new GraphAttribute(wg, attributeInt);
basicFindTab.attributes.add(identifierAttributeV);
elementType = GraphElementType.TRANSACTION;
attributeInt = wg.getAttribute(elementType, 1);
labelAttributeT = new GraphAttribute(wg, attributeInt);
attributeInt = wg.getAttribute(elementType, 2);
identifierAttributeT = new GraphAttribute(wg, attributeInt);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
Aggregations