@Test public void shouldMapSimpleRecordWithString() throws Throwable { // When Method echo = ClassWithProcedureWithSimpleArgs.class.getMethod( "echo", String.class ); List<FieldSignature> signature = new MethodSignatureCompiler( new TypeMappers() ).signatureFor( echo ); // THen assertThat(signature, contains( FieldSignature.inputField( "name", Neo4jTypes.NTString ) )); }
@Test public void shouldMapSimpleFunctionWithString() throws Throwable { // When Method echo = ClassWithProcedureWithSimpleArgs.class.getMethod( "echo", String.class ); List<Neo4jTypes.AnyType> signature = new MethodSignatureCompiler( new TypeMappers() ).inputTypesFor( echo ); // THen assertThat(signature, contains( Neo4jTypes.NTString)); }
List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( update ); Class<?> returnType = result.getReturnType(); TypeMappers.TypeChecker valueConverter = typeMappers.checkerFor( returnType );
ReflectiveProcedureCompiler( TypeMappers typeMappers, ComponentRegistry safeComponents, ComponentRegistry allComponents, Log log, ProcedureConfig config ) { this( new MethodSignatureCompiler( typeMappers ), new OutputMappers( typeMappers ), new FieldInjections( safeComponents ), new FieldInjections( allComponents ), log, typeMappers, config, ReflectiveProcedureCompiler::rejectEmptyNamespace ); }
List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( method ); Class<?> returnType = method.getReturnType(); TypeMappers.TypeChecker typeChecker = typeMappers.checkerFor( returnType );
ReflectiveProcedureCompiler( TypeMappers typeMappers, ComponentRegistry safeComponents, ComponentRegistry allComponents, Log log, ProcedureConfig config ) { this( new MethodSignatureCompiler( typeMappers ), new OutputMappers( typeMappers ), new FieldInjections( safeComponents ), new FieldInjections( allComponents ), log, typeMappers, config, ReflectiveProcedureCompiler::rejectEmptyNamespace ); }
@Test public void shouldGiveHelpfulErrorOnMissingAnnotations() throws Throwable { // Given Method echo = ClassWithProcedureWithSimpleArgs.class.getMethod( "echoWithoutAnnotations", String.class, String.class); // Expect exception.expect( ProcedureException.class ); exception.expectMessage( String.format("Argument at position 1 in method `echoWithoutAnnotations` is missing an `@Name` " + "annotation.%n" + "Please add the annotation, recompile the class and try again." )); // When new MethodSignatureCompiler( new TypeMappers() ).signatureFor( echo ); } }
throws ProcedureException List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( method ); OutputMapper outputMapper = outputMappers.mapper( method );
@Test public void shouldGiveHelpfulErrorOnUnmappable() throws Throwable { // Given Method echo = ClassWithProcedureWithSimpleArgs.class.getMethod( "echoWithInvalidType", UnmappableRecord.class ); // Expect exception.expect( ProcedureException.class ); exception.expectMessage( String.format("Argument `name` at position 0 in `echoWithInvalidType` with%n" + "type `UnmappableRecord` cannot be converted to a Neo4j type: Don't know how to map " + "`org.neo4j.kernel.impl.proc.MethodSignatureCompilerTest$UnmappableRecord` to " + "the Neo4j Type System.%n" + "Please refer to to the documentation for full details.%n" + "For your reference, known types are:" )); // When new MethodSignatureCompiler( new TypeMappers() ).signatureFor( echo ); }
List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( update ); Class<?> returnType = result.getReturnType(); TypeMappers.TypeChecker valueConverter = typeMappers.checkerFor( returnType );
throws ProcedureException List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( method ); OutputMapper outputMapper = outputMappers.mapper( method );
List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor( method ); Class<?> returnType = method.getReturnType(); TypeMappers.TypeChecker typeChecker = typeMappers.checkerFor( returnType );