Search in sources :

Example 6 with PluginInteraction

use of au.gov.asd.tac.constellation.plugins.PluginInteraction 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 7 with PluginInteraction

use of au.gov.asd.tac.constellation.plugins.PluginInteraction 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)

Example 8 with PluginInteraction

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

the class RemoveUnusedAttributesPluginNGTest method testAllNullAttributes.

/**
 * Test of edit method, of class RemoveUnusedAttributesPlugin.
 *
 * @throws java.lang.Exception
 */
@Test
public void testAllNullAttributes() throws Exception {
    PluginInteraction interaction = null;
    PluginParameters parameters = null;
    RemoveUnusedAttributesPlugin instance = new RemoveUnusedAttributesPlugin();
    instance.edit(graph, interaction, parameters);
    assertEquals(graph.getAttribute(GraphElementType.VERTEX, "test1"), GraphConstants.NOT_FOUND);
    assertEquals(graph.getAttribute(GraphElementType.VERTEX, "test2"), GraphConstants.NOT_FOUND);
    assertEquals(graph.getAttribute(GraphElementType.VERTEX, "test3"), GraphConstants.NOT_FOUND);
    assertEquals(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)

Example 9 with PluginInteraction

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

the class RemoveUnusedAttributesPluginNGTest method testSomeNullKeyAttributes.

@Test
public void testSomeNullKeyAttributes() throws Exception {
    // adding values to some attributes
    graph.setPrimaryKey(GraphElementType.VERTEX, vertexAttribute1);
    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);
    assertNotEquals(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)

Example 10 with PluginInteraction

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

the class ExtractTypesFromTextPluginNGTest method testRegexQuery.

/**
 * Test of query method in class ExtractTypesFromTextPlugin using a string
 * where a detection regex is picked up
 *
 * @throws Exception
 */
@Test
public void testRegexQuery() throws Exception {
    RecordStore query = new GraphRecordStore();
    ExtractTypesFromTextPlugin instance = new ExtractTypesFromTextPlugin();
    PluginInteraction interaction = new TextPluginInteraction();
    PluginParameters parameters = instance.createParameters();
    parameters.getParameters().get(ExtractTypesFromTextPlugin.TEXT_PARAMETER_ID).setStringValue("abc@def.ghi");
    RecordStore result = instance.query(query, interaction, parameters);
    RecordStore expResult = new GraphRecordStore();
    expResult.add();
    expResult.set(GraphRecordStoreUtilities.SOURCE + VisualConcept.VertexAttribute.IDENTIFIER, "abc@def.ghi");
    expResult.set(GraphRecordStoreUtilities.SOURCE + AnalyticConcept.VertexAttribute.TYPE, AnalyticConcept.VertexType.EMAIL_ADDRESS);
    expResult.set(GraphRecordStoreUtilities.SOURCE + AnalyticConcept.VertexAttribute.SEED, "true");
    assertEquals(result, expResult);
}
Also used : PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) TextPluginInteraction(au.gov.asd.tac.constellation.plugins.text.TextPluginInteraction) RecordStore(au.gov.asd.tac.constellation.graph.processing.RecordStore) GraphRecordStore(au.gov.asd.tac.constellation.graph.processing.GraphRecordStore) GraphRecordStore(au.gov.asd.tac.constellation.graph.processing.GraphRecordStore) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TextPluginInteraction(au.gov.asd.tac.constellation.plugins.text.TextPluginInteraction) Test(org.testng.annotations.Test)

Aggregations

PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)51 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)44 Test (org.testng.annotations.Test)33 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)16 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)15 ArrayList (java.util.ArrayList)15 TextPluginInteraction (au.gov.asd.tac.constellation.plugins.text.TextPluginInteraction)14 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)13 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)12 PluginGraphs (au.gov.asd.tac.constellation.plugins.PluginGraphs)10 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)9 Graph (au.gov.asd.tac.constellation.graph.Graph)8 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)8 RecordStore (au.gov.asd.tac.constellation.graph.processing.RecordStore)8 List (java.util.List)8 VisualConcept (au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept)7 PluginInfo (au.gov.asd.tac.constellation.plugins.PluginInfo)7 PluginTags (au.gov.asd.tac.constellation.plugins.templates.PluginTags)7 SimpleEditPlugin (au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin)7 PluginExecution (au.gov.asd.tac.constellation.plugins.PluginExecution)6