use of org.neo4j.kernel.api.proc.BasicContext in project neo4j by neo4j.
the class ReflectiveUserAggregationFunctionTest method shouldLoadWhiteListedFunction.
@Test
public void shouldLoadWhiteListedFunction() throws Throwable {
// Given
procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), components, new ComponentRegistry(), NullLog.getInstance(), new ProcedureConfig(Config.defaults().with(MapUtil.stringMap(GraphDatabaseSettings.procedure_whitelist.name(), "org.neo4j.kernel.impl.proc.collectCool"))));
CallableUserAggregationFunction method = compile(SingleAggregationFunction.class).get(0);
// Expect
CallableUserAggregationFunction.Aggregator created = method.create(new BasicContext());
created.update(new Object[] { "Bonnie" });
assertThat(created.result(), equalTo(Collections.singletonList("Bonnie")));
}
use of org.neo4j.kernel.api.proc.BasicContext in project neo4j by neo4j.
the class ProcedureJarLoaderTest method shouldLoadProcedureFromJar.
@Test
public void shouldLoadProcedureFromJar() throws Throwable {
// Given
URL jar = createJarFor(ClassWithOneProcedure.class);
// When
List<CallableProcedure> procedures = jarloader.loadProcedures(jar).procedures();
// Then
List<ProcedureSignature> signatures = procedures.stream().map(CallableProcedure::signature).collect(toList());
assertThat(signatures, contains(procedureSignature("org", "neo4j", "kernel", "impl", "proc", "myProcedure").out("someNumber", NTInteger).build()));
assertThat(asList(procedures.get(0).apply(new BasicContext(), new Object[0])), contains(IsEqual.equalTo(new Object[] { 1337L })));
}
Aggregations