//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteIdGeneratorsWhenOpeningExistingStore() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDeleteIdGeneratorsWhenOpeningExistingStore()
        {
            // given
            long expectedHighId;

            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.CreateNew();
                RelationshipStore  relationshipStore = stores.RelationshipStore;
                RelationshipRecord record            = relationshipStore.NewRecord();
                long no = NULL_REFERENCE.longValue();
                record.Initialize(true, no, 1, 2, 0, no, no, no, no, true, true);
                record.Id      = relationshipStore.NextId();
                expectedHighId = relationshipStore.HighId;
                relationshipStore.UpdateRecord(record);
                // fiddle with the highId
                relationshipStore.HighId = record.Id + 999;
            }

            // when
            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.PruneAndOpenExistingStore(Predicates.alwaysTrue(), Predicates.alwaysTrue());

                // then
                assertEquals(expectedHighId, stores.RelationshipStore.HighId);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLargeAmountOfRelationshipsOnUnsupportedFormat() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLargeAmountOfRelationshipsOnUnsupportedFormat()
        {
            // given
            RecordFormats formats = LATEST_RECORD_FORMATS;

            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), formats, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.CreateNew();
                Input_Estimates estimates = Inputs.knownEstimates(0, DOUBLE_RELATIONSHIP_RECORD_UNIT_THRESHOLD << 1, 0, 0, 0, 0, 0);

                // when
                bool doubleUnits = stores.DetermineDoubleRelationshipRecordUnits(estimates);

                // then
                assertFalse(doubleUnits);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPruneAndOpenExistingDatabase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPruneAndOpenExistingDatabase()
        {
            // given
            foreach (StoreType typeToTest in RelevantRecordStores())
            {
                // given all the stores with some records in them
                using (PageCache pageCache = Storage.pageCache())
                {
                    Storage.directory().cleanup();
                    using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), pageCache, PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
                    {
                        stores.CreateNew();
                        foreach (StoreType type in RelevantRecordStores())
                        {
                            CreateRecordIn(stores.NeoStores.getRecordStore(type));
                        }
                    }

                    // when opening and pruning all except the one we test
                    using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), pageCache, PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
                    {
                        stores.PruneAndOpenExistingStore(type => type == typeToTest, Predicates.alwaysFalse());

                        // then only the one we kept should have data in it
                        foreach (StoreType type in RelevantRecordStores())
                        {
                            RecordStore <AbstractBaseRecord> store = stores.NeoStores.getRecordStore(type);
                            if (type == typeToTest)
                            {
                                assertThat(store.ToString(), (int)store.HighId, greaterThan(store.NumberOfReservedLowIds));
                            }
                            else
                            {
                                assertEquals(store.ToString(), store.NumberOfReservedLowIds, store.HighId);
                            }
                        }
                    }
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotOpenStoreWithNodesOrRelationshipsInIt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotOpenStoreWithNodesOrRelationshipsInIt()
        {
            // GIVEN
            SomeDataInTheDatabase();

            // WHEN
            try
            {
                using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
                {
                    RecordFormats recordFormats = RecordFormatSelector.selectForConfig(Config.defaults(), NullLogProvider.Instance);
                    using (BatchingNeoStores store = BatchingNeoStores.BatchingNeoStoresConflict(Storage.fileSystem(), Storage.directory().databaseDir(), recordFormats, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults(), jobScheduler))
                    {
                        store.CreateNew();
                        fail("Should fail on existing data");
                    }
                }
            }
            catch (System.InvalidOperationException e)
            {
                // THEN
                assertThat(e.Message, containsString("already contains"));
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespectDbConfig() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRespectDbConfig()
        {
            // GIVEN
            int    size   = 10;
            Config config = Config.defaults(stringMap(GraphDatabaseSettings.array_block_size.name(), size.ToString(), GraphDatabaseSettings.string_block_size.name(), size.ToString()));

            // WHEN
            RecordFormats recordFormats = LATEST_RECORD_FORMATS;
            int           headerSize    = recordFormats.Dynamic().RecordHeaderSize;

            using (JobScheduler jobScheduler = new ThreadPoolJobScheduler(), BatchingNeoStores store = BatchingNeoStores.BatchingNeoStoresConflict(Storage.fileSystem(), Storage.directory().absolutePath(), recordFormats, DEFAULT, NullLogService.Instance, EMPTY, config, jobScheduler))
            {
                store.CreateNew();

                // THEN
                assertEquals(size + headerSize, store.PropertyStore.ArrayStore.RecordSize);
                assertEquals(size + headerSize, store.PropertyStore.StringStore.RecordSize);
            }
        }