BinaryValue key = BinaryValue.create("key");
resetAndEmptyBucket(new Namespace(counterBucketType, bucketName));
RiakCounter counter = fetchCounter(counterBucketType, bucketName, key);
assertEquals((Long) 0L, counter.view());
Location location = new Location(new Namespace(counterBucketType, bucketName), key);
for (int i = 0; i < iterations; ++i)
{
DtUpdateOperation update =
new DtUpdateOperation.Builder(location)
.withOp(new CounterOp(1))
.build();
cluster.execute(update);
update.get();
}
counter = fetchCounter(counterBucketType, bucketName, key);
assertEquals((Long) iterations, counter.view());
for (int i = 0; i < iterations; ++i)
{
DtUpdateOperation update =
new DtUpdateOperation.Builder(location)
.withOp(new CounterOp(-1))
.build();
cluster.execute(update);
update.get();
}
counter = fetchCounter(counterBucketType, bucketName, key);
assertEquals((Long) 0L, counter.view());
resetAndEmptyBucket(new Namespace(counterBucketType, bucketName));
}