use of com.couchbase.client.core.service.kv.ObserveContext in project couchbase-jvm-clients by couchbase.
the class ObserveIntegrationTest method returnsIfBothAreNone.
@Test
void returnsIfBothAreNone() {
String id = UUID.randomUUID().toString();
InsertResponse insertResponse = performInsert(id);
ObserveContext ctx = new ObserveContext(core.context(), Observe.ObservePersistTo.NONE, Observe.ObserveReplicateTo.NONE, Optional.empty(), insertResponse.cas(), cid, id, false, env.timeoutConfig().kvTimeout(), null);
Observe.poll(ctx).timeout(MAX_WAIT).block();
}
use of com.couchbase.client.core.service.kv.ObserveContext in project couchbase-jvm-clients by couchbase.
the class ObserveIntegrationTest method failsFastIfTooManyReplicasRequested.
@Test
@IgnoreWhen(replicasGreaterThan = 1)
void failsFastIfTooManyReplicasRequested() {
String id = UUID.randomUUID().toString();
InsertResponse insertResponse = performInsert(id);
assertTrue(insertResponse.mutationToken().isPresent());
final ObserveContext ctx = new ObserveContext(core.context(), Observe.ObservePersistTo.THREE, Observe.ObserveReplicateTo.NONE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx).timeout(MAX_WAIT).block());
final ObserveContext ctx2 = new ObserveContext(core.context(), Observe.ObservePersistTo.NONE, Observe.ObserveReplicateTo.TWO, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx2).timeout(MAX_WAIT).block());
final ObserveContext ctx3 = new ObserveContext(core.context(), Observe.ObservePersistTo.FOUR, Observe.ObserveReplicateTo.THREE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx3).timeout(MAX_WAIT).block());
}
use of com.couchbase.client.core.service.kv.ObserveContext in project couchbase-jvm-clients by couchbase.
the class ObserveIntegrationTest method observesRemove.
@Test
void observesRemove() {
String id = UUID.randomUUID().toString();
InsertResponse insertResponse = performInsert(id);
assertTrue(insertResponse.mutationToken().isPresent());
ObserveContext ctx = new ObserveContext(core.context(), Observe.ObservePersistTo.ACTIVE, Observe.ObserveReplicateTo.NONE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
Observe.poll(ctx).timeout(MAX_WAIT).block();
RemoveResponse removeResponse = performRemove(id);
assertTrue(insertResponse.mutationToken().isPresent());
ObserveContext ctx2 = new ObserveContext(core.context(), Observe.ObservePersistTo.ACTIVE, Observe.ObserveReplicateTo.NONE, removeResponse.mutationToken(), 0, cid, id, true, env.timeoutConfig().kvTimeout(), null);
Observe.poll(ctx2).timeout(MAX_WAIT).block();
}
use of com.couchbase.client.core.service.kv.ObserveContext in project couchbase-jvm-clients by couchbase.
the class ObserveIntegrationTest method persistToActive.
@Test
void persistToActive() {
String id = UUID.randomUUID().toString();
InsertResponse insertResponse = performInsert(id);
assertTrue(insertResponse.mutationToken().isPresent());
ObserveContext ctx = new ObserveContext(core.context(), Observe.ObservePersistTo.ACTIVE, Observe.ObserveReplicateTo.NONE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
Observe.poll(ctx).timeout(MAX_WAIT).block();
}
Aggregations