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());
}
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);
}
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());
}
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());
}
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();
}
Aggregations