Search in sources :

Example 66 with DualGraph

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();
    }
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)66 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)41 Test (org.testng.annotations.Test)30 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)21 Graph (au.gov.asd.tac.constellation.graph.Graph)19 Schema (au.gov.asd.tac.constellation.graph.schema.Schema)18 ArrayList (java.util.ArrayList)13 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)10 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)10 BeforeMethod (org.testng.annotations.BeforeMethod)9 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)7 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)6 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)5 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)4 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)3 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)3 SchemaFactory (au.gov.asd.tac.constellation.graph.schema.SchemaFactory)3 VisualConcept (au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept)3 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)3 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)3