use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ProceduresTest method shouldNotAllowDuplicateFieldNamesInInput.
@Test
void shouldNotAllowDuplicateFieldNamesInInput() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> procs.register(procedureWithSignature(procedureSignature("asd").in("a", NTAny).in("a", NTAny).build())));
assertThat(exception.getMessage()).isEqualTo("Procedure `asd(a :: ANY?, a :: ANY?) :: ()` cannot be registered, because it contains a duplicated input field, 'a'. " + "You need to rename or remove one of the duplicate fields.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ProceduresTest method shouldNotAllowCallingNonExistingProcedure.
@Test
void shouldNotAllowCallingNonExistingProcedure() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> procs.procedure(signature.name()));
assertThat(exception.getMessage()).isEqualTo("There is no procedure with the name `org.myproc` registered for this database instance. Please ensure you've spelled the " + "procedure name correctly and that the procedure is properly deployed.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ProceduresTest method shouldSignalNonExistingProcedure.
@Test
void shouldSignalNonExistingProcedure() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> procs.procedure(signature.name()));
assertThat(exception.getMessage()).isEqualTo("There is no procedure with the name `org.myproc` registered for this database instance. Please ensure you've spelled the " + "procedure name correctly and that the procedure is properly deployed.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ProceduresTest method shouldMakeContextAvailable.
@Test
void shouldMakeContextAvailable() throws Throwable {
// Given
procs.register(new CallableProcedure.BasicProcedure(signature) {
@Override
public RawIterator<AnyValue[], ProcedureException> apply(Context ctx, AnyValue[] input, ResourceTracker resourceTracker) {
return RawIterator.<AnyValue[], ProcedureException>of(new AnyValue[] { stringValue(ctx.thread().getName()) });
}
});
Context ctx = prepareContext();
ProcedureHandle procedureHandle = procs.procedure(signature.name());
// When
RawIterator<AnyValue[], ProcedureException> result = procs.callProcedure(ctx, procedureHandle.id(), new AnyValue[0], EMPTY_RESOURCE_TRACKER);
// Then
assertThat(asList(result)).contains(new AnyValue[] { stringValue(Thread.currentThread().getName()) });
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ProceduresTest method shouldNotAllowDuplicateFieldNamesInOutput.
@Test
void shouldNotAllowDuplicateFieldNamesInOutput() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> procs.register(procedureWithSignature(procedureSignature("asd").out("a", NTAny).out("a", NTAny).build())));
assertThat(exception.getMessage()).isEqualTo("Procedure `asd() :: (a :: ANY?, a :: ANY?)` cannot be registered, because it contains a duplicated output field, 'a'. " + "You need to rename or remove one of the duplicate fields.");
}
Aggregations