Search in sources :

Example 1 with DefaultPluginInteraction

use of au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction in project constellation by constellation-app.

the class TestParametersPluginNGTest method testQueryException5.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing of
 * fatal pluginException
 */
@Test(expectedExceptions = PluginException.class)
public void testQueryException5() throws Exception {
    System.out.println("throw pluginexception5");
    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.LEVEL_PARAMETER_ID).setStringValue("Fatal");
    try {
        instance.query(recordStore, interaction, result);
    } catch (final PluginException ex) {
        assertEquals(ex.getNotificationLevel(), PluginNotificationLevel.FATAL);
        throw ex;
    }
}
Also used : PluginException(au.gov.asd.tac.constellation.plugins.PluginException) 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)

Example 2 with DefaultPluginInteraction

use of au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction in project constellation by constellation-app.

the class TestParametersPluginNGTest method testQueryException6.

/**
 * Test of query method, of class TestParametersPlugin. Tests not throwing
 * of pluginException
 */
@Test
public void testQueryException6() throws Exception {
    System.out.println("throw pluginexception6");
    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.LEVEL_PARAMETER_ID).setStringValue("None");
    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)

Example 3 with DefaultPluginInteraction

use of au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction in project constellation by constellation-app.

the class TestParametersPluginNGTest method testQueryException4.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing of
 * error pluginException
 */
@Test(expectedExceptions = PluginException.class)
public void testQueryException4() throws Exception {
    System.out.println("throw pluginexception4");
    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.LEVEL_PARAMETER_ID).setStringValue("Error");
    try {
        instance.query(recordStore, interaction, result);
    } catch (final PluginException ex) {
        assertEquals(ex.getNotificationLevel(), PluginNotificationLevel.ERROR);
        throw ex;
    }
}
Also used : PluginException(au.gov.asd.tac.constellation.plugins.PluginException) 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)

Example 4 with DefaultPluginInteraction

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

Example 5 with DefaultPluginInteraction

use of au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction in project constellation by constellation-app.

the class TestParametersPluginNGTest method testQueryException1.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing of
 * debug pluginException
 */
@Test(expectedExceptions = PluginException.class)
public void testQueryException1() throws Exception {
    System.out.println("throw pluginexception1");
    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.LEVEL_PARAMETER_ID).setStringValue("Debug");
    try {
        instance.query(recordStore, interaction, result);
    } catch (final PluginException ex) {
        assertEquals(ex.getNotificationLevel(), PluginNotificationLevel.DEBUG);
        throw ex;
    }
}
Also used : PluginException(au.gov.asd.tac.constellation.plugins.PluginException) 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

DefaultPluginInteraction (au.gov.asd.tac.constellation.graph.node.plugins.DefaultPluginInteraction)9 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)9 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)9 Test (org.testng.annotations.Test)9 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)5 RecordStore (au.gov.asd.tac.constellation.graph.processing.RecordStore)1 DateTimeRange (au.gov.asd.tac.constellation.plugins.parameters.types.DateTimeRange)1 ZonedDateTime (java.time.ZonedDateTime)1