Search in sources :

Example 1 with PrependResponse

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

the class MutationTokenIntegrationTest method tokenOnPrepend.

@Test
void tokenOnPrepend() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "hello".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());
    PrependRequest prependRequest = new PrependRequest(kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), id, ", world".getBytes(UTF_8), upsertResponse.cas(), Optional.empty(), null);
    core.send(prependRequest);
    PrependResponse prependResponse = prependRequest.response().get();
    assertTrue(prependResponse.status().success());
    assertMutationToken(prependResponse.mutationToken());
}
Also used : UpsertResponse(com.couchbase.client.core.msg.kv.UpsertResponse) UpsertRequest(com.couchbase.client.core.msg.kv.UpsertRequest) PrependRequest(com.couchbase.client.core.msg.kv.PrependRequest) PrependResponse(com.couchbase.client.core.msg.kv.PrependResponse) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

PrependRequest (com.couchbase.client.core.msg.kv.PrependRequest)1 PrependResponse (com.couchbase.client.core.msg.kv.PrependResponse)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