示例#1
0
//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());
                }
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailIfFileDoesNotExist()
        public virtual void ShouldFailIfFileDoesNotExist()
        {
            // given
            File              missingFile       = new File(_directory.directory(), "missing-file");
            PageCache         pageCache         = _pageCacheRule.getPageCache(_fileSystemRule.get());
            StoreVersionCheck storeVersionCheck = new StoreVersionCheck(pageCache);

            // when
            StoreVersionCheck.Result result = storeVersionCheck.HasVersion(missingFile, "version");

            // then
            assertFalse(result.Outcome.Successful);
            assertEquals(StoreVersionCheck.Result.Outcome.MissingStoreFile, result.Outcome);
            assertNull(result.ActualVersion);
        }
示例#3
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));
            }
        }
示例#4
0
 private void SetupIndexInfrastructure()
 {
     _indexStore = new IndexConfigStore(_testDirectory.databaseLayout(), _fileSystemRule.get());
     _indexStore.set(typeof(Node), INDEX_NAME, MapUtil.stringMap(Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER, "lucene", "type", "fulltext"));
 }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testHonorsPassedInParams() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestHonorsPassedInParams()
        {
            BatchInserter inserter  = BatchInserters.inserter(_testDirectory.databaseDir(), _fileSystemRule.get(), stringMap(GraphDatabaseSettings.pagecache_memory.name(), "280K"));
            NeoStores     neoStores = ReflectionUtil.getPrivateField(inserter, "neoStores", typeof(NeoStores));
            PageCache     pageCache = ReflectionUtil.getPrivateField(neoStores, "pageCache", typeof(PageCache));

            inserter.Shutdown();
            long mappedMemoryTotalSize = MuninnPageCache.memoryRequiredForPages(pageCache.MaxCachedPages());

            assertThat("memory mapped config is active", mappedMemoryTotalSize, @is(allOf(greaterThan(kibiBytes(270)), lessThan(kibiBytes(290)))));
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenBatchInserterWhenArrayPropertyUpdated4TimesThenShouldNotFail() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void GivenBatchInserterWhenArrayPropertyUpdated4TimesThenShouldNotFail()
        {
            BatchInserter batchInserter = BatchInserters.inserter(TestDirectory.databaseDir(), FileSystemRule.get());

            long nodeId = batchInserter.createNode(Collections.emptyMap());

            for (int i = 0; i < 4; i++)
            {
                batchInserter.SetNodeProperty(nodeId, "array", new sbyte[] { 2, 3, 98, 1, 43, 50, 3, 33, 51, 55, 116, 16, 23, 56, 9, ( sbyte )-10, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 });
            }

            batchInserter.GetNodeProperties(nodeId);                 //fails here
            batchInserter.Shutdown();
        }
示例#7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _storeDirectory = TestDirectory.directory();
            _fileSystem     = FileSystemRule.get();
        }
示例#8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _fsa = FileSystemRule.get();

            _cluster = new EnterpriseCluster(TestDir.directory("cluster"), 3, 0, new SharedDiscoveryServiceFactory(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), HighLimit.NAME, IpFamily.IPV4, false);
        }