Search in sources :

Example 1 with ReplaceResponse

use of com.couchbase.client.core.msg.kv.ReplaceResponse in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnReplace.

@Test
void tokenOnReplace() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "hello, world".getBytes(UTF_8);
    UpsertRequest upsertRequest = new UpsertRequest(id, content, 0, false, 0, kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), Optional.empty(), null);
    core.send(upsertRequest);
    UpsertResponse upsertResponse = upsertRequest.response().get();
    assertTrue(upsertResponse.status().success());
    assertMutationToken(upsertResponse.mutationToken());
    ReplaceRequest replaceRequest = new ReplaceRequest(id, content, 0, false, 0, kvTimeout, upsertResponse.cas(), core.context(), collectionIdentifier, env.retryStrategy(), Optional.empty(), null);
    core.send(replaceRequest);
    ReplaceResponse replaceResponse = replaceRequest.response().get();
    assertTrue(replaceResponse.status().success());
    assertMutationToken(replaceResponse.mutationToken());
}
Also used : ReplaceRequest(com.couchbase.client.core.msg.kv.ReplaceRequest) UpsertResponse(com.couchbase.client.core.msg.kv.UpsertResponse) UpsertRequest(com.couchbase.client.core.msg.kv.UpsertRequest) ReplaceResponse(com.couchbase.client.core.msg.kv.ReplaceResponse) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ReplaceRequest (com.couchbase.client.core.msg.kv.ReplaceRequest)1 ReplaceResponse (com.couchbase.client.core.msg.kv.ReplaceResponse)1 UpsertRequest (com.couchbase.client.core.msg.kv.UpsertRequest)1 UpsertResponse (com.couchbase.client.core.msg.kv.UpsertResponse)1 CoreIntegrationTest (com.couchbase.client.core.util.CoreIntegrationTest)1 Test (org.junit.jupiter.api.Test)1