use of org.neo4j.internal.kernel.api.procs.UserFunctionHandle in project neo4j by neo4j.
the class TokenHoldersIdLookupTest method setup.
@BeforeAll
static void setup() throws KernelException {
GlobalProcedures procs = new GlobalProceduresRegistry();
procs.registerProcedure(TestProcedures.class);
procs.registerFunction(TestProcedures.class);
procs.registerAggregationFunction(TestProcedures.class);
procName2id = new HashMap<>();
for (ProcedureSignature signature : procs.getAllProcedures()) {
QualifiedName name = signature.name();
ProcedureHandle procedure = procs.procedure(name);
procName2id.put(name.toString(), procedure.id());
}
funcName2id = new HashMap<>();
procs.getAllNonAggregatingFunctions().forEach(signature -> {
QualifiedName name = signature.name();
UserFunctionHandle function = procs.function(name);
funcName2id.put(name.toString(), function.id());
});
procs.getAllAggregatingFunctions().forEach(signature -> {
QualifiedName name = signature.name();
UserFunctionHandle function = procs.aggregationFunction(name);
funcName2id.put(name.toString(), function.id());
});
idLookup = new TokenHoldersIdLookup(mockedTokenHolders(), procs);
}
use of org.neo4j.internal.kernel.api.procs.UserFunctionHandle in project neo4j by neo4j.
the class UserFunctionsTest method shouldNotAllowCallingNonExistingFunction.
@Test
void shouldNotAllowCallingNonExistingFunction() {
UserFunctionHandle functionHandle = procs.function(signature.name());
ProcedureException exception = assertThrows(ProcedureException.class, () -> procs.callFunction(prepareContext(), functionHandle != null ? functionHandle.id() : -1, new AnyValue[] { numberValue(1337) }));
assertThat(exception.getMessage()).isEqualTo("There is no function with the internal id `-1` registered for this database instance.");
}
Aggregations