Search in sources :

Example 6 with DualGraph

use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.

the class BasicFindPluginNGTest 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, vxId2, 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();
    }
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph)

Example 7 with DualGraph

use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.

the class ResetStatePluginNGTest method setupGraph.

private void setupGraph() {
    graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
    try {
        WritableGraph wg = graph.getWritableGraph("", true);
        final int stateId = FindViewConcept.MetaAttribute.FINDVIEW_STATE.ensure(wg);
        ArrayList<Attribute> attributeList = new ArrayList<>();
        BasicFindReplaceParameters parameters = new BasicFindReplaceParameters("label name", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
        FindResultsList foundResult = new FindResultsList(2, parameters, graph.getId());
        wg.setObjectValue(stateId, 0, foundResult);
        wg.commit();
    } catch (final InterruptedException ex) {
        Exceptions.printStackTrace(ex);
        Thread.currentThread().interrupt();
    }
}
Also used : Attribute(au.gov.asd.tac.constellation.graph.Attribute) ArrayList(java.util.ArrayList) BasicFindReplaceParameters(au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters) FindResultsList(au.gov.asd.tac.constellation.views.find2.utilities.FindResultsList) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph)

Example 8 with DualGraph

use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.

the class AdvancedSearchPluginNGTest 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);
        dimV = VisualConcept.VertexAttribute.DIMMED.ensure(wg);
        colorV = VisualConcept.VertexAttribute.COLOR.ensure(wg);
        iconV = VisualConcept.VertexAttribute.BACKGROUND_ICON.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);
        dateTimeT = TemporalConcept.TransactionAttribute.DATETIME.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.setBooleanValue(dimV, vxId1, true);
        wg.setObjectValue(colorV, vxId1, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId1, IconManager.getIcon("Flag.Australia"));
        vxId2 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId2, false);
        wg.setStringValue(labelV, vxId2, "label name");
        wg.setStringValue(identifierV, vxId2, "identifer name");
        wg.setFloatValue(xV, vxId2, 1);
        wg.setBooleanValue(dimV, vxId2, true);
        wg.setObjectValue(colorV, vxId2, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId2, IconManager.getIcon("Flag.Australia"));
        vxId3 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId3, false);
        wg.setStringValue(labelV, vxId3, "label name");
        wg.setStringValue(identifierV, vxId3, "identifer name");
        wg.setFloatValue(xV, vxId3, 1);
        wg.setBooleanValue(dimV, vxId3, true);
        wg.setObjectValue(colorV, vxId3, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId3, IconManager.getIcon("Flag.Australia"));
        vxId4 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId4, false);
        wg.setStringValue(labelV, vxId4, "label name");
        wg.setStringValue(identifierV, vxId4, "identifer name");
        wg.setFloatValue(xV, vxId4, 1);
        wg.setBooleanValue(dimV, vxId4, true);
        wg.setObjectValue(colorV, vxId4, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId4, IconManager.getIcon("Flag.Australia"));
        vxId5UpperCase = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId5UpperCase, false);
        wg.setStringValue(labelV, vxId5UpperCase, "LABEL NAME");
        wg.setStringValue(identifierV, vxId5UpperCase, "IDENTIFIER NAME");
        wg.setFloatValue(xV, vxId5UpperCase, 1);
        wg.setBooleanValue(dimV, vxId5UpperCase, true);
        wg.setObjectValue(colorV, vxId5UpperCase, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId5UpperCase, IconManager.getIcon("Flag.Australia"));
        vxId6 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId6, false);
        wg.setStringValue(labelV, vxId6, "test");
        wg.setStringValue(identifierV, vxId6, "a vertex");
        wg.setFloatValue(xV, vxId6, 1);
        wg.setBooleanValue(dimV, vxId6, true);
        wg.setObjectValue(colorV, vxId6, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId6, IconManager.getIcon("Flag.England"));
        vxId7 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId7, false);
        wg.setStringValue(labelV, vxId7, "experiment");
        wg.setStringValue(identifierV, vxId7, "identifer name");
        wg.setFloatValue(xV, vxId7, 1);
        wg.setBooleanValue(dimV, vxId7, true);
        wg.setObjectValue(colorV, vxId7, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId7, IconManager.getIcon("Flag.England"));
        vxId8 = wg.addVertex();
        wg.setBooleanValue(selectedV, vxId8, false);
        wg.setStringValue(labelV, vxId8, "test");
        wg.setStringValue(identifierV, vxId8, "a node");
        wg.setFloatValue(xV, vxId8, 1);
        wg.setBooleanValue(dimV, vxId8, true);
        wg.setObjectValue(colorV, vxId8, ConstellationColor.BLUE);
        wg.setObjectValue(iconV, vxId8, IconManager.getIcon("Flag.Australia"));
        txId1 = wg.addTransaction(vxId1, vxId1, false);
        wg.setBooleanValue(selectedT, txId1, false);
        wg.setStringValue(labelT, txId1, "label name");
        wg.setStringValue(identiferT, txId1, "identifer name");
        wg.setFloatValue(widthT, txId1, 1);
        wg.setObjectValue(dateTimeT, txId1, testTime);
        txId2 = wg.addTransaction(vxId1, vxId2, false);
        wg.setBooleanValue(selectedT, txId2, false);
        wg.setStringValue(labelT, txId2, "label name");
        wg.setStringValue(identiferT, txId2, "identifer name");
        wg.setFloatValue(widthT, txId2, 1);
        wg.setObjectValue(dateTimeT, txId2, testTime);
        txId3 = wg.addTransaction(vxId1, vxId3, false);
        wg.setBooleanValue(selectedT, txId3, false);
        wg.setStringValue(labelT, txId3, "label name");
        wg.setStringValue(identiferT, txId3, "identifer name");
        wg.setFloatValue(widthT, txId3, 1);
        wg.setObjectValue(dateTimeT, txId3, plus1YearTestTime);
        txId4 = wg.addTransaction(vxId1, vxId4, false);
        wg.setBooleanValue(selectedT, txId4, false);
        wg.setStringValue(labelT, txId4, "label name");
        wg.setStringValue(identiferT, txId4, "identifer name");
        wg.setFloatValue(widthT, txId4, 1);
        wg.setObjectValue(dateTimeT, txId4, plus2YearTestTime);
        wg.commit();
    } catch (final InterruptedException ex) {
        Exceptions.printStackTrace(ex);
        Thread.currentThread().interrupt();
    }
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph)

Example 9 with DualGraph

use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.

the class ReplaceTabNGTest 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);
        replaceTab.attributes.add(labelAttributeV);
        // The identifier attribute
        attributeInt = wg.getAttribute(elementType, 2);
        identifierAttributeV = new GraphAttribute(wg, attributeInt);
        replaceTab.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();
    }
}
Also used : GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Example 10 with DualGraph

use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.

the class BooleanCriteriaPanelNGTest 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 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);
        dimV = VisualConcept.VertexAttribute.DIMMED.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.setBooleanValue(dimV, vxId1, true);
        wg.commit();
    } catch (final InterruptedException ex) {
        Exceptions.printStackTrace(ex);
        Thread.currentThread().interrupt();
    }
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph)

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