use of javax.tools.JavaFileObject in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_record_type_has_nonpublic_fields.
@Test
public void fails_if_record_type_has_nonpublic_fields() {
JavaFileObject record = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_type/BadRecord.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSources()).that(asList(JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_type/BadRecordTypeSproc.java"), record)).processedWith(processor).failsToCompile().withErrorCount(2);
compilation.withErrorContaining("Record definition error: field BadRecord#label must be public").in(record).onLine(26);
compilation.withErrorContaining("Record definition error: field BadRecord#age must be public").in(record).onLine(27);
}
use of javax.tools.JavaFileObject in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_procedure_generic_record_field_type_is_not_supported.
@Test
public void fails_if_procedure_generic_record_field_type_is_not_supported() {
JavaFileObject record = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_field_type/BadRecordGenericFieldType.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSources()).that(asList(JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_field_type/BadRecordGenericFieldTypeSproc.java"), record)).processedWith(processor).failsToCompile().withErrorCount(3);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType1 is not supported").in(record).onLine(34);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType2 is not supported").in(record).onLine(35);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType3 is not supported").in(record).onLine(36);
}
use of javax.tools.JavaFileObject in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_parameters_are_not_properly_annotated.
@Test
public void fails_if_parameters_are_not_properly_annotated() {
JavaFileObject sproc = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/missing_name/MissingNameSproc.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSource()).that(sproc).processedWith(processor).failsToCompile().withErrorCount(2);
compilation.withErrorContaining("@org.neo4j.procedure.Name usage error: missing on parameter <parameter>").in(sproc).onLine(35);
compilation.withErrorContaining("@org.neo4j.procedure.Name usage error: missing on parameter <otherParam>").in(sproc).onLine(35);
}
use of javax.tools.JavaFileObject in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_procedure_generic_input_type_is_not_supported.
@Test
public void fails_if_procedure_generic_input_type_is_not_supported() {
JavaFileObject sproc = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_proc_input_type/BadGenericInputSproc.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSource()).that(sproc).processedWith(processor).failsToCompile().withErrorCount(3);
compilation.withErrorContaining("Unsupported parameter type " + "<java.util.List<java.util.List<java.util.Map<java.lang.String,java.lang.Thread>>>>" + " of procedure|function BadGenericInputSproc#doSomething").in(sproc).onLine(36);
compilation.withErrorContaining("Unsupported parameter type " + "<java.util.Map<java.lang.String,java.util.List<java.util.concurrent.ExecutorService>>>" + " of procedure|function BadGenericInputSproc#doSomething2").in(sproc).onLine(42);
compilation.withErrorContaining("Unsupported parameter type <java.util.Map> of procedure|function BadGenericInputSproc#doSomething3").in(sproc).onLine(48);
}
use of javax.tools.JavaFileObject in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_duplicate_procedures_are_declared.
@Test
public void fails_if_duplicate_procedures_are_declared() {
JavaFileObject firstDuplicate = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/duplicated/Sproc1.java");
JavaFileObject secondDuplicate = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/duplicated/Sproc2.java");
assert_().about(javaSources()).that(asList(firstDuplicate, secondDuplicate)).processedWith(processor).failsToCompile().withErrorCount(2).withErrorContaining("Procedure|function name <org.neo4j.tooling.procedure.procedures.invalid.duplicated.foobar> is " + "already defined 2 times. It should be defined only once!");
}
Aggregations