use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.
the class TransactionStateMachineSPIProviderV4Test method managementService.
private DatabaseManagementService managementService(String databaseName) {
DatabaseManagementService managementService = mock(DatabaseManagementService.class);
GraphDatabaseFacade databaseFacade = mock(GraphDatabaseFacade.class);
final DependencyResolver dependencyResolver = mock(DependencyResolver.class);
GraphDatabaseQueryService queryService = mock(GraphDatabaseQueryService.class);
when(databaseFacade.isAvailable(anyLong())).thenReturn(true);
when(managementService.database(databaseName)).thenReturn(databaseFacade);
when(databaseFacade.getDependencyResolver()).thenReturn(dependencyResolver);
when(dependencyResolver.resolveDependency(GraphDatabaseQueryService.class)).thenReturn(queryService);
when(dependencyResolver.resolveDependency(Database.class)).thenReturn(mock(Database.class));
when(queryService.getDependencyResolver()).thenReturn(dependencyResolver);
return managementService;
}
use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.
the class UniqueIndexRecoveryTest method rotateLogAndCheckPoint.
private void rotateLogAndCheckPoint() throws IOException {
DependencyResolver resolver = db.getDependencyResolver();
resolver.resolveDependency(LogRotation.class).rotateLogFile(LogAppendEvent.NULL);
resolver.resolveDependency(CheckPointer.class).forceCheckPoint(new SimpleTriggerInfo("test"));
}
use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listFunctions.
@Deprecated(since = "4.3.0", forRemoval = true)
@SystemProcedure
@Description("List all functions in the DBMS.")
@Procedure(name = "dbms.functions", mode = DBMS, deprecatedBy = "SHOW FUNCTIONS command")
public Stream<FunctionResult> listFunctions() {
DependencyResolver resolver = graph.getDependencyResolver();
QueryExecutionEngine queryExecutionEngine = resolver.resolveDependency(QueryExecutionEngine.class);
List<FunctionInformation> providedLanguageFunctions = queryExecutionEngine.getProvidedLanguageFunctions();
var globalProcedures = resolver.resolveDependency(GlobalProcedures.class);
// gets you all functions provided by the query language
Stream<FunctionResult> languageFunctions = providedLanguageFunctions.stream().map(FunctionResult::new);
// gets you all non-aggregating functions that are registered in the db (incl. those from libs like apoc)
Stream<FunctionResult> loadedFunctions = globalProcedures.getAllNonAggregatingFunctions().map(f -> new FunctionResult(f, false));
// gets you all aggregation functions that are registered in the db (incl. those from libs like apoc)
Stream<FunctionResult> loadedAggregationFunctions = globalProcedures.getAllAggregatingFunctions().map(f -> new FunctionResult(f, true));
return Stream.concat(Stream.concat(languageFunctions, loadedFunctions), loadedAggregationFunctions).sorted(Comparator.comparing(a -> a.name));
}
use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.
the class DatabaseAvailabilityIT method notConfusingMessageOnDatabaseNonAvailability.
@Test
void notConfusingMessageOnDatabaseNonAvailability() {
DependencyResolver dependencyResolver = database.getDependencyResolver();
DatabaseManager<?> databaseManager = getDatabaseManager(dependencyResolver);
DatabaseContext databaseContext = databaseManager.getDatabaseContext(defaultNamedDatabaseId).get();
DatabaseAvailability databaseAvailability = databaseContext.database().getDependencyResolver().resolveDependency(DatabaseAvailability.class);
databaseAvailability.stop();
TransactionFailureException exception = assertThrows(TransactionFailureException.class, () -> database.beginTx());
assertEquals("Timeout waiting for database to become available and allow new transactions. Waited 1s. 1 reasons for blocking: Database unavailable.", exception.getMessage());
}
use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.
the class BoltV3TransportIT method getLastClosedTransactionId.
private long getLastClosedTransactionId() {
DependencyResolver resolver = ((GraphDatabaseAPI) server.graphDatabaseService()).getDependencyResolver();
TransactionIdStore txIdStore = resolver.resolveDependency(TransactionIdStore.class);
return txIdStore.getLastClosedTransactionId();
}
Aggregations