Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateEmptyBatchWhenNoIdsAreAvailable() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AllocateEmptyBatchWhenNoIdsAreAvailable()
        {
            FreeIdKeeper freeIdKeeper = FreeIdKeeperAggressive;

            long[] ids = freeIdKeeper.GetIds(1024);
            assertSame(PrimitiveLongCollections.EMPTY_LONG_ARRAY, ids);
            assertEquals(0, freeIdKeeper.Count);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateBatchWhenHaveLessIdsInMemoryAndOnDisk() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AllocateBatchWhenHaveLessIdsInMemoryAndOnDisk()
        {
            FreeIdKeeper freeIdKeeper = GetFreeIdKeeperAggressive(4);

            for (long id = 1L; id < 10L; id++)
            {
                freeIdKeeper.FreeId(id);
            }
            long[] ids = freeIdKeeper.GetIds(15);
            assertArrayEquals(new long[] { 9L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L }, ids);
            assertEquals(0, freeIdKeeper.Count);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateBatchWhenHaveLessIdsInMemoryButHaveOnDiskMore() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AllocateBatchWhenHaveLessIdsInMemoryButHaveOnDiskMore()
        {
            FreeIdKeeper freeIdKeeper = GetFreeIdKeeperAggressive(4);

            for (long id = 1L; id < 11L; id++)
            {
                freeIdKeeper.FreeId(id);
            }
            long[] ids = freeIdKeeper.GetIds(7);
            assertArrayEquals(new long[] { 9L, 10L, 5L, 6L, 7L, 8L, 1L }, ids);
            assertEquals(3, freeIdKeeper.Count);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateBatchWhenHaveLessIdsInMemory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AllocateBatchWhenHaveLessIdsInMemory()
        {
            FreeIdKeeper freeIdKeeper = FreeIdKeeperAggressive;

            for (long id = 1L; id < 4L; id++)
            {
                freeIdKeeper.FreeId(id);
            }
            long[] ids = freeIdKeeper.GetIds(5);
            assertArrayEquals(new long[] { 1L, 2L, 3L }, ids);
            assertEquals(0, freeIdKeeper.Count);
        }