use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class SplitNodesPluginNGTest method testUpdateParameters.
/**
* Test of createParameters method, of class SplitNodesPlugin.
*/
@Test
public void testUpdateParameters() {
final SplitNodesPlugin instance = new SplitNodesPlugin();
final PluginParameters params = instance.createParameters();
final PluginParameter<SingleChoiceParameterValue> transactionTypeParam = (PluginParameter<SingleChoiceParameterValue>) params.getParameters().get(SplitNodesPlugin.TRANSACTION_TYPE_PARAMETER_ID);
assertTrue(SingleChoiceParameterType.getOptions(transactionTypeParam).isEmpty());
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
instance.updateParameters(new DualGraph(schema, graph), params);
// 9 is the number of transaction types in the analytic schema
assertEquals(SingleChoiceParameterType.getOptions(transactionTypeParam).size(), 9);
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class SelectAllPluginNGTest method testEdit.
/**
* Test of edit method, of class SelectAllPlugin. No attributes added so
* should throw a pluginexception
*/
@Test(expectedExceptions = PluginException.class)
public void testEdit() throws Exception {
System.out.println("select all edit with nothing on graph");
// Open a new graph
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
// run select all plugin
PluginExecution.withPlugin(new SelectAllPlugin()).executeNow(graph);
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class SelectAllPluginNGTest method testEdit3.
/**
* Test of edit method, of class SelectAllPlugin. select all edit with a
* graph that has no selected element or graph elements via its schema.
*/
@Test(expectedExceptions = PluginException.class)
public void testEdit3() throws Exception {
System.out.println("select all edit with no selected attribute or elements on graph");
// Open a new graph
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(BareSchemaFactory.NAME).createSchema());
// run select all plugin
PluginExecution.withPlugin(new SelectAllPlugin()).executeNow(graph);
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class FindViewTopComponentNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
try {
WritableGraph wg = graph.getWritableGraph("", true);
final int stateId = FindViewConcept.MetaAttribute.FINDVIEW_STATE.ensure(wg);
ArrayList<Attribute> attributeList = new ArrayList<>();
BasicFindReplaceParameters parameters = new BasicFindReplaceParameters("label name", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
FindResultsList foundResult = new FindResultsList(2, parameters, graph.getId());
wg.setObjectValue(stateId, 0, foundResult);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
use of au.gov.asd.tac.constellation.graph.locking.DualGraph in project constellation by constellation-app.
the class AdvancedFindTabNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graph2 = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
graphMap.put(graph2.getId(), graph2);
try {
WritableGraph wg = graph.getWritableGraph("", true);
// Create Selected Attributes
selectedV = VisualConcept.VertexAttribute.SELECTED.ensure(wg);
labelV = VisualConcept.VertexAttribute.LABEL.ensure(wg);
identifierV = VisualConcept.VertexAttribute.IDENTIFIER.ensure(wg);
xV = VisualConcept.VertexAttribute.X.ensure(wg);
selectedT = VisualConcept.TransactionAttribute.SELECTED.ensure(wg);
labelT = VisualConcept.TransactionAttribute.LABEL.ensure(wg);
identiferT = VisualConcept.TransactionAttribute.IDENTIFIER.ensure(wg);
widthT = VisualConcept.TransactionAttribute.WIDTH.ensure(wg);
vxId1 = wg.addVertex();
wg.setBooleanValue(selectedV, vxId1, false);
wg.setStringValue(labelV, vxId1, "label name");
wg.setStringValue(identifierV, vxId1, "identifer name");
wg.setIntValue(xV, vxId1, 1);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
Aggregations