use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.
the class FindNGTest method findBooleanValuesTest.
@Test
public void findBooleanValuesTest() throws InterruptedException, PluginException {
ArrayList<FindRule> rules = new ArrayList<>();
ReadableGraph rg = graph.getReadableGraph();
try {
// setup find criteria / rules
HashMap<String, Object> values = new HashMap<>();
values.put("boolean_content", true);
FindRule rule1 = new FindRule(FindTypeOperators.Type.BOOLEAN, new GraphAttribute(rg, vSelAttr), FindTypeOperators.Operator.IS, values);
rules.add(rule1);
// perform find search
// need to create temporary GraphNode and skip the RemoteInit portion of the initialisation
GraphNode aGraphNode = new GraphNode(graph, null, new TopComponent(), null);
final AdvancedFindPlugin queryPlugin = new AdvancedFindPlugin(GraphElementType.VERTEX, rules, false);
PluginExecution.withPlugin(queryPlugin).executeNow(graph);
final List<FindResult> results = queryPlugin.getResults();
// validate results
assertEquals("result size", 3, results.size());
assertTrue("node 'name2' found", nodeFound(rg, "name2", results));
assertTrue("node 'name4' found", nodeFound(rg, "name4", results));
assertTrue("node 'name6' found", nodeFound(rg, "name6", results));
} finally {
rg.release();
}
}
use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.
the class FindNGTest method findSingleNodeCaseSensitiveFindTest.
@Test
public void findSingleNodeCaseSensitiveFindTest() throws InterruptedException, PluginException {
ArrayList<FindRule> rules = new ArrayList<>();
ReadableGraph rg = graph.getReadableGraph();
try {
// setup find criteria / rules
HashMap<String, Object> values = new HashMap<>();
values.put("string_content", "name1");
values.put("string_case_sensitive", true);
values.put("string_use_list", false);
FindRule rule1 = new FindRule(FindTypeOperators.Type.STRING, new GraphAttribute(rg, rg.getAttribute(GraphElementType.VERTEX, vNameAttr)), FindTypeOperators.Operator.IS, values);
rules.add(rule1);
// perform find search
// need to create temporary GraphNode and skip the RemoteInit portion of the initialisation
GraphNode gn = new GraphNode(graph, null, new TopComponent(), null);
final AdvancedFindPlugin queryPlugin = new AdvancedFindPlugin(GraphElementType.VERTEX, rules, false);
PluginExecution.withPlugin(queryPlugin).executeNow(graph);
final List<FindResult> results = queryPlugin.getResults();
// validate results
assertEquals("result size", 1, results.size());
assertTrue("node 'name1' found", nodeFound(rg, "name1", results));
} finally {
rg.release();
}
}
use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.
the class FindNGTest method findFloatValuesTest.
@Test
public void findFloatValuesTest() throws InterruptedException, PluginException {
ArrayList<FindRule> rules = new ArrayList<>();
ReadableGraph rg = graph.getReadableGraph();
try {
// setup find criteria / rules
HashMap<String, Object> values = new HashMap<>();
values.put("float_first_item", 5.1f);
FindRule rule1 = new FindRule(FindTypeOperators.Type.FLOAT, new GraphAttribute(rg, attrX), FindTypeOperators.Operator.GREATER_THAN, values);
rules.add(rule1);
// perform find search
// need to create temporary GraphNode and skip the RemoteInit portion of the initialisation
GraphNode aGraphNode = new GraphNode(graph, null, new TopComponent(), null);
final AdvancedFindPlugin queryPlugin = new AdvancedFindPlugin(GraphElementType.VERTEX, rules, false);
PluginExecution.withPlugin(queryPlugin).executeNow(graph);
final List<FindResult> results = queryPlugin.getResults();
// validate results
assertEquals("result size", 2, results.size());
assertTrue("node 'name6' found", nodeFound(rg, "name6", results));
assertTrue("node 'name7' found", nodeFound(rg, "name7", results));
} finally {
rg.release();
}
}
use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.
the class FindNGTest method findSingleNodeCaseSensitiveNoFindTest.
@Test
public void findSingleNodeCaseSensitiveNoFindTest() throws InterruptedException, PluginException {
ArrayList<FindRule> rules = new ArrayList<>();
ReadableGraph rg = graph.getReadableGraph();
try {
// setup find criteria / rules
HashMap<String, Object> values = new HashMap<>();
values.put("string_content", "Name1");
values.put("string_case_sensitive", true);
values.put("string_use_list", false);
FindRule rule1 = new FindRule(FindTypeOperators.Type.STRING, new GraphAttribute(rg, rg.getAttribute(GraphElementType.VERTEX, vNameAttr)), FindTypeOperators.Operator.IS, values);
rules.add(rule1);
// perform find search
// need to create temporary GraphNode and skip the RemoteInit portion of the initialisation
GraphNode aGraphNode = new GraphNode(graph, null, new TopComponent(), null);
final AdvancedFindPlugin queryPlugin = new AdvancedFindPlugin(GraphElementType.VERTEX, rules, false);
PluginExecution.withPlugin(queryPlugin).executeNow(graph);
final List<FindResult> results = queryPlugin.getResults();
// validate results
assertEquals("result size", 0, results.size());
} finally {
rg.release();
}
}
use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.
the class DefaultPluginInteraction method createProgressTitle.
protected String createProgressTitle() {
final StringBuilder result = new StringBuilder();
final GraphNode graphNode = pluginManager.getGraphNode();
if (graphNode != null) {
final String graphName = graphNode.getName();
if (graphName != null) {
result.append(graphName);
result.append(SeparatorConstants.COLON);
result.append(" ");
}
}
result.append(pluginManager.getPlugin().getName());
return result.toString();
}
Aggregations