Search in sources :

Example 71 with PluginParameters

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

the class MergeNodesPluginNGTest method editMergeNodeTypeNotFound.

@Test(expectedExceptions = PluginException.class)
public void editMergeNodeTypeNotFound() throws InterruptedException, PluginException {
    final GraphWriteMethods graph = mock(GraphWriteMethods.class);
    final PluginInteraction interaction = mock(PluginInteraction.class);
    final PluginParameters parameters = mock(PluginParameters.class);
    final PluginParameter pluginParameter = mock(PluginParameter.class);
    final Map<String, PluginParameter<?>> pluginParameters = Map.of("MergeNodesPlugin.merge_type", pluginParameter);
    when(parameters.getParameters()).thenReturn(pluginParameters);
    when(pluginParameter.getStringValue()).thenReturn("Something Random");
    mergeNodesPlugin.edit(graph, interaction, parameters);
}
Also used : GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 72 with PluginParameters

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

the class MergeTransactionsPluginNGTest method testCreateParameters.

/**
 * Test of createParameters method, of class MergeTransactionsPlugin.
 */
@Test
public void testCreateParameters() {
    MergeTransactionsPlugin instance = new MergeTransactionsPlugin();
    PluginParameters result = instance.createParameters();
    // Test the correct number of parameters were added
    final int expResult = 5;
    assertEquals(result.getParameters().size(), expResult);
    assertTrue(result.hasParameter(MergeTransactionsPlugin.MERGE_TYPE_PARAMETER_ID));
    assertTrue(result.hasParameter(MergeTransactionsPlugin.LEAD_PARAMETER_ID));
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 73 with PluginParameters

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

the class MergeTransactionsPluginNGTest method testEditNullTypeName.

/**
 * Test of edit method with a null merge transaction type name
 *
 * @throws Exception
 */
@Test(expectedExceptions = PluginException.class)
public void testEditNullTypeName() throws Exception {
    MergeTransactionsPlugin instance = new MergeTransactionsPlugin();
    PluginInteraction interaction = new TextPluginInteraction();
    PluginParameters parameters = instance.createParameters();
    instance.edit(graph, interaction, parameters);
}
Also used : PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) TextPluginInteraction(au.gov.asd.tac.constellation.plugins.text.TextPluginInteraction) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TextPluginInteraction(au.gov.asd.tac.constellation.plugins.text.TextPluginInteraction) Test(org.testng.annotations.Test)

Example 74 with PluginParameters

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

the class RemoveNodesPluginNGTest method testEditAttributesNotFound.

/**
 * Test of edit method, of class RemoveNodesPlugin. selected and identifier
 * attributes not found
 *
 * @throws InterruptedException
 * @throws PluginException
 */
@Test
public void testEditAttributesNotFound() throws InterruptedException, PluginException {
    System.out.println("editAttributesNotFound");
    final RemoveNodesPlugin instance = new RemoveNodesPlugin();
    final PluginParameters parameters = instance.createParameters();
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getVertexCount(), 4);
    assertEquals(graph.getTransactionCount(), 4);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 75 with PluginParameters

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

the class RemoveUnusedAttributesPluginNGTest method testSomeNullAttributes.

@Test
public void testSomeNullAttributes() throws Exception {
    // adding values to some attributes
    graph.setStringValue(vertexAttribute2, vertex2, "some words");
    graph.setStringValue(vertexAttribute3, vertex1, "some words");
    graph.setStringValue(transactionAttribute1, transaction1, "some words");
    PluginInteraction interaction = null;
    PluginParameters parameters = null;
    RemoveUnusedAttributesPlugin instance = new RemoveUnusedAttributesPlugin();
    instance.edit(graph, interaction, parameters);
    assertEquals(graph.getAttribute(GraphElementType.VERTEX, "test1"), GraphConstants.NOT_FOUND);
    assertNotEquals(graph.getAttribute(GraphElementType.VERTEX, "test2"), GraphConstants.NOT_FOUND);
    assertNotEquals(graph.getAttribute(GraphElementType.VERTEX, "test3"), GraphConstants.NOT_FOUND);
    assertNotEquals(graph.getAttribute(GraphElementType.TRANSACTION, "test4"), GraphConstants.NOT_FOUND);
    assertEquals(graph.getAttribute(GraphElementType.TRANSACTION, "test5"), GraphConstants.NOT_FOUND);
    assertEquals(graph.getAttribute(GraphElementType.TRANSACTION, "test6"), GraphConstants.NOT_FOUND);
}
Also used : PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) 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