//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCompletelyRebuildIdGeneratorsAfterCrash() public virtual void ShouldCompletelyRebuildIdGeneratorsAfterCrash() { // GIVEN DatabaseLayout databaseLayout = _directory.databaseLayout(); StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(_fileSystemRule.get()), _pageCacheRule.getPageCache(_fileSystemRule.get()), _fileSystemRule.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); long highId; using (NeoStores stores = storeFactory.OpenAllNeoStores(true)) { // a node store with a "high" node NodeStore nodeStore = stores.NodeStore; nodeStore.HighId = 20; nodeStore.UpdateRecord(Node(nodeStore.NextId())); highId = nodeStore.HighId; } // populating its .id file with a bunch of ids File nodeIdFile = databaseLayout.IdNodeStore(); using (IdGeneratorImpl idGenerator = new IdGeneratorImpl(_fileSystemRule.get(), nodeIdFile, 10, 10_000, false, IdType.NODE, () => highId)) { for (long id = 0; id < 15; id++) { idGenerator.FreeId(id); } // WHEN using (NeoStores stores = storeFactory.OpenAllNeoStores(true)) { NodeStore nodeStore = stores.NodeStore; assertFalse(nodeStore.StoreOk); // simulating what recovery does nodeStore.DeleteIdGenerator(); // recovery happens here... nodeStore.MakeStoreOk(); // THEN assertEquals(highId, nodeStore.NextId()); } } }