Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lazyLoadWithinWriteTransaction() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LazyLoadWithinWriteTransaction()
        {
            // Given
            FileSystemAbstraction fileSystem = Fs.get();
            BatchInserter         inserter   = BatchInserters.inserter(TestDirectory.databaseDir(), fileSystem);
            int  count  = 3000;
            long nodeId = inserter.CreateNode(MapWithManyProperties(count));

            inserter.Shutdown();

            GraphDatabaseService db = (new TestGraphDatabaseFactory()).setFileSystem(fileSystem).newImpermanentDatabase(TestDirectory.databaseDir());

            // When
            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    Db.createNode();
                    Node node = Db.getNodeById(nodeId);

                    // Then
                    assertEquals(count, Iterables.count(node.PropertyKeys));
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void createBatchIndexFromAnyIndexStoreProvider() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CreateBatchIndexFromAnyIndexStoreProvider()
        {
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir));
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir, _fileSystem));
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir, Config));
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir, ConfigWithProvider, Extensions));
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir, _fileSystem, Config));
            CreateEndCloseIndexProvider(BatchInserters.inserter(StoreDir, _fileSystem, ConfigWithProvider, Extensions));
        }
Example #3
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)))));
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCreatesStoreLockFile() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestCreatesStoreLockFile()
        {
            // Given
            DatabaseLayout databaseLayout = _testDirectory.databaseLayout();

            // When
            BatchInserter inserter = BatchInserters.inserter(databaseLayout.DatabaseDirectory(), _fileSystemRule.get());

            // Then
            assertThat(databaseLayout.StoreLayout.storeLockFile().exists(), equalTo(true));
            inserter.Shutdown();
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailsOnExistingStoreLockFile() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFailsOnExistingStoreLockFile()
        {
            // Given
            StoreLayout storeLayout = _testDirectory.storeLayout();

            using (FileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction(), StoreLocker @lock = new StoreLocker(fileSystemAbstraction, storeLayout))
            {
                @lock.CheckLock();

                // Then
                _expected.expect(typeof(StoreLockException));
                _expected.expectMessage("Unable to obtain lock on store lock file");
                // When
                BatchInserters.inserter(storeLayout.DatabaseLayout("any").databaseDirectory(), fileSystemAbstraction);
            }
        }
Example #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void explicitIndexPopulationWithBunchOfFields()
        internal virtual void ExplicitIndexPopulationWithBunchOfFields()
        {
            assertTimeout(ofMillis(TEST_TIMEOUT), () =>
            {
                BatchInserter batchNode = BatchInserters.inserter(_directory.databaseDir());
                LuceneBatchInserterIndexProvider provider = new LuceneBatchInserterIndexProvider(batchNode);
                try
                {
                    BatchInserterIndex batchIndex = provider.nodeIndex("node_auto_index", stringMap(IndexManager.PROVIDER, "lucene", "type", "fulltext"));

                    IDictionary <string, object> properties = IntStream.range(0, 2000).mapToObj(i => Pair.of(Convert.ToString(i), randomAlphabetic(200))).collect(toMap(Pair.first, Pair.other));

                    long node = batchNode.createNode(properties, Label.label("NODE"));
                    batchIndex.add(node, properties);
                }
                finally
                {
                    provider.shutdown();
                    batchNode.shutdown();
                }
            });
        }
Example #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.unsafe.batchinsert.BatchInserter newBatchInserter(org.neo4j.kernel.configuration.Config config) throws Exception
        private BatchInserter NewBatchInserter(Config config)
        {
            return(BatchInserters.inserter(_storeDir.databaseDir(), _fileSystemRule.get(), config.Raw));
        }