Search in sources :

Example 96 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class SplitNodesPluginNGTest method testQueryWithNoResultingNodesToSplitTo_AllOccurancesNotSelected_WithoutDuplicateTransactions.

@Test
public void testQueryWithNoResultingNodesToSplitTo_AllOccurancesNotSelected_WithoutDuplicateTransactions() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, "Y");
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    // Assert the node is renamed to "YY"
    assertEquals(graph.getVertexCount(), 4);
    assertEquals(graph.getTransactionCount(), 3);
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId4), "YY");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 97 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class SplitNodesPluginSplitLogicNGTest method testQueryAllOccurancesNotSelected_SplitParameterRepeatsInTheMiddle.

@Test
public void testQueryAllOccurancesNotSelected_SplitParameterRepeatsInTheMiddle() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, ",");
    graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 5);
    assertEquals(graph.getTransactionCount(), 4);
    // Creates 2 nodes (v and ,v)
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId2), "v");
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId4 + 1), ",v");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 98 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class SplitNodesPluginSplitLogicNGTest method testQueryAllOccurancesSelected_SplitParameterRepeatsInTheMiddle.

@Test
public void testQueryAllOccurancesSelected_SplitParameterRepeatsInTheMiddle() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, ",");
    parameters.setBooleanValue(SplitNodesPlugin.ALL_OCCURRENCES_PARAMETER_ID, true);
    graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 5);
    assertEquals(graph.getTransactionCount(), 4);
    // Creates 2 nodes (v and v)
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId2), "v");
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId4 + 1), "v");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 99 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class SplitNodesPluginSplitLogicNGTest method testQueryAllOccurancesSelected_SplitParameterRepeatsInTheEnd.

@Test
public void testQueryAllOccurancesSelected_SplitParameterRepeatsInTheEnd() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, ",");
    parameters.setBooleanValue(SplitNodesPlugin.ALL_OCCURRENCES_PARAMETER_ID, true);
    graph.setBooleanValue(vertexSelectedAttribute, vxId4, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 4);
    assertEquals(graph.getTransactionCount(), 3);
    // Node renamed to "v"
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId4), "v");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 100 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class TestParametersPluginNGTest method testQueryCrash1.

/**
 * Test of query method, of class TestParametersPlugin. Tests not throwing
 * runtime exception
 */
@Test
public void testQueryCrash1() throws Exception {
    System.out.println("test query crash1");
    final TestParametersPlugin instance = new TestParametersPlugin();
    final PluginParameters result = instance.createParameters();
    final GraphRecordStore recordStore = new GraphRecordStore();
    final DefaultPluginInteraction interaction = new DefaultPluginInteraction(null, null);
    // Set plugin query name here before execution
    result.getParameters().get(CoreGlobalParameters.QUERY_NAME_PARAMETER_ID).setStringValue("TESTPARAMETERSPLUGIN");
    // Set plugin parameters here before execution
    result.getParameters().get(TestParametersPlugin.CRASH_PARAMETER_ID).setBooleanValue(false);
    instance.query(recordStore, interaction, result);
}
Also used : GraphRecordStore(au.gov.asd.tac.constellation.graph.processing.GraphRecordStore) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) DefaultPluginInteraction(au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction) Test(org.testng.annotations.Test)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)377 Test (org.testng.annotations.Test)185 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)60 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)60 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)58 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)58 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)52 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)48 ArrayList (java.util.ArrayList)47 Graph (au.gov.asd.tac.constellation.graph.Graph)37 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)34 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)32 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)24 List (java.util.List)20 Map (java.util.Map)20 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)19 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)19 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)19 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)17 IOException (java.io.IOException)17