Search in sources :

Example 6 with SimpleKernelContext

use of org.neo4j.kernel.impl.spi.SimpleKernelContext in project neo4j by neo4j.

the class BackupServiceIT method backupsShouldBeMentionedInServerConsoleLog.

@Test
public void backupsShouldBeMentionedInServerConsoleLog() throws Throwable {
    // given
    defaultBackupPortHostParams();
    Config config = dbRule.getConfigCopy();
    dbRule.setConfig(OnlineBackupSettings.online_backup_enabled, "false");
    Config withOnlineBackupDisabled = dbRule.getConfigCopy();
    createAndIndexNode(dbRule, 1);
    final Log log = mock(Log.class);
    LogProvider logProvider = new LogProvider() {

        @Override
        public Log getLog(Class loggingClass) {
            return log;
        }

        @Override
        public Log getLog(String name) {
            return log;
        }
    };
    Logger logger = mock(Logger.class);
    when(log.infoLogger()).thenReturn(logger);
    LogService logService = mock(LogService.class);
    when(logService.getInternalLogProvider()).thenReturn(logProvider);
    Dependencies dependencies = new Dependencies(dbRule.getDependencyResolver());
    dependencies.satisfyDependencies(config, monitors, logService);
    OnlineBackupKernelExtension backup = (OnlineBackupKernelExtension) new OnlineBackupExtensionFactory().newInstance(new SimpleKernelContext(storeDir, DatabaseInfo.UNKNOWN, dependencies), DependenciesProxy.dependencies(dependencies, OnlineBackupExtensionFactory.Dependencies.class));
    backup.start();
    // when
    backupService().doFullBackup(BACKUP_HOST, backupPort, backupDir, ConsistencyCheck.NONE, withOnlineBackupDisabled, BackupClient.BIG_READ_TIMEOUT, false);
    // then
    verify(logger).log("Full backup started...");
    verify(logger).log("Full backup finished.");
    // when
    createAndIndexNode(dbRule, 2);
    backupService().doIncrementalBackupOrFallbackToFull(BACKUP_HOST, backupPort, backupDir, ConsistencyCheck.NONE, withOnlineBackupDisabled, BackupClient.BIG_READ_TIMEOUT, false);
    backup.stop();
    // then
    verify(logger).log("Incremental backup started...");
    verify(logger).log("Incremental backup finished.");
}
Also used : NullLogProvider(org.neo4j.logging.NullLogProvider) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) LogProvider(org.neo4j.logging.LogProvider) Log(org.neo4j.logging.Log) Config(org.neo4j.kernel.configuration.Config) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Dependencies(org.neo4j.kernel.impl.util.Dependencies) Logger(org.neo4j.logging.Logger) LogService(org.neo4j.kernel.impl.logging.LogService) Test(org.junit.Test)

Example 7 with SimpleKernelContext

use of org.neo4j.kernel.impl.spi.SimpleKernelContext in project neo4j by neo4j.

the class NeoStoreDataSourceRule method nativeLabelScanStoreProvider.

public static LabelScanStoreProvider nativeLabelScanStoreProvider(File storeDir, FileSystemAbstraction fs, PageCache pageCache, Config config, LogService logService) {
    try {
        Dependencies dependencies = new Dependencies();
        dependencies.satisfyDependencies(pageCache, config, IndexStoreView.EMPTY, logService);
        KernelContext kernelContext = new SimpleKernelContext(storeDir, DatabaseInfo.COMMUNITY, dependencies);
        return (LabelScanStoreProvider) new NativeLabelScanStoreExtension().newInstance(kernelContext, DependenciesProxy.dependencies(dependencies, NativeLabelScanStoreExtension.Dependencies.class));
    } catch (Throwable e) {
        throw launderedException(e);
    }
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) NativeLabelScanStoreExtension(org.neo4j.kernel.impl.api.scan.NativeLabelScanStoreExtension) Dependencies(org.neo4j.kernel.impl.util.Dependencies) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) KernelContext(org.neo4j.kernel.impl.spi.KernelContext)

Aggregations

SimpleKernelContext (org.neo4j.kernel.impl.spi.SimpleKernelContext)7 Dependencies (org.neo4j.kernel.impl.util.Dependencies)7 KernelContext (org.neo4j.kernel.impl.spi.KernelContext)4 File (java.io.File)3 PageCache (org.neo4j.io.pagecache.PageCache)3 Config (org.neo4j.kernel.configuration.Config)3 Log (org.neo4j.logging.Log)3 IOException (java.io.IOException)2 Test (org.junit.Test)2 AccessStatistics (org.neo4j.consistency.statistics.AccessStatistics)2 AccessStatsKeepingStoreAccess (org.neo4j.consistency.statistics.AccessStatsKeepingStoreAccess)2 DefaultCounts (org.neo4j.consistency.statistics.DefaultCounts)2 VerboseStatistics (org.neo4j.consistency.statistics.VerboseStatistics)2 DirectStoreAccess (org.neo4j.kernel.api.direct.DirectStoreAccess)2 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)2 LabelScanStore (org.neo4j.kernel.api.labelscan.LabelScanStore)2 KernelExtensions (org.neo4j.kernel.extension.KernelExtensions)2 NamedLabelScanStoreSelectionStrategy (org.neo4j.kernel.extension.dependency.NamedLabelScanStoreSelectionStrategy)2 IndexStoreView (org.neo4j.kernel.impl.api.index.IndexStoreView)2 LabelScanStoreProvider (org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider)2