use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class BuiltInDbmsProceduresIT method listClientConfig.
@Test
void listClientConfig() throws Exception {
QualifiedName procedureName = procedureName("dbms", "clientConfig");
int procedureId = procs().procedureGet(procedureName).id();
RawIterator<AnyValue[], ProcedureException> callResult = procs().procedureCallDbms(procedureId, new AnyValue[] {}, ProcedureCallContext.EMPTY);
List<AnyValue[]> config = asList(callResult);
assertEquals(4, config.size());
assertEquals(config.get(0)[0], stringValue("browser.post_connect_cmd"));
assertEquals(config.get(1)[0], stringValue("browser.remote_content_hostname_whitelist"));
assertEquals(config.get(2)[0], stringValue("dbms.default_database"));
assertEquals(config.get(3)[0], stringValue("dbms.security.auth_enabled"));
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class BuiltInDbmsProceduresIT method listCapabilitiesShouldNotReturnBlocked.
@Test
void listCapabilitiesShouldNotReturnBlocked() throws KernelException {
// set blocked capabilities
Config config = dependencyResolver.resolveDependency(Config.class);
config.set(CapabilitiesSettings.dbms_capabilities_blocked, List.of("my.**"));
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).doesNotContain(TestCapabilities.my_custom_capability.name().fullName());
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class SchemaProcedureIT method testEmptyGraph.
@Test
void testEmptyGraph() throws Throwable {
// Given the database is empty
// When
Procedures procs = procs();
RawIterator<AnyValue[], ProcedureException> stream = procs.procedureCallRead(procs.procedureGet(procedureName("db", "schema", "visualization")).id(), new AnyValue[0], ProcedureCallContext.EMPTY);
// Then
assertThat(asList(stream)).containsExactly(new AnyValue[] { EMPTY_LIST, EMPTY_LIST });
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class DatabaseStateProcedure method extractDatabaseId.
protected NamedDatabaseId extractDatabaseId(AnyValue[] input) throws ProcedureException {
if (input.length != 1) {
throw new IllegalArgumentException("Illegal input:" + Arrays.toString(input));
}
var rawName = input[0];
if (!(rawName instanceof TextValue)) {
throw new IllegalArgumentException(format("Parameter '%s' value should have a string representation. Instead: %s", PARAMETER_NAME, rawName));
}
var name = new NormalizedDatabaseName(((TextValue) rawName).stringValue());
return idRepository.getByName(name).orElseThrow(() -> new ProcedureException(DatabaseNotFound, format("Unable to retrieve the status " + "for database with name %s because no database with this name exists!", name)));
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class BuiltInProceduresIT method listPropertyKeys.
@Test
void listPropertyKeys() throws Throwable {
// Given
TokenWrite ops = tokenWriteInNewTransaction();
ops.propertyKeyGetOrCreateForName("MyProp");
commit();
// When
RawIterator<AnyValue[], ProcedureException> stream = procs().procedureCallRead(procs().procedureGet(procedureName("db", "propertyKeys")).id(), new AnyValue[0], ProcedureCallContext.EMPTY);
// Then
assertThat(asList(stream)).containsExactly(new AnyValue[] { stringValue("MyProp") });
}
Aggregations