//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void scanStoreStartWithoutExistentIndex() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ScanStoreStartWithoutExistentIndex()
        {
            LabelScanStore labelScanStore = LabelScanStore;
            GroupingRecoveryCleanupWorkCollector workCollector = GroupingRecoveryCleanupWorkCollector;

            labelScanStore.Shutdown();
            workCollector.Shutdown();

            DeleteLabelScanStoreFiles(DbRule.databaseLayout());

            workCollector.Init();
            labelScanStore.Init();
            workCollector.Start();
            labelScanStore.Start();

            CheckLabelScanStoreAccessible(labelScanStore);
        }
Ejemplo n.º 2
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();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void scanStoreRecreateCorruptedIndexOnStartup() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ScanStoreRecreateCorruptedIndexOnStartup()
        {
            LabelScanStore labelScanStore = LabelScanStore;
            GroupingRecoveryCleanupWorkCollector workCollector = GroupingRecoveryCleanupWorkCollector;

            CreateTestNode();
            long[] labels = ReadNodesForLabel(labelScanStore);
            assertEquals("Label scan store see 1 label for node", 1, labels.Length);
            labelScanStore.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);
            labelScanStore.Shutdown();
            workCollector.Shutdown();

            CorruptLabelScanStoreFiles(DbRule.databaseLayout());

            workCollector.Init();
            labelScanStore.Init();
            workCollector.Start();
            labelScanStore.Start();

            long[] rebuildLabels = ReadNodesForLabel(labelScanStore);
            assertArrayEquals("Store should rebuild corrupted index", labels, rebuildLabels);
        }