Search in sources :

Example 11 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class DatabaseManagementServiceFactoryTest method setup.

@BeforeEach
void setup() {
    when(deps.monitors()).thenReturn(new Monitors());
    when(deps.dependencies()).thenReturn(null);
}
Also used : Monitors(org.neo4j.monitoring.Monitors) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class StoreUpgraderInterruptionTestIT method newUpgrader.

private StoreUpgrader newUpgrader(StoreVersionCheck versionCheck, MigrationProgressMonitor progressMonitor, StoreMigrationParticipant... participants) {
    Config config = Config.defaults(allow_upgrade, true);
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(new Monitors());
    RecordStorageEngineFactory storageEngineFactory = new RecordStorageEngineFactory();
    var databaseHealth = new DatabaseHealth(PanicEventGenerator.NO_OP, NullLog.getInstance());
    LogsUpgrader logsUpgrader = new LogsUpgrader(fs, storageEngineFactory, workingDatabaseLayout, pageCache, legacyTransactionLogsLocator, config, dependencies, NULL, INSTANCE, databaseHealth, false);
    StoreUpgrader upgrader = new StoreUpgrader(versionCheck, progressMonitor, config, fs, NullLogProvider.getInstance(), logsUpgrader, NULL);
    for (StoreMigrationParticipant participant : participants) {
        upgrader.addParticipant(participant);
    }
    return upgrader;
}
Also used : DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) RecordStorageEngineFactory(org.neo4j.internal.recordstorage.RecordStorageEngineFactory) LogsUpgrader(org.neo4j.kernel.impl.storemigration.LogsUpgrader) Config(org.neo4j.configuration.Config) StoreMigrationParticipant(org.neo4j.storageengine.migration.StoreMigrationParticipant) Monitors(org.neo4j.monitoring.Monitors) Dependencies(org.neo4j.collection.Dependencies) StoreUpgrader(org.neo4j.kernel.impl.storemigration.StoreUpgrader)

Example 13 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class LuceneIndexAccessorIT method setUp.

@BeforeEach
void setUp() {
    Path path = directory.directory("db");
    config = Config.defaults();
    readOnlyChecker = new DatabaseReadOnlyChecker.Default(config, DEFAULT_DATABASE_NAME);
    indexProvider = new LuceneIndexProvider(directory.getFileSystem(), PERSISTENT, directoriesByProvider(path), new Monitors(), config, readOnlyChecker);
    life.add(indexProvider);
    life.start();
    samplingConfig = new IndexSamplingConfig(config);
}
Also used : Path(java.nio.file.Path) IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) DatabaseReadOnlyChecker(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker) Monitors(org.neo4j.monitoring.Monitors) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class LuceneSchemaIndexCorruptionTest method newFaultyIndexProvider.

private LuceneIndexProvider newFaultyIndexProvider(long faultyIndexId, Exception error) {
    DirectoryFactory directoryFactory = mock(DirectoryFactory.class);
    Path indexRootFolder = testDirectory.homePath();
    AtomicReference<FaultyIndexStorageFactory> reference = new AtomicReference<>();
    Monitors monitors = new Monitors();
    monitors.addMonitorListener(monitor);
    return new LuceneIndexProvider(fs, directoryFactory, directoriesByProvider(indexRootFolder), monitors, Config.defaults(), readOnly()) {

        @Override
        protected IndexStorageFactory buildIndexStorageFactory(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory) {
            FaultyIndexStorageFactory storageFactory = new FaultyIndexStorageFactory(faultyIndexId, error, directoryFactory, directoryStructure());
            reference.set(storageFactory);
            return storageFactory;
        }
    };
}
Also used : Path(java.nio.file.Path) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Monitors(org.neo4j.monitoring.Monitors) AtomicReference(java.util.concurrent.atomic.AtomicReference)

Example 15 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class LuceneSchemaIndexPopulatorTest method before.

@BeforeEach
void before() throws IOException {
    directory = new ByteBuffersDirectory();
    DirectoryFactory directoryFactory = new DirectoryFactory.Single(new DirectoryFactory.UncloseableDirectory(directory));
    provider = new LuceneIndexProvider(fs, directoryFactory, directoriesByProvider(testDir.directory("folder")), new Monitors(), Config.defaults(), writable());
    propertyAccessor = mock(NodePropertyAccessor.class);
    IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.defaults());
    index = IndexPrototype.forSchema(forLabel(42, propertyKeyId), provider.getProviderDescriptor()).withName("index").materialise(0);
    indexPopulator = provider.getPopulator(index, samplingConfig, heapBufferFactory(1024), INSTANCE, SIMPLE_TOKEN_LOOKUP);
    indexPopulator.create();
}
Also used : IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) ByteBuffersDirectory(org.apache.lucene.store.ByteBuffersDirectory) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Monitors(org.neo4j.monitoring.Monitors) NodePropertyAccessor(org.neo4j.storageengine.api.NodePropertyAccessor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Monitors (org.neo4j.monitoring.Monitors)45 Test (org.junit.jupiter.api.Test)13 Path (java.nio.file.Path)7 Config (org.neo4j.configuration.Config)7 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)7 Dependencies (org.neo4j.collection.Dependencies)6 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)5 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)5 BoltKernelDatabaseManagementServiceProvider (org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)4 Log (org.neo4j.logging.Log)4 MemoryTracker (org.neo4j.memory.MemoryTracker)4 IOException (java.io.IOException)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)3