use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class HumanUnderstandableExecutionMonitorIT method shouldStartFromNonFirstStage.
@Test
void shouldStartFromNonFirstStage() {
// given
HumanUnderstandableExecutionMonitor monitor = new HumanUnderstandableExecutionMonitor(HumanUnderstandableExecutionMonitor.NO_MONITOR);
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(Input.knownEstimates(10, 10, 10, 10, 10, 10, 10));
BatchingNeoStores neoStores = mock(BatchingNeoStores.class);
NodeStore nodeStore = mock(NodeStore.class);
RelationshipStore relationshipStore = mock(RelationshipStore.class);
when(neoStores.getNodeStore()).thenReturn(nodeStore);
when(neoStores.getRelationshipStore()).thenReturn(relationshipStore);
dependencies.satisfyDependency(neoStores);
dependencies.satisfyDependency(IdMappers.actual());
dependencies.satisfyDependency(mock(PageCacheArrayFactoryMonitor.class));
dependencies.satisfyDependency(new DataStatistics(10, 10, new DataStatistics.RelationshipTypeCount[0]));
monitor.initialize(dependencies);
// when/then
StageExecution execution = mock(StageExecution.class);
when(execution.getStageName()).thenReturn(NodeDegreeCountStage.NAME);
assertThatCode(() -> monitor.start(execution)).doesNotThrowAnyException();
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class PropertyStoreTraceIT method configure.
@ExtensionCallback
void configure(TestDatabaseManagementServiceBuilder builder) {
var dependencies = new Dependencies();
// disabling periodic id buffers maintenance jobs
dependencies.satisfyDependency(new CentralJobScheduler(Clocks.nanoClock()) {
@Override
public JobHandle<?> scheduleRecurring(Group group, JobMonitoringParams monitoredJobParams, Runnable runnable, long period, TimeUnit timeUnit) {
return JobHandle.EMPTY;
}
@Override
public JobHandle<?> scheduleRecurring(Group group, JobMonitoringParams monitoredJobParams, Runnable runnable, long initialDelay, long period, TimeUnit unit) {
return JobHandle.EMPTY;
}
});
builder.setExternalDependencies(dependencies);
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class TransactionRangeDiagnosticsTest method databaseWithLogFilesContainingLowestTxId.
private static Database databaseWithLogFilesContainingLowestTxId(LogFiles files) {
Dependencies dependencies = mock(Dependencies.class);
when(dependencies.resolveDependency(LogFiles.class)).thenReturn(files);
Database database = mock(Database.class);
when(database.getDependencyResolver()).thenReturn(dependencies);
return database;
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class KernelTransactionTestBase method newNotInitializedTransaction.
KernelTransactionImplementation newNotInitializedTransaction(LeaseService leaseService, Config config, NamedDatabaseId databaseId) {
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(mock(GraphDatabaseFacade.class));
var memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, ByteUnit.mebiBytes(4), null);
return new KernelTransactionImplementation(config, mock(DatabaseTransactionEventListeners.class), null, null, commitProcess, transactionMonitor, txPool, clock, new AtomicReference<>(CpuClock.NOT_AVAILABLE), mock(DatabaseTracers.class, RETURNS_MOCKS), storageEngine, any -> CanWrite.INSTANCE, EmptyVersionContextSupplier.EMPTY, () -> collectionsFactory, new StandardConstraintSemantics(), mock(SchemaState.class), mockedTokenHolders(), mock(IndexingService.class), mock(IndexStatisticsStore.class), dependencies, databaseId, leaseService, memoryPool, new DatabaseReadOnlyChecker.Default(new DbmsReadOnlyChecker.Default(config), databaseId.name()), TransactionExecutionMonitor.NO_OP, CommunitySecurityLog.NULL_LOG, () -> KernelVersion.LATEST, mock(DbmsRuntimeRepository.class));
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class DbmsDiagnosticsManagerTest method setUp.
@BeforeEach
@SuppressWarnings("unchecked")
void setUp() throws IOException {
logProvider = new AssertableLogProvider();
databaseManager = mock(DatabaseManager.class);
storageEngine = mock(StorageEngine.class);
storageEngineFactory = mock(StorageEngineFactory.class);
defaultContext = mock(StandaloneDatabaseContext.class);
defaultDatabase = prepareDatabase();
when(storageEngineFactory.listStorageFiles(any(), any())).thenReturn(Collections.emptyList());
dependencies = new Dependencies();
dependencies.satisfyDependency(Config.defaults());
dependencies.satisfyDependency(databaseManager);
when(defaultContext.database()).thenReturn(defaultDatabase);
when(databaseManager.getDatabaseContext(DEFAULT_DATABASE_ID)).thenReturn(Optional.of(defaultContext));
when(databaseManager.registeredDatabases()).thenReturn(new TreeMap<>(singletonMap(DEFAULT_DATABASE_ID, defaultContext)));
diagnosticsManager = new DbmsDiagnosticsManager(dependencies, new SimpleLogService(logProvider));
}
Aggregations