use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class ProceduresKernelIT method shouldCallReadOnlyProcedure.
@Test
void shouldCallReadOnlyProcedure() throws Throwable {
// Given
internalKernel().registerProcedure(procedure);
// When
RawIterator<AnyValue[], ProcedureException> found = procs().procedureCallRead(procs().procedureGet(new QualifiedName(new String[] { "example" }, "exampleProc")).id(), new AnyValue[] { longValue(1337) }, ProcedureCallContext.EMPTY);
// Then
assertThat(asList(found)).contains(new AnyValue[] { longValue(1337) });
commit();
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class ProcedureHolderTest method shouldGetProcedureFromHolder.
@Test
void shouldGetProcedureFromHolder() {
// given
ProcedureHolder<String> procHolder = new ProcedureHolder<>();
QualifiedName qualifiedName = new QualifiedName(new String[0], "CaseSensitive");
String item = "CaseSensitiveItem";
procHolder.put(qualifiedName, item, false);
// then
assertThat(procHolder.get(qualifiedName)).isEqualTo(item);
assertThat(procHolder.idOf(qualifiedName)).isEqualTo(0);
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class ProcedureHolderTest method okToHaveProcsOnlyDifferByCase.
@Test
void okToHaveProcsOnlyDifferByCase() {
// given
ProcedureHolder<String> procHolder = new ProcedureHolder<>();
procHolder.put(new QualifiedName(new String[0], "CASESENSITIVE"), "CASESENSITIVEItem", false);
procHolder.put(new QualifiedName(new String[0], "CaseSensitive"), "CaseSensitiveItem", false);
// then
assertThat(procHolder.get(new QualifiedName(new String[0], "CASESENSITIVE"))).isEqualTo("CASESENSITIVEItem");
assertThat(procHolder.get(new QualifiedName(new String[0], "CaseSensitive"))).isEqualTo("CaseSensitiveItem");
assertThat(procHolder.idOf(new QualifiedName(new String[0], "CASESENSITIVE"))).isEqualTo(0);
assertThat(procHolder.idOf(new QualifiedName(new String[0], "CaseSensitive"))).isEqualTo(1);
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class BuiltInDbmsProceduresIT method listCapabilitiesShouldReturnDynamicValues.
@Test
void listCapabilitiesShouldReturnDynamicValues() throws KernelException {
QualifiedName procedureName = procedureName("dbms", "listCapabilities");
int procedureId = procs().procedureGet(procedureName).id();
// first call
RawIterator<AnyValue[], ProcedureException> callResult = procs().procedureCallDbms(procedureId, new AnyValue[] {}, ProcedureCallContext.EMPTY);
List<AnyValue[]> capabilities = asList(callResult);
// should return false
assertThat(capabilities).contains(new AnyValue[] { Values.stringValue(TestCapabilities.my_dynamic_capability.name().fullName()), Values.stringValue(TestCapabilities.my_dynamic_capability.description()), Values.booleanValue(false) });
try (var txc = db.beginTx()) {
txc.createNode(label("my_dynamic_capability"));
txc.commit();
}
// second call
callResult = procs().procedureCallDbms(procedureId, new AnyValue[] {}, ProcedureCallContext.EMPTY);
capabilities = asList(callResult);
// should return true
assertThat(capabilities).contains(new AnyValue[] { Values.stringValue(TestCapabilities.my_dynamic_capability.name().fullName()), Values.stringValue(TestCapabilities.my_dynamic_capability.description()), Values.booleanValue(true) });
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class BuiltInDbmsProceduresIT method listCapabilities.
@Test
void listCapabilities() throws KernelException {
QualifiedName procedureName = procedureName("dbms", "listCapabilities");
int procedureId = procs().procedureGet(procedureName).id();
RawIterator<AnyValue[], ProcedureException> callResult = procs().procedureCallDbms(procedureId, new AnyValue[] {}, ProcedureCallContext.EMPTY);
List<AnyValue[]> capabilities = asList(callResult);
List<String> capabilityNames = capabilities.stream().map(c -> ((TextValue) c[0]).stringValue()).collect(Collectors.toList());
assertThat(capabilityNames).containsExactlyInAnyOrder(TestCapabilities.my_custom_capability.name().fullName(), TestCapabilities.my_dynamic_capability.name().fullName());
}
Aggregations