Search in sources :

Example 11 with InsertResponse

use of com.couchbase.client.core.msg.kv.InsertResponse 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();
}
Also used : InsertResponse(com.couchbase.client.core.msg.kv.InsertResponse) RemoveResponse(com.couchbase.client.core.msg.kv.RemoveResponse) ObserveContext(com.couchbase.client.core.service.kv.ObserveContext) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest)

Example 12 with InsertResponse

use of com.couchbase.client.core.msg.kv.InsertResponse 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();
}
Also used : InsertResponse(com.couchbase.client.core.msg.kv.InsertResponse) ObserveContext(com.couchbase.client.core.service.kv.ObserveContext) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest)

Aggregations

InsertResponse (com.couchbase.client.core.msg.kv.InsertResponse)12 InsertRequest (com.couchbase.client.core.msg.kv.InsertRequest)8 CoreIntegrationTest (com.couchbase.client.core.util.CoreIntegrationTest)8 ObserveContext (com.couchbase.client.core.service.kv.ObserveContext)4 Test (org.junit.jupiter.api.Test)4 GetRequest (com.couchbase.client.core.msg.kv.GetRequest)2 GetResponse (com.couchbase.client.core.msg.kv.GetResponse)2 ExecutionException (java.util.concurrent.ExecutionException)2 ReplicaNotConfiguredException (com.couchbase.client.core.error.ReplicaNotConfiguredException)1 DecrementRequest (com.couchbase.client.core.msg.kv.DecrementRequest)1 DecrementResponse (com.couchbase.client.core.msg.kv.DecrementResponse)1 IncrementRequest (com.couchbase.client.core.msg.kv.IncrementRequest)1 IncrementResponse (com.couchbase.client.core.msg.kv.IncrementResponse)1 RemoveResponse (com.couchbase.client.core.msg.kv.RemoveResponse)1 IgnoreWhen (com.couchbase.client.test.IgnoreWhen)1