use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class PerformsWriteMethodVisitorTest method rejects_conflicted_mode_usage.
@Test
public void rejects_conflicted_mode_usage() {
Element element = elementTestUtils.findMethodElement(PerformsWriteProcedures.class, "conflictingMode");
Stream<CompilationMessage> errors = visitor.visit(element);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, element, "@PerformsWrites usage error: cannot use mode other than Mode.DEFAULT"));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class DuplicatedProcedureValidatorTest method detects_duplicate_procedure_with_overridden_names.
@Test
public void detects_duplicate_procedure_with_overridden_names() {
Element procedureA = procedureMethod(OverriddenProcedureA.class.getName());
Element procedureB = procedureMethod(OverriddenProcedureB.class.getName());
Collection<Element> duplicates = asList(procedureA, procedureB);
Stream<CompilationMessage> errors = validator.apply(duplicates);
assertThat(errors).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).containsExactlyInAnyOrder(tuple(Diagnostic.Kind.ERROR, procedureA, "Procedure|function name <override> is already defined 2 times. It should be defined only once!"), tuple(Diagnostic.Kind.ERROR, procedureB, "Procedure|function name <override> is already defined 2 times. It should be defined only " + "once!"));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class PerformsWriteMethodVisitorTest method rejects_non_procedure_methods.
@Test
public void rejects_non_procedure_methods() {
Element element = elementTestUtils.findMethodElement(PerformsWriteProcedures.class, "missingProcedureAnnotation");
Stream<CompilationMessage> errors = visitor.visit(element);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, element, "@PerformsWrites usage error: missing @Procedure annotation on method"));
}
use of org.neo4j.tooling.procedure.messages.CompilationMessage in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_specified_name_cannot_be_in_root_namespace.
@Test
public void functions_with_specified_name_cannot_be_in_root_namespace() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "functionWithName");
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> 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 DuplicatedProcedureValidatorTest method detects_duplicate_procedure_with_default_names.
@Test
public void detects_duplicate_procedure_with_default_names() {
Element procedureA = procedureMethod(DefaultProcedureA.class.getName());
Element procedureB = procedureMethod(DefaultProcedureB.class.getName());
Collection<Element> duplicates = asList(procedureA, procedureB);
Stream<CompilationMessage> errors = validator.apply(duplicates);
String procedureName = "org.neo4j.tooling.procedure.validators.examples.procedure";
assertThat(errors).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).containsExactlyInAnyOrder(tuple(Diagnostic.Kind.ERROR, procedureA, "Procedure|function name <" + procedureName + "> is already defined 2 times. It should be defined " + "only once!"), tuple(Diagnostic.Kind.ERROR, procedureB, "Procedure|function name <" + procedureName + "> is already defined 2 times. It should be defined only once!"));
}
Aggregations