use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_specified_value_cannot_be_in_root_namespace.
@Test
public void functions_with_specified_value_cannot_be_in_root_namespace() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "functionWithValue");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, function, "Function <in_root_namespace_again> cannot be defined in the root namespace. Valid name example: com.acme.my_function"));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_unsupported_return_types_are_invalid.
@Test
public void functions_with_unsupported_return_types_are_invalid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "wrongReturnType");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, function, "Unsupported return type <void> of function defined in <org.neo4j.tooling.procedure.visitors.examples.UserFunctionsExamples#wrongReturnType>."));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_non_annotated_parameters_are_invalid.
@Test
public void functions_with_non_annotated_parameters_are_invalid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "missingParameterAnnotation");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, "@org.neo4j.procedure.Name usage error: missing on parameter <arg1>"));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_in_non_root_namespace_are_valid.
@Test
public void functions_in_non_root_namespace_are_valid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "ok");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).isEmpty();
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class PerformsWriteMethodVisitorTest method validates_regular_procedure.
@Test
public void validates_regular_procedure() {
Element element = elementTestUtils.findMethodElement(PerformsWriteProcedures.class, "ok");
Stream<CompilationMessage> errors = visitor.visit(element);
assertThat(errors).isEmpty();
}
Aggregations