Search in sources :

Example 31 with Dependencies

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();
}
Also used : NodeStore(org.neo4j.kernel.impl.store.NodeStore) BatchingNeoStores(org.neo4j.internal.batchimport.store.BatchingNeoStores) PageCacheArrayFactoryMonitor(org.neo4j.internal.batchimport.cache.PageCacheArrayFactoryMonitor) RelationshipStore(org.neo4j.kernel.impl.store.RelationshipStore) DataStatistics(org.neo4j.internal.batchimport.DataStatistics) Dependencies(org.neo4j.collection.Dependencies) Test(org.junit.jupiter.api.Test)

Example 32 with Dependencies

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);
}
Also used : Group(org.neo4j.scheduler.Group) JobHandle(org.neo4j.scheduler.JobHandle) TimeUnit(java.util.concurrent.TimeUnit) Dependencies(org.neo4j.collection.Dependencies) CentralJobScheduler(org.neo4j.kernel.impl.scheduler.CentralJobScheduler) JobMonitoringParams(org.neo4j.scheduler.JobMonitoringParams) ExtensionCallback(org.neo4j.test.extension.ExtensionCallback)

Example 33 with 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;
}
Also used : Database(org.neo4j.kernel.database.Database) Dependencies(org.neo4j.collection.Dependencies)

Example 34 with Dependencies

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));
}
Also used : DatabaseTracers(org.neo4j.kernel.database.DatabaseTracers) DbmsRuntimeRepository(org.neo4j.dbms.database.DbmsRuntimeRepository) MemoryPools(org.neo4j.memory.MemoryPools) SchemaState(org.neo4j.internal.schema.SchemaState) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) DatabaseReadOnlyChecker(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker) IndexStatisticsStore(org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore) DatabaseTransactionEventListeners(org.neo4j.kernel.internal.event.DatabaseTransactionEventListeners) Dependencies(org.neo4j.collection.Dependencies) GraphDatabaseFacade(org.neo4j.kernel.impl.factory.GraphDatabaseFacade) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)

Example 35 with Dependencies

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));
}
Also used : DatabaseManager(org.neo4j.dbms.database.DatabaseManager) SimpleLogService(org.neo4j.logging.internal.SimpleLogService) StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) Dependencies(org.neo4j.collection.Dependencies) StorageEngine(org.neo4j.storageengine.api.StorageEngine) StandaloneDatabaseContext(org.neo4j.dbms.database.StandaloneDatabaseContext) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Dependencies (org.neo4j.collection.Dependencies)40 Test (org.junit.jupiter.api.Test)13 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)7 Config (org.neo4j.configuration.Config)6 Monitors (org.neo4j.monitoring.Monitors)6 PageCache (org.neo4j.io.pagecache.PageCache)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)5 StorageEngine (org.neo4j.storageengine.api.StorageEngine)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 Database (org.neo4j.kernel.database.Database)4 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)4 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)4 IOException (java.io.IOException)3 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)3 GlobalExtensionContext (org.neo4j.kernel.extension.context.GlobalExtensionContext)3 IndexStatisticsStore (org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore)3