Search in sources :

Example 1 with GraphElementTypeParameterValue

use of au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue in project constellation by constellation-app.

the class TestParametersPluginNGTest method testGraphElementType1.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing
 * runtime exception
 */
@Test
public void testGraphElementType1() throws Exception {
    System.out.println("test graph element type1");
    final TestParametersPlugin instance = new TestParametersPlugin();
    final PluginParameters result = instance.createParameters();
    // Set plugin query name here before execution
    result.getParameters().get(CoreGlobalParameters.QUERY_NAME_PARAMETER_ID).setStringValue("TESTPARAMETERSPLUGIN");
    // Set plugin parameters here before execution
    final GraphElementTypeParameterValue graphElementType = new GraphElementTypeParameterValue();
    assertTrue(graphElementType.set(GraphElementType.META));
    // return false when setting same attribute
    assertFalse(graphElementType.set(GraphElementType.META));
    assertTrue(graphElementType.setObjectValue(GraphElementType.VERTEX));
    // return false when setting same attribute
    assertFalse(graphElementType.setObjectValue(GraphElementType.VERTEX));
    for (final GraphElementType elementType : GraphElementType.values()) {
        graphElementType.setObjectValue(elementType);
        result.getParameters().get(TestParametersPlugin.ELEMENT_TYPE_PARAMETER_ID).setObjectValue(graphElementType);
        // Ensure it is still selected as the correct value
        assertEquals(SingleChoiceParameterType.getChoice((PluginParameter<SingleChoiceParameterType.SingleChoiceParameterValue>) result.getParameters().get(TestParametersPlugin.ELEMENT_TYPE_PARAMETER_ID)), elementType.getShortLabel());
    }
}
Also used : SingleChoiceParameterType(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType) GraphElementTypeParameterValue(au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 2 with GraphElementTypeParameterValue

use of au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue in project constellation by constellation-app.

the class TestParametersPluginNGTest method testCreateParametersGraphElementType2.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing
 * runtime exception
 */
@Test
public void testCreateParametersGraphElementType2() throws Exception {
    System.out.println("test CreateParameters graph element type2");
    final TestParametersPlugin instance = new TestParametersPlugin();
    final PluginParameters result = instance.createParameters();
    // Set plugin query name here before execution
    result.getParameters().get(CoreGlobalParameters.QUERY_NAME_PARAMETER_ID).setStringValue("TESTPARAMETERSPLUGIN");
    // Set plugin parameters here before execution
    final GraphElementTypeParameterValue graphElementType = new GraphElementTypeParameterValue();
    for (final GraphElementType elementType : GraphElementType.values()) {
        graphElementType.setObjectValue(elementType);
        result.getParameters().get(TestParametersPlugin.ELEMENT_TYPE_PARAMETER_ID).setObjectValue(graphElementType);
        // Ensure it is still selected as the correct value
        assertEquals(SingleChoiceParameterType.getChoice((PluginParameter<SingleChoiceParameterType.SingleChoiceParameterValue>) result.getParameters().get(TestParametersPlugin.ELEMENT_TYPE_PARAMETER_ID)), elementType.getShortLabel());
    }
}
Also used : SingleChoiceParameterType(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType) GraphElementTypeParameterValue(au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 3 with GraphElementTypeParameterValue

use of au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue in project constellation by constellation-app.

the class TestParametersPluginNGTest method testCreateParametersGraphElementType1.

/**
 * Test of query method, of class TestParametersPlugin. Tests throwing
 * runtime exception
 */
@Test(expectedExceptions = IllegalArgumentException.class)
public void testCreateParametersGraphElementType1() throws Exception {
    System.out.println("test CreateParameters graph element type1");
    final TestParametersPlugin instance = new TestParametersPlugin();
    final PluginParameters result = instance.createParameters();
    // Set plugin query name here before execution
    result.getParameters().get(CoreGlobalParameters.QUERY_NAME_PARAMETER_ID).setStringValue("TESTPARAMETERSPLUGIN");
    // Set plugin parameters here before execution - Should throw an exception here
    final GraphElementTypeParameterValue graphElementType = new GraphElementTypeParameterValue();
    graphElementType.setObjectValue((Object) "Unusable String Object");
}
Also used : GraphElementTypeParameterValue(au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)3 GraphElementTypeParameterValue (au.gov.asd.tac.constellation.views.dataaccess.plugins.experimental.TestParametersPlugin.GraphElementTypeParameterValue)3 Test (org.testng.annotations.Test)3 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)2 SingleChoiceParameterType (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType)2