use of org.neo4j.kernel.api.proc.CallableUserAggregationFunction in project neo4j by neo4j.
the class ReflectiveUserAggregationFunctionTest method shouldNotLoadAnyFunctionIfConfigIsEmpty.
@Test
public void shouldNotLoadAnyFunctionIfConfigIsEmpty() 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(), ""))));
List<CallableUserAggregationFunction> method = compile(SingleAggregationFunction.class);
verify(log).warn("The function 'org.neo4j.kernel.impl.proc.collectCool' is not on the whitelist and won't be loaded.");
assertThat(method.size(), equalTo(0));
}
use of org.neo4j.kernel.api.proc.CallableUserAggregationFunction in project neo4j by neo4j.
the class ReflectiveUserAggregationFunctionTest method shouldAllowOverridingProcedureName.
@Test
public void shouldAllowOverridingProcedureName() throws Throwable {
// When
CallableUserAggregationFunction method = compile(FunctionWithOverriddenName.class).get(0);
// Then
assertEquals("org.mystuff.thisisActuallyTheName", method.signature().name().toString());
}
use of org.neo4j.kernel.api.proc.CallableUserAggregationFunction 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")));
}
Aggregations