Search in sources :

Example 6 with HashSlotCursor12byteKey

use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.

the class HashSlotArray12byteKeyImplTest method testCursor_key1_withoutAdvance.

// Cursor tests
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_key1_withoutAdvance() {
    HashSlotCursor12byteKey cursor = hsa.cursor();
    cursor.key1();
}
Also used : HashSlotCursor12byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey) RequireAssertEnabled(com.hazelcast.test.RequireAssertEnabled) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with HashSlotCursor12byteKey

use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.

the class HashSlotArray12byteKeyImplTest method testCursor_key1_whenDisposed.

@Test(expected = AssertionError.class)
public void testCursor_key1_whenDisposed() {
    HashSlotCursor12byteKey cursor = hsa.cursor();
    hsa.dispose();
    cursor.key1();
}
Also used : HashSlotCursor12byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with HashSlotCursor12byteKey

use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.

the class HashSlotArray12byteKeyImplTest method testCursor_valueAddress_withoutAdvance.

@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_valueAddress_withoutAdvance() {
    HashSlotCursor12byteKey cursor = hsa.cursor();
    cursor.valueAddress();
}
Also used : HashSlotCursor12byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey) RequireAssertEnabled(com.hazelcast.test.RequireAssertEnabled) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with HashSlotCursor12byteKey

use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.

the class HashSlotArray12byteKeyImplTest method testCursor_key2.

@Test
public void testCursor_key2() {
    final long key1 = randomKey();
    final int key2 = randomKey();
    insert(key1, key2);
    HashSlotCursor12byteKey cursor = hsa.cursor();
    cursor.advance();
    assertEquals(key2, cursor.key2());
}
Also used : HashSlotCursor12byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 10 with HashSlotCursor12byteKey

use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.

the class HashSlotArray12byteKeyImplTest method testCursor_withManyValues.

@Test
public void testCursor_withManyValues() {
    final int factor = 123456;
    final int k = 1000;
    for (int i = 1; i <= k; i++) {
        insert(i, factor * i);
    }
    boolean[] verifiedKeys = new boolean[k];
    HashSlotCursor12byteKey cursor = hsa.cursor();
    while (cursor.advance()) {
        long key1 = cursor.key1();
        int key2 = cursor.key2();
        long valueAddress = cursor.valueAddress();
        assertEquals(key1 * factor, key2);
        verifyValue(key1, key2, valueAddress);
        verifiedKeys[((int) key1) - 1] = true;
    }
    for (int i = 0; i < k; i++) {
        assertTrue("Failed to encounter key " + i, verifiedKeys[i]);
    }
}
Also used : HashSlotCursor12byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

HashSlotCursor12byteKey (com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey)14 QuickTest (com.hazelcast.test.annotation.QuickTest)14 Test (org.junit.Test)14 RequireAssertEnabled (com.hazelcast.test.RequireAssertEnabled)4