use of com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey in project hazelcast by hazelcast.
the class HashSlotArray16byteKeyImplTest method testCursor_valueAddress.
@Test
public void testCursor_valueAddress() {
final long valueAddress = insert(randomKey(), randomKey());
HashSlotCursor16byteKey cursor = hsa.cursor();
cursor.advance();
assertEquals(valueAddress, cursor.valueAddress());
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey in project hazelcast by hazelcast.
the class HashSlotArray16byteKeyImplTest method testCursor_withManyValues.
@Test
public void testCursor_withManyValues() {
final long factor = 123456;
final int k = 1000;
for (int i = 1; i <= k; i++) {
long key1 = (long) i;
long key2 = key1 * factor;
insert(key1, key2);
}
boolean[] verifiedKeys = new boolean[k];
HashSlotCursor16byteKey cursor = hsa.cursor();
while (cursor.advance()) {
long key1 = cursor.key1();
long 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]);
}
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey in project hazelcast by hazelcast.
the class HashSlotArray16byteKeyImplTest method testCursor_key2_whenDisposed.
@Test(expected = AssertionError.class)
public void testCursor_key2_whenDisposed() {
HashSlotCursor16byteKey cursor = hsa.cursor();
hsa.dispose();
cursor.key2();
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey in project hazelcast by hazelcast.
the class HashSlotArray16byteKeyNoValueTest method testCursor_key2_whenDisposed.
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_key2_whenDisposed() {
HashSlotCursor16byteKey cursor = hsa.cursor();
hsa.dispose();
cursor.key2();
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey in project hazelcast by hazelcast.
the class HashSlotArray16byteKeyNoValueTest method testCursor_key1_withoutAdvance.
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_key1_withoutAdvance() {
HashSlotCursor16byteKey cursor = hsa.cursor();
cursor.key1();
}
Aggregations