Search in sources :

Example 6 with IAtomicLong

use of com.hazelcast.core.IAtomicLong in project hazelcast by hazelcast.

the class ClientAtomicLongTest method apply.

@Test
public void apply() {
    IAtomicLong ref = client.getAtomicLong("apply");
    assertEquals(new Long(1), ref.apply(new AddOneFunction()));
    assertEquals(0, ref.get());
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) IAtomicLong(com.hazelcast.core.IAtomicLong) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with IAtomicLong

use of com.hazelcast.core.IAtomicLong in project hazelcast by hazelcast.

the class ClientAtomicLongTest method alterAndGet_whenCalledWithNullFunction.

@Test(expected = IllegalArgumentException.class)
public void alterAndGet_whenCalledWithNullFunction() {
    IAtomicLong ref = client.getAtomicLong("alterAndGet_whenCalledWithNullFunction");
    ref.alterAndGet(null);
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with IAtomicLong

use of com.hazelcast.core.IAtomicLong in project hazelcast by hazelcast.

the class ClientAtomicLongTest method alter_whenException.

@Test
public void alter_whenException() {
    IAtomicLong ref = client.getAtomicLong("alter_whenException");
    ref.set(10);
    try {
        ref.alter(new FailingFunction());
        fail();
    } catch (UndefinedErrorCodeException expected) {
        assertEquals(expected.getOriginClassName(), ExpectedRuntimeException.class.getName());
    }
    assertEquals(10, ref.get());
}
Also used : UndefinedErrorCodeException(com.hazelcast.client.UndefinedErrorCodeException) IAtomicLong(com.hazelcast.core.IAtomicLong) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with IAtomicLong

use of com.hazelcast.core.IAtomicLong in project hazelcast by hazelcast.

the class ClientAtomicLongTest method getAndAlterAsync.

@Test
public void getAndAlterAsync() throws ExecutionException, InterruptedException {
    IAtomicLong ref = client.getAtomicLong("getAndAlterAsync");
    ref.set(10);
    ICompletableFuture<Long> future = ref.getAndAlterAsync(new AddOneFunction());
    assertEquals(10, future.get().longValue());
    assertEquals(11, ref.get());
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) IAtomicLong(com.hazelcast.core.IAtomicLong) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with IAtomicLong

use of com.hazelcast.core.IAtomicLong in project hazelcast by hazelcast.

the class ClientProxyDestroyTest method testUsageAfterDestroy.

@Test
public void testUsageAfterDestroy() {
    IAtomicLong proxy = newClientProxy();
    proxy.destroy();
    proxy.get();
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

IAtomicLong (com.hazelcast.core.IAtomicLong)49 ParallelTest (com.hazelcast.test.annotation.ParallelTest)45 Test (org.junit.Test)45 QuickTest (com.hazelcast.test.annotation.QuickTest)44 HazelcastInstance (com.hazelcast.core.HazelcastInstance)21 IExecutorService (com.hazelcast.core.IExecutorService)10 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)9 UndefinedErrorCodeException (com.hazelcast.client.UndefinedErrorCodeException)8 Random (java.util.Random)8 Config (com.hazelcast.config.Config)6 Member (com.hazelcast.core.Member)6 CountDownLatch (java.util.concurrent.CountDownLatch)6 ExecutionException (java.util.concurrent.ExecutionException)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 MultiExecutionCallback (com.hazelcast.core.MultiExecutionCallback)3 Map (java.util.Map)3 ICountDownLatch (com.hazelcast.core.ICountDownLatch)2 ClientCacheProxyFactory (com.hazelcast.client.cache.impl.ClientCacheProxyFactory)1 ProxyFactoryConfig (com.hazelcast.client.config.ProxyFactoryConfig)1