Пример #1
0
//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);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrateHighLimit3_0StoreFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrateHighLimit3_0StoreFiles()
        {
            FileSystemAbstraction fileSystem = _fileSystemRule.get();
            PageCache             pageCache  = _pageCacheRule.getPageCache(fileSystem);

            using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                StoreMigrator migrator = new StoreMigrator(fileSystem, pageCache, Config.defaults(), NullLogService.Instance, jobScheduler);

                DatabaseLayout databaseLayout  = _testDirectory.databaseLayout();
                DatabaseLayout migrationLayout = _testDirectory.databaseLayout("migration");

                PrepareNeoStoreFile(fileSystem, databaseLayout, HighLimitV3_0_0.STORE_VERSION, pageCache);

                ProgressReporter progressMonitor = mock(typeof(ProgressReporter));

                migrator.Migrate(databaseLayout, migrationLayout, progressMonitor, HighLimitV3_0_0.STORE_VERSION, HighLimit.StoreVersion);

                int newStoreFilesCount = fileSystem.ListFiles(migrationLayout.DatabaseDirectory()).Length;
                assertThat("Store should be migrated and new store files should be created.", newStoreFilesCount, Matchers.greaterThanOrEqualTo(StoreType.values().length));
            }
        }
Пример #3
0
//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 mustAutomaticallyStartEvictionThread() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustAutomaticallyStartEvictionThread()
        {
            using (FileSystemAbstraction fs = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                File file = (new File(TestDirectory.directory(), "a")).CanonicalFile;
                fs.Create(file).close();

                using (PageCache cache = ConfigurableStandalonePageCacheFactory.CreatePageCache(fs, jobScheduler), PagedFile pf = cache.Map(file, 4096), PageCursor cursor = pf.Io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfSharedWriteLock))
                {
                    // The default size is currently 8MBs.
                    // It should be possible to write more than that.
                    // If the eviction thread has not been started, then this test will block forever.
                    for (int i = 0; i < 10_000; i++)
                    {
                        assertTrue(cursor.Next());
                        cursor.PutInt(42);
                    }
                }
            }
        }
Пример #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void run() throws Exception
        public virtual void Run()
        {
            using (FileSystemAbstraction fs = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                PageSwapperFactory swapperFactory = new SingleFilePageSwapperFactory();
                swapperFactory.Open(fs, Configuration.EMPTY);
                using (PageCache pageCacheUnderTest = new MuninnPageCache(swapperFactory, _numberOfCachePages, _tracer, _pageCursorTracerSupplier, EmptyVersionContextSupplier.EMPTY, jobScheduler))
                {
                    PageCacheStresser pageCacheStresser = new PageCacheStresser(_numberOfPages, _numberOfThreads, _workingDirectory);
                    pageCacheStresser.Stress(pageCacheUnderTest, _condition);
                }
            }
        }