Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReadWriteSingleEntry()
        internal virtual void ShouldReadWriteSingleEntry()
        {
            // given
            MutableLong writeKey   = _layout.key(Rnd.nextLong());
            MutableLong writeValue = _layout.value(Rnd.nextLong());
            int         offset     = _pageCursor.Offset;

            BlockEntry.Write(_pageCursor, _layout, writeKey, writeValue);

            // when
            MutableLong readKey   = _layout.newKey();
            MutableLong readValue = _layout.newValue();

            _pageCursor.Offset = offset;
            BlockEntry.Read(_pageCursor, _layout, readKey, readValue);

            // then
            assertEquals(0, _layout.Compare(writeKey, readKey));
            assertEquals(0, _layout.Compare(writeValue, readValue));
        }
Exemplo n.º 2
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());
                        }
                    }
                }
            }
        }