예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void allocateResources() throws java.io.IOException
        private void AllocateResources()
        {
            if (!_allocated)
            {
                this._buffer       = _byteBufferFactory.allocate(_blockSize);
                this._pageCursor   = new ByteArrayPageCursor(_buffer);
                this._storeChannel = _fs.create(_file);
                this._allocated    = true;
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldFailOnInvalidValues()
        internal virtual void ShouldFailOnInvalidValues()
        {
            // GIVEN
            PageCursor cursor = ByteArrayPageCursor.wrap(10);

            // WHEN
            for (int i = 0; i < 1_000;)
            {
                long expected = _random.nextLong();
                if ((expected & ~_6B_MASK) != 0)
                {
                    // OK here we have an invalid value
                    cursor.Offset = 0;
                    assertThrows(typeof(System.ArgumentException), () => PageCursorUtil.put6BLong(cursor, expected));
                    i++;
                }
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldPutAndGet6BLongs()
        internal virtual void ShouldPutAndGet6BLongs()
        {
            // GIVEN
            PageCursor cursor = ByteArrayPageCursor.wrap(10);

            // WHEN
            for (int i = 0; i < 1_000; i++)
            {
                long expected = _random.nextLong() & _6B_MASK;
                cursor.Offset = 0;
                PageCursorUtil.Put6BLong(cursor, expected);
                cursor.Offset = 0;
                long read = PageCursorUtil.Get6BLong(cursor);

                // THEN
                assertEquals(expected, read);
                assertTrue(read >= 0);
                assertEquals(0, read & ~_6B_MASK);
            }
        }
예제 #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()
        {
            _cursor = ByteArrayPageCursor.wrap(8192);
        }