Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldStartPopulationAgainIfNotCompletedFirstTime()
        public virtual void ShouldStartPopulationAgainIfNotCompletedFirstTime()
        {
            // given
            // label scan store init but no start
            LifeSupport     life    = new LifeSupport();
            TrackingMonitor monitor = new TrackingMonitor();

            life.Add(CreateLabelScanStore(FileSystemRule.get(), TestDirectory.databaseLayout(), EMPTY, true, false, monitor));
            life.Init();
            assertTrue(monitor.NoIndexCalled);
            monitor.Reset();
            life.Shutdown();

            // when
            // starting label scan store again
            life = new LifeSupport();
            life.Add(CreateLabelScanStore(FileSystemRule.get(), TestDirectory.databaseLayout(), EMPTY, true, false, monitor));
            life.Init();

            // then
            // label scan store should recognize it still needs to be rebuilt
            assertTrue(monitor.CorruptedIndex);
            life.Start();
            assertTrue(monitor.RebuildingCalled);
            assertTrue(monitor.RebuiltCalled);
            life.Shutdown();
        }
        public override Statement Apply(Statement @base, Description description)
        {
            if (_chain == null)
            {
                if (_fs == null)
                {
                    _fs = new EphemeralFileSystemRule();
                }
                this._pageCacheRule = new PageCacheRule(_pageCacheConfig);
                this._directory     = TestDirectory.TestDirectoryConflict(_clazz, _fs);
                this._chain         = RuleChain.outerRule(_fs).around(_directory).around(_pageCacheRule);
            }

            return(_chain.apply(@base, description));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRestartPopulationIfIndexFileWasNeverFullyInitialized() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRestartPopulationIfIndexFileWasNeverFullyInitialized()
        {
            // given
            File labelScanStoreFile = NativeLabelScanStore.GetLabelScanStoreFile(TestDirectory.databaseLayout());

            FileSystemRule.create(labelScanStoreFile).close();
            TrackingMonitor monitor = new TrackingMonitor();
            LifeSupport     life    = new LifeSupport();

            // when
            life.Add(CreateLabelScanStore(FileSystemRule.get(), TestDirectory.databaseLayout(), EMPTY, true, false, monitor));
            life.Start();

            // then
            assertTrue(monitor.CorruptedIndex);
            assertTrue(monitor.RebuildingCalled);
            life.Shutdown();
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shutdownNonInitialisedNativeScanStoreWithoutException() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShutdownNonInitialisedNativeScanStoreWithoutException()
        {
            string   expectedMessage = "Expected exception message";
            Monitors monitors        = mock(typeof(Monitors));

            when(monitors.NewMonitor(typeof(Org.Neo4j.Kernel.api.labelscan.LabelScanStore_Monitor))).thenReturn(Org.Neo4j.Kernel.api.labelscan.LabelScanStore_Monitor_Fields.Empty);
            doThrow(new Exception(expectedMessage)).when(monitors).addMonitorListener(any());

            LabelScanStore scanStore = GetLabelScanStore(FileSystemRule.get(), TestDirectory.databaseLayout(), EMPTY, true, monitors);

            try
            {
                scanStore.Init();
                fail("Initialisation of store should fail.");
            }
            catch (Exception e)
            {
                assertEquals(expectedMessage, e.Message);
            }

            scanStore.Shutdown();
        }
Ejemplo n.º 5
0
            public override Lifecycle NewInstance(KernelContext context, SchemaIndexHaIT.IndexProviderDependencies deps)
            {
                PageCache pageCache             = deps.PageCache();
                File      databaseDirectory     = context.Directory();
                DefaultFileSystemAbstraction fs = FileSystemRule.get();

                IndexProvider.Monitor monitor   = IndexProvider.Monitor_Fields.EMPTY;
                Config          config          = deps.Config();
                OperationalMode operationalMode = context.DatabaseInfo().OperationalMode;
                RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = deps.RecoveryCleanupWorkCollector();

                FusionIndexProvider fusionIndexProvider = NativeLuceneFusionIndexProviderFactory20.create(pageCache, databaseDirectory, fs, monitor, config, operationalMode, recoveryCleanupWorkCollector);

                if (InjectLatchPredicate.test(deps.Db()))
                {
                    ControlledIndexProvider provider = new ControlledIndexProvider(fusionIndexProvider);
                    PerDbIndexProvider[deps.Db()] = provider;
                    return(provider);
                }
                else
                {
                    return(fusionIndexProvider);
                }
            }
Ejemplo n.º 6
0
 private void InitializeInstanceFields()
 {
     TestDirectory = TestDirectory.testDirectory(FileSystemRule);
     _fsa          = FileSystemRule.get();
 }
Ejemplo n.º 7
0
 protected internal override GraphDatabaseService CreateGraphDatabase()
 {
     return((new TestEnterpriseGraphDatabaseFactory()).setFileSystem(FileSystemRule.get()).newEmbeddedDatabaseBuilder(TestDir.storeDir()).newGraphDatabase());
 }
 public virtual PageCacheAndDependenciesRule With <T1>(FileSystemRule <T1> fs) where T1 : Org.Neo4j.Io.fs.FileSystemAbstraction
 {
     this._fs = fs;
     return(this);
 }
Ejemplo n.º 9
0
 private void InitializeInstanceFields()
 {
     _fsa        = FileSystemRule.get();
     _fileNames  = new FileNames(_root);
     _readerPool = new ReaderPool(0, Instance, _fileNames, _fsa, Clocks.fakeClock());
 }