use of org.neo4j.kernel.api.proc.ProcedureSignature 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)));
}
use of org.neo4j.kernel.api.proc.ProcedureSignature in project neo4j by neo4j.
the class ProceduresKernelIT method shouldGetProcedureByName.
@Test
public void shouldGetProcedureByName() throws Throwable {
// Given
kernel.registerProcedure(procedure);
// When
ProcedureSignature found = readOperationsInNewTransaction().procedureGet(new QualifiedName(new String[] { "example" }, "exampleProc"));
// Then
assertThat(found, equalTo(signature));
}
use of org.neo4j.kernel.api.proc.ProcedureSignature in project neo4j by neo4j.
the class ProcedureSignatureTest method toStringForVoidProcedureShouldMatchCypherSyntax.
@Test
public void toStringForVoidProcedureShouldMatchCypherSyntax() throws Throwable {
// Given
ProcedureSignature proc = procedureSignature("org", "myProcedure").in("inputArg", Neo4jTypes.NTList(Neo4jTypes.NTString)).out(ProcedureSignature.VOID).build();
// When
String toStr = proc.toString();
// Then
assertEquals("org.myProcedure(inputArg :: LIST? OF STRING?) :: VOID", toStr);
}
use of org.neo4j.kernel.api.proc.ProcedureSignature in project neo4j by neo4j.
the class ProcedureJarLoaderTest method shouldLoadProcedureFromJar.
@Test
public void shouldLoadProcedureFromJar() throws Throwable {
// Given
URL jar = createJarFor(ClassWithOneProcedure.class);
// When
List<CallableProcedure> procedures = jarloader.loadProcedures(jar).procedures();
// Then
List<ProcedureSignature> signatures = procedures.stream().map(CallableProcedure::signature).collect(toList());
assertThat(signatures, contains(procedureSignature("org", "neo4j", "kernel", "impl", "proc", "myProcedure").out("someNumber", NTInteger).build()));
assertThat(asList(procedures.get(0).apply(new BasicContext(), new Object[0])), contains(IsEqual.equalTo(new Object[] { 1337L })));
}
use of org.neo4j.kernel.api.proc.ProcedureSignature in project neo4j by neo4j.
the class ProcedureJarLoaderTest method shouldLoadProcedureFromJarWithMultipleProcedureClasses.
@Test
public void shouldLoadProcedureFromJarWithMultipleProcedureClasses() throws Throwable {
// Given
URL jar = createJarFor(ClassWithOneProcedure.class, ClassWithAnotherProcedure.class, ClassWithNoProcedureAtAll.class);
// When
List<CallableProcedure> procedures = jarloader.loadProcedures(jar).procedures();
// Then
List<ProcedureSignature> signatures = procedures.stream().map(CallableProcedure::signature).collect(toList());
assertThat(signatures, containsInAnyOrder(procedureSignature("org", "neo4j", "kernel", "impl", "proc", "myOtherProcedure").out("someNumber", NTInteger).build(), procedureSignature("org", "neo4j", "kernel", "impl", "proc", "myProcedure").out("someNumber", NTInteger).build()));
}
Aggregations