Search in sources :

Example 11 with FieldSignature

use of org.neo4j.kernel.api.proc.FieldSignature in project neo4j by neo4j.

the class GetServersProcedureV2Test method shouldHaveCorrectSignature.

@Test
public void shouldHaveCorrectSignature() throws Exception {
    // given
    GetServersProcedureForMultiDC proc = new GetServersProcedureForMultiDC(null);
    // when
    ProcedureSignature signature = proc.signature();
    // then
    assertThat(signature.inputSignature(), containsInAnyOrder(new FieldSignature("context", NTMap)));
    assertThat(signature.outputSignature(), containsInAnyOrder(new FieldSignature("ttl", NTInteger), new FieldSignature("servers", NTMap)));
}
Also used : ProcedureSignature(org.neo4j.kernel.api.proc.ProcedureSignature) FieldSignature(org.neo4j.kernel.api.proc.FieldSignature) Test(org.junit.Test)

Example 12 with FieldSignature

use of org.neo4j.kernel.api.proc.FieldSignature in project neo4j by neo4j.

the class UserFunctionSignatureTest method inputSignatureShouldNotBeModifiable.

@Test
public void inputSignatureShouldNotBeModifiable() throws Throwable {
    // Expect
    exception.expect(UnsupportedOperationException.class);
    // When
    signature.inputSignature().add(new FieldSignature("in2", Neo4jTypes.NTAny));
}
Also used : FieldSignature(org.neo4j.kernel.api.proc.FieldSignature) Test(org.junit.Test)

Example 13 with FieldSignature

use of org.neo4j.kernel.api.proc.FieldSignature in project neo4j by neo4j.

the class MethodSignatureCompilerTest method shouldMapSimpleRecordWithString.

@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(new FieldSignature("name", Neo4jTypes.NTString)));
}
Also used : FieldSignature(org.neo4j.kernel.api.proc.FieldSignature) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

FieldSignature (org.neo4j.kernel.api.proc.FieldSignature)13 Test (org.junit.Test)8 ProcedureException (org.neo4j.kernel.api.exceptions.ProcedureException)5 MethodHandle (java.lang.invoke.MethodHandle)4 ComponentInjectionException (org.neo4j.kernel.api.exceptions.ComponentInjectionException)3 ProcedureSignature (org.neo4j.kernel.api.proc.ProcedureSignature)3 OutputMapper (org.neo4j.kernel.impl.proc.OutputMappers.OutputMapper)3 Method (java.lang.reflect.Method)2 UserFunctionSignature (org.neo4j.kernel.api.proc.UserFunctionSignature)2 Field (java.lang.reflect.Field)1 Parameter (java.lang.reflect.Parameter)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1 CallableProcedure (org.neo4j.kernel.api.proc.CallableProcedure)1 CallableUserAggregationFunction (org.neo4j.kernel.api.proc.CallableUserAggregationFunction)1 CallableUserFunction (org.neo4j.kernel.api.proc.CallableUserFunction)1 FailedLoadAggregatedFunction (org.neo4j.kernel.api.proc.FailedLoadAggregatedFunction)1 FailedLoadFunction (org.neo4j.kernel.api.proc.FailedLoadFunction)1 FailedLoadProcedure (org.neo4j.kernel.api.proc.FailedLoadProcedure)1 NeoValueConverter (org.neo4j.kernel.impl.proc.TypeMappers.NeoValueConverter)1