use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters 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);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters 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);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters 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;
}
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters 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);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters 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());
}
}
Aggregations