Search in sources :

Example 41 with DualGraph

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

the class SplitNodesPluginNGTest method testUpdateParameters.

/**
 * Test of createParameters method, of class SplitNodesPlugin.
 */
@Test
public void testUpdateParameters() {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters params = instance.createParameters();
    final PluginParameter<SingleChoiceParameterValue> transactionTypeParam = (PluginParameter<SingleChoiceParameterValue>) params.getParameters().get(SplitNodesPlugin.TRANSACTION_TYPE_PARAMETER_ID);
    assertTrue(SingleChoiceParameterType.getOptions(transactionTypeParam).isEmpty());
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    instance.updateParameters(new DualGraph(schema, graph), params);
    // 9 is the number of transaction types in the analytic schema
    assertEquals(SingleChoiceParameterType.getOptions(transactionTypeParam).size(), 9);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) Test(org.testng.annotations.Test)

Example 42 with DualGraph

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

the class SelectAllPluginNGTest method testEdit.

/**
 * Test of edit method, of class SelectAllPlugin. No attributes added so
 * should throw a pluginexception
 */
@Test(expectedExceptions = PluginException.class)
public void testEdit() throws Exception {
    System.out.println("select all edit with nothing on graph");
    // Open a new graph
    graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
    // run select all plugin
    PluginExecution.withPlugin(new SelectAllPlugin()).executeNow(graph);
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) Test(org.testng.annotations.Test)

Example 43 with DualGraph

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

the class SelectAllPluginNGTest method testEdit3.

/**
 * Test of edit method, of class SelectAllPlugin. select all edit with a
 * graph that has no selected element or graph elements via its schema.
 */
@Test(expectedExceptions = PluginException.class)
public void testEdit3() throws Exception {
    System.out.println("select all edit with no selected attribute or elements on graph");
    // Open a new graph
    graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(BareSchemaFactory.NAME).createSchema());
    // run select all plugin
    PluginExecution.withPlugin(new SelectAllPlugin()).executeNow(graph);
}
Also used : DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) Test(org.testng.annotations.Test)

Example 44 with DualGraph

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

the class FindViewTopComponentNGTest method setupGraph.

private void setupGraph() {
    graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
    graphMap.put(graph.getId(), graph);
    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 45 with DualGraph

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

the class AdvancedFindTabNGTest 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);
        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