use of com.hazelcast.crdt.pncounter.PNCounter in project hazelcast by hazelcast.
the class AbstractPNCounterConsistencyLostTest method consistencyLostExceptionIsThrownWhenTargetReplicaDisappears.
@Test(expected = ConsistencyLostException.class)
public void consistencyLostExceptionIsThrownWhenTargetReplicaDisappears() {
final PNCounter driver = getCounter();
mutate(driver);
assertState(driver);
final Address currentTarget = getCurrentTargetReplicaAddress(driver);
terminateMember(currentTarget);
mutate(driver);
}
use of com.hazelcast.crdt.pncounter.PNCounter in project hazelcast by hazelcast.
the class ClientPNCounterTest method testClusterRestart.
@Test(expected = ConsistencyLostException.class)
public void testClusterRestart() {
HazelcastInstance instance = hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
PNCounter pnCounter = client.getPNCounter("test");
pnCounter.incrementAndGet();
instance.shutdown();
hazelcastFactory.newHazelcastInstance();
pnCounter.incrementAndGet();
}
use of com.hazelcast.crdt.pncounter.PNCounter in project hazelcast by hazelcast.
the class DistributedDatastructuresMetricsTest method testPnCounter.
@Test
public void testPnCounter() {
final PNCounter counter = hz.getPNCounter(PN_COUNTER_NAME);
final PNCounter counterNoStat = hz.getPNCounter(PN_COUNTER_NAME_NO_STAT);
for (int i = 0; i < EVENT_COUNTER; i++) {
counter.addAndGet(i);
counterNoStat.addAndGet(i);
}
assertHasStatsEventually(PN_COUNTER_NAME, "pnCounter.");
assertHasNoStats(PN_COUNTER_NAME_NO_STAT, "pnCounter.");
}
use of com.hazelcast.crdt.pncounter.PNCounter in project hazelcast by hazelcast.
the class AbstractPNCounterConsistencyLostTest method driverCanContinueSessionByCallingReset.
@Test
public void driverCanContinueSessionByCallingReset() {
final PNCounter driver = getCounter();
mutate(driver);
assertState(driver);
final Address currentTarget = getCurrentTargetReplicaAddress(driver);
terminateMember(currentTarget);
driver.reset();
mutate(driver);
}
use of com.hazelcast.crdt.pncounter.PNCounter in project hazelcast by hazelcast.
the class PNCounterConsistencyLostTest method getCounter.
@Override
protected PNCounter getCounter() {
final PNCounter counter = liteMember.getPNCounter("counter");
((PNCounterProxy) counter).setOperationTryCount(1);
return counter;
}
Aggregations