use of org.neo4j.exceptions.KernelException in project neo4j by neo4j.
the class DatabaseManagementServiceImpl method systemDatabaseExecute.
private void systemDatabaseExecute(String query, SystemDatabaseExecutionContext beforeCommitHook) {
try {
GraphDatabaseAPI database = (GraphDatabaseAPI) database(SYSTEM_DATABASE_NAME);
try (InternalTransaction transaction = database.beginTransaction(KernelTransaction.Type.EXPLICIT, LoginContext.AUTH_DISABLED)) {
transaction.execute(query);
beforeCommitHook.accept(database, transaction);
transaction.commit();
}
} catch (QueryExecutionException | KernelException e) {
throw new DatabaseManagementException(e);
}
}
use of org.neo4j.exceptions.KernelException 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());
}
use of org.neo4j.exceptions.KernelException 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.exceptions.KernelException in project neo4j by neo4j.
the class SchemaImpl method getIndexPopulationProgress.
@Override
public IndexPopulationProgress getIndexPopulationProgress(IndexDefinition index) {
try {
transaction.assertOpen();
SchemaRead schemaRead = transaction.schemaRead();
IndexDescriptor descriptor = getIndexReference(schemaRead, transaction.tokenRead(), (IndexDefinitionImpl) index);
PopulationProgress progress = schemaRead.indexGetPopulationProgress(descriptor);
return progress.toIndexPopulationProgress();
} catch (KernelException e) {
throw newIndexNotFoundException(index, e);
}
}
use of org.neo4j.exceptions.KernelException in project neo4j by neo4j.
the class SchemaImpl method getIndexFailure.
@Override
public String getIndexFailure(IndexDefinition index) {
try {
transaction.assertOpen();
SchemaRead schemaRead = transaction.schemaRead();
IndexDescriptor descriptor = getIndexReference(schemaRead, transaction.tokenRead(), (IndexDefinitionImpl) index);
return schemaRead.indexGetFailure(descriptor);
} catch (KernelException e) {
throw newIndexNotFoundException(index, e);
}
}
Aggregations