use of org.neo4j.kernel.api.proc.CallableUserFunction in project neo4j by neo4j.
the class ResourceInjectionTest method shouldCompileAndRunUserFunctions.
@Test
public void shouldCompileAndRunUserFunctions() throws Throwable {
// Given
CallableUserFunction proc = compiler.compileFunction(FunctionWithInjectedAPI.class).get(0);
// When
Object out = proc.apply(new BasicContext(), new Object[0]);
// Then
assertThat(out, equalTo("[Bonnie, Clyde]"));
}
use of org.neo4j.kernel.api.proc.CallableUserFunction in project neo4j by neo4j.
the class ReflectiveUserFunctionTest method shouldNotLoadNoneWhiteListedFunction.
@Test
public void shouldNotLoadNoneWhiteListedFunction() throws Throwable {
// Given
Log log = spy(Log.class);
procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), components, new ComponentRegistry(), log, new ProcedureConfig(Config.defaults().with(MapUtil.stringMap(GraphDatabaseSettings.procedure_whitelist.name(), "WrongName"))));
List<CallableUserFunction> method = compile(SingleReadOnlyFunction.class);
verify(log).warn("The function 'org.neo4j.kernel.impl.proc.listCoolPeople' is not on the whitelist and won't be loaded.");
assertThat(method.size(), equalTo(0));
}
Aggregations