/** * {@inheritDoc} * * @see org.modeshape.graph.request.function.FunctionContext#output(java.lang.String, java.lang.Class, * java.lang.Object) */ public <T> T output( String name, Class<T> type, T defaultValue ) { return functionRequest.output(name, type, getExecutionContext()); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.function.FunctionContext#output(java.lang.String, * org.modeshape.graph.property.PropertyType, java.lang.Object) */ public <T> T output( String name, PropertyType type, T defaultValue ) { return functionRequest.output(name, type, defaultValue, getExecutionContext()); }
@Test public void shouldSuccessfullyApplyFunctionUsingBatch() { // Create some nodes and get the subgraph of them ... Subgraph subgraph = graph.getSubgraphOfDepth(100).at("/"); int count = countNodes(subgraph); // Determine the number of nodes using a function ... Results results = graph.batch().applyFunction(new CountNodesFunction()).to("/").execute(); assertThat(results, is(notNullValue())); assertThat(results.getRequests().size(), is(1)); FunctionRequest request = (FunctionRequest)results.getRequests().get(0); assertThat(request.output("nodeCount", PropertyType.LONG, (Long)null, context), is(new Long(count))); }