Search in sources :

Example 11 with RequireAssertEnabled

use of com.hazelcast.test.RequireAssertEnabled in project hazelcast by hazelcast.

the class HashSlotArray16byteKeyNoValueTest method testCursor_advance_whenDisposed.

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

Example 12 with RequireAssertEnabled

use of com.hazelcast.test.RequireAssertEnabled in project hazelcast by hazelcast.

the class InterceptorRegistryTest method testDeregister_fromPartitionOperationThread.

@Test
@RequireAssertEnabled
public void testDeregister_fromPartitionOperationThread() throws Exception {
    OperationQueue queue = new DefaultOperationQueue();
    PartitionOperationThread thread = getPartitionOperationThread(queue);
    thread.start();
    registry.register(interceptor.id, interceptor);
    final CountDownLatch latch = new CountDownLatch(1);
    Object task = new Runnable() {

        @Override
        public void run() {
            try {
                registry.deregister(interceptor.id);
            } catch (AssertionError e) {
                e.printStackTrace();
                latch.countDown();
            }
        }
    };
    queue.add(task, false);
    latch.await();
    thread.shutdown();
    thread.join();
    assertInterceptorRegistryContainsInterceptor();
}
Also used : DefaultOperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.DefaultOperationQueue) OperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.OperationQueue) PartitionOperationThread(com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread) CountDownLatch(java.util.concurrent.CountDownLatch) DefaultOperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.DefaultOperationQueue) RequireAssertEnabled(com.hazelcast.test.RequireAssertEnabled) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 13 with RequireAssertEnabled

use of com.hazelcast.test.RequireAssertEnabled in project hazelcast by hazelcast.

the class InterceptorRegistryTest method testRegister_fromPartitionOperationThread.

@Test
@RequireAssertEnabled
public void testRegister_fromPartitionOperationThread() throws Exception {
    OperationQueue queue = new DefaultOperationQueue();
    PartitionOperationThread thread = getPartitionOperationThread(queue);
    thread.start();
    final CountDownLatch latch = new CountDownLatch(1);
    Object task = new Runnable() {

        @Override
        public void run() {
            try {
                registry.register(interceptor.id, interceptor);
            } catch (AssertionError e) {
                e.printStackTrace();
                latch.countDown();
            }
        }
    };
    queue.add(task, false);
    latch.await();
    thread.shutdown();
    thread.join();
    assertInterceptorRegistryContainsNotInterceptor();
}
Also used : DefaultOperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.DefaultOperationQueue) OperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.OperationQueue) PartitionOperationThread(com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread) CountDownLatch(java.util.concurrent.CountDownLatch) DefaultOperationQueue(com.hazelcast.spi.impl.operationexecutor.impl.DefaultOperationQueue) RequireAssertEnabled(com.hazelcast.test.RequireAssertEnabled) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 14 with RequireAssertEnabled

use of com.hazelcast.test.RequireAssertEnabled 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 15 with RequireAssertEnabled

use of com.hazelcast.test.RequireAssertEnabled in project hazelcast by hazelcast.

the class HashSlotArray16byteKeyImplTest method testCursor_advance_afterAdvanceReturnsFalse.

@Test
@RequireAssertEnabled
public void testCursor_advance_afterAdvanceReturnsFalse() {
    insert(randomKey(), randomKey());
    HashSlotCursor16byteKey cursor = hsa.cursor();
    cursor.advance();
    cursor.advance();
    try {
        cursor.advance();
        fail("cursor.advance() returned false, but subsequent call did not throw AssertionError");
    } catch (AssertionError ignored) {
    }
}
Also used : HashSlotCursor16byteKey(com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey) RequireAssertEnabled(com.hazelcast.test.RequireAssertEnabled) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

RequireAssertEnabled (com.hazelcast.test.RequireAssertEnabled)24 QuickTest (com.hazelcast.test.annotation.QuickTest)24 Test (org.junit.Test)24 HashSlotCursor16byteKey (com.hazelcast.internal.util.hashslot.HashSlotCursor16byteKey)11 HashSlotCursor8byteKey (com.hazelcast.internal.util.hashslot.HashSlotCursor8byteKey)6 HashSlotCursor12byteKey (com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey)4 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3 DefaultOperationQueue (com.hazelcast.spi.impl.operationexecutor.impl.DefaultOperationQueue)2 OperationQueue (com.hazelcast.spi.impl.operationexecutor.impl.OperationQueue)2 PartitionOperationThread (com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread)2 NightlyTest (com.hazelcast.test.annotation.NightlyTest)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 MemberImpl (com.hazelcast.instance.MemberImpl)1 Address (com.hazelcast.nio.Address)1 UuidUtil.newUnsecureUuidString (com.hazelcast.util.UuidUtil.newUnsecureUuidString)1 InetAddress (java.net.InetAddress)1 HashMap (java.util.HashMap)1