Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertContents(org.neo4j.index.internal.gbptree.SimpleLongLayout layout, BlockStorage<org.apache.commons.lang3.mutable.MutableLong,org.apache.commons.lang3.mutable.MutableLong> storage, Iterable<java.util.List<BlockEntry<org.apache.commons.lang3.mutable.MutableLong,org.apache.commons.lang3.mutable.MutableLong>>> expectedBlocks) throws java.io.IOException
        private void AssertContents(SimpleLongLayout layout, BlockStorage <MutableLong, MutableLong> storage, IEnumerable <IList <BlockEntry <MutableLong, MutableLong> > > expectedBlocks)
        {
            using (BlockReader <MutableLong, MutableLong> reader = storage.Reader())
            {
                foreach (IList <BlockEntry <MutableLong, MutableLong> > expectedBlock in expectedBlocks)
                {
                    using (BlockEntryReader <MutableLong, MutableLong> block = reader.NextBlock(HEAP_ALLOCATOR.allocate(1024)))
                    {
                        assertNotNull(block);
                        assertEquals(expectedBlock.Count, block.EntryCount());
                        foreach (BlockEntry <MutableLong, MutableLong> expectedEntry in expectedBlock)
                        {
                            assertTrue(block.Next());
                            assertEquals(0, layout.Compare(expectedEntry.Key(), block.Key()));
                            assertEquals(expectedEntry.Value(), block.Value());
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCombineAllParts() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCombineAllParts()
        {
            // given
            SimpleLongLayout layout = new SimpleLongLayout(0, "", true, 1, 2, 3);
            IList <RawCursor <Hit <MutableLong, MutableLong>, IOException> > parts = new List <RawCursor <Hit <MutableLong, MutableLong>, IOException> >();
            int partCount = Random.Next(1, 20);
            IList <Hit <MutableLong, MutableLong> > expectedAllData = new List <Hit <MutableLong, MutableLong> >();
            int maxKey = Random.Next(100, 10_000);

            for (int i = 0; i < partCount; i++)
            {
                int dataSize = Random.Next(0, 100);
                IList <Hit <MutableLong, MutableLong> > partData = new List <Hit <MutableLong, MutableLong> >(dataSize);
                for (int j = 0; j < dataSize; j++)
                {
                    long key = Random.nextLong(maxKey);
                    partData.Add(new SimpleHit <>(new MutableLong(key), new MutableLong(key * 2)));
                }
                partData.sort(_hitComparator);
                parts.Add(new SimpleSeeker(partData));
                ((IList <Hit <MutableLong, MutableLong> >)expectedAllData).AddRange(partData);
            }
            expectedAllData.sort(_hitComparator);

            // when
            CombinedPartSeeker <MutableLong, MutableLong> combinedSeeker = new CombinedPartSeeker <MutableLong, MutableLong>(layout, parts);

            // then
            foreach (Hit <MutableLong, MutableLong> expectedHit in expectedAllData)
            {
                assertTrue(combinedSeeker.Next());
                Hit <MutableLong, MutableLong> actualHit = combinedSeeker.Get();

                assertEquals(expectedHit.Key().longValue(), actualHit.Key().longValue());
                assertEquals(expectedHit.Value().longValue(), actualHit.Value().longValue());
            }
            assertFalse(combinedSeeker.Next());
            // And just ensure it will return false again after that
            assertFalse(combinedSeeker.Next());
        }
Exemplo n.º 3
0
 private GBPTreePlayground(FileSystemAbstraction fs, File indexFile)
 {
     this._indexFile = indexFile;
     this._layout    = SimpleLongLayout.LongLayout().build();
     this._pageCache = StandalonePageCacheFactory.createPageCache(fs, createInitialisedScheduler());
 }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setup()
        internal virtual void Setup()
        {
            _file       = Directory.file("block");
            _fileSystem = Directory.FileSystem;
            _layout     = SimpleLongLayout.longLayout().withFixedSize(Random.nextBoolean()).withKeyPadding(Random.Next(10)).build();
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setup()
        internal virtual void Setup()
        {
            _layout = SimpleLongLayout.longLayout().withFixedSize(Rnd.nextBoolean()).withKeyPadding(Rnd.Next(10)).build();
        }