use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class ProcedureHolderTest method shouldGetCaseInsensitiveFromHolder.
@Test
void shouldGetCaseInsensitiveFromHolder() {
// given
ProcedureHolder<String> procHolder = new ProcedureHolder<>();
QualifiedName qualifiedName = new QualifiedName(new String[0], "CaseInSensitive");
String item = "CaseInSensitiveItem";
procHolder.put(qualifiedName, item, true);
// then
QualifiedName lowerCaseName = new QualifiedName(new String[0], "caseinsensitive");
assertThat(procHolder.get(lowerCaseName)).isEqualTo(item);
assertThat(procHolder.idOf(lowerCaseName)).isEqualTo(0);
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class SingleInstanceGetRoutingTableProcedureTest method shouldHaveCorrectNamespace.
@RoutingConfigsTest
void shouldHaveCorrectNamespace(Config config, String clientAddress) {
var portRegister = mock(ConnectorPortRegister.class);
var proc = newProcedure(portRegister, config);
var name = proc.signature().name();
assertEquals(new QualifiedName(new String[] { "dbms", "routing" }, "getRoutingTable"), name);
}
use of org.neo4j.internal.kernel.api.procs.QualifiedName in project neo4j by neo4j.
the class ProcedureRegistry method register.
/**
* Register a new function.
*
* @param function the function.
*/
public void register(CallableUserFunction function, boolean overrideCurrentImplementation, boolean builtIn) throws ProcedureException {
UserFunctionSignature signature = function.signature();
QualifiedName name = signature.name();
if (aggregationFunctions.get(name) != null) {
throw new ProcedureException(Status.Procedure.ProcedureRegistrationFailed, "Unable to register function, because the name `%s` is already in use as an aggregation function.", name);
}
CallableUserFunction oldImplementation = functions.get(name);
if (oldImplementation == null) {
functions.put(name, function, signature.caseInsensitive());
} else {
if (overrideCurrentImplementation) {
functions.put(name, function, signature.caseInsensitive());
} else {
throw new ProcedureException(Status.Procedure.ProcedureRegistrationFailed, "Unable to register function, because the name `%s` is already in use.", name);
}
}
if (builtIn) {
builtInFunctionIds.add(functions.idOf(name));
}
}
Aggregations