Search in sources :

Example 91 with PluginParameters

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

the class SplitNodesPluginNGTest method testCreateParameters.

/**
 * Test of createParameters method, of class SplitNodesPlugin.
 */
@Test
public void testCreateParameters() {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters params = instance.createParameters();
    assertEquals(params.getParameters().size(), 5);
    assertTrue(params.getParameters().containsKey(SplitNodesPlugin.SPLIT_PARAMETER_ID));
    assertTrue(params.getParameters().containsKey(SplitNodesPlugin.DUPLICATE_TRANSACTIONS_PARAMETER_ID));
    assertTrue(params.getParameters().containsKey(SplitNodesPlugin.TRANSACTION_TYPE_PARAMETER_ID));
    assertTrue(params.getParameters().containsKey(SplitNodesPlugin.ALL_OCCURRENCES_PARAMETER_ID));
    assertTrue(params.getParameters().containsKey(SplitNodesPlugin.COMPLETE_WITH_SCHEMA_OPTION_ID));
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 92 with PluginParameters

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

the class SplitNodesPluginNGTest method testQueryWithNoTypes_WithoutDuplicateTransactions.

/**
 * Test of query method, of class SplitNodesPlugin.
 *
 * @throws Exception
 */
@Test
public void testQueryWithNoTypes_WithoutDuplicateTransactions() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, "@");
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 5);
    assertEquals(graph.getTransactionCount(), 4);
    assertEquals(graph.getVertexTransactionCount(vxId1), 3);
    // Check transactions of new node (Assumed the new node is at vxId4 + 1)
    assertEquals(graph.getVertexTransactionCount(vxId4 + 1), 1);
    // assert new transaction is of type 'Correlation'
    assertEquals(graph.getStringValue(transactionTypeAttributeId, graph.getVertexTransaction(vxId4 + 1, 0)), "Correlation");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 93 with PluginParameters

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

the class SplitNodesPluginNGTest method testQueryWithNoResultingNodesToSplitTo_AllOccurancesSelected_WithoutDuplicateTransactions.

@Test
public void testQueryWithNoResultingNodesToSplitTo_AllOccurancesSelected_WithoutDuplicateTransactions() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, "Y");
    parameters.setBooleanValue(SplitNodesPlugin.ALL_OCCURRENCES_PARAMETER_ID, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    // Assert no new nodes are created
    assertEquals(graph.getVertexCount(), 4);
    assertEquals(graph.getTransactionCount(), 3);
    assertEquals(graph.getStringValue(vertexIdentifierAttribute, vxId4), "YYY");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 94 with PluginParameters

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

the class SplitNodesPluginNGTest method testQueryWithTypes_WithoutDuplicateTransactions.

@Test
public void testQueryWithTypes_WithoutDuplicateTransactions() throws Exception {
    final SplitNodesPlugin instance = new SplitNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setStringValue(SplitNodesPlugin.SPLIT_PARAMETER_ID, "@");
    parameters.setStringValue(SplitNodesPlugin.TRANSACTION_TYPE_PARAMETER_ID, "Similarity");
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 5);
    assertEquals(graph.getTransactionCount(), 4);
    assertEquals(graph.getVertexTransactionCount(vxId1), 3);
    // Check transactions of new node (Assumed the new node is at vxId4 + 1)
    assertEquals(graph.getVertexTransactionCount(vxId4 + 1), 1);
    // assert new transaction is of type 'Correlation'
    assertEquals(graph.getStringValue(transactionTypeAttributeId, graph.getVertexTransaction(vxId4 + 1, 0)), "Similarity");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 95 with PluginParameters

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

the class SplitNodesPluginNGTest method testQueryWithMultipleNodes_WithoutDuplicateTransactions.

@Test
public void testQueryWithMultipleNodes_WithoutDuplicateTransactions() 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);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 6);
    assertEquals(graph.getTransactionCount(), 5);
    assertEquals(graph.getVertexTransactionCount(vxId3), 2);
    assertEquals(graph.getVertexTransactionCount(vxId2), 3);
    // Check transactions of new nodes (Assumed the new nodes are at vxId4 + 1 and vxId4 + 2)
    assertEquals(graph.getVertexTransactionCount(vxId4 + 1), 1);
    assertEquals(graph.getVertexTransactionCount(vxId4 + 2), 1);
    // assert new transaction is of type 'Correlation'
    assertEquals(graph.getStringValue(transactionTypeAttributeId, graph.getVertexTransaction(vxId4 + 1, 0)), "Correlation");
    assertEquals(graph.getStringValue(transactionTypeAttributeId, graph.getVertexTransaction(vxId4 + 2, 0)), "Correlation");
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) 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