Search in sources :

Example 1 with IncrementResponse

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

the class MutationTokenIntegrationTest method tokenOnIncrement.

@Test
void tokenOnIncrement() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "1".getBytes(UTF_8);
    InsertRequest insertRequest = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), Optional.empty(), null);
    core.send(insertRequest);
    InsertResponse insertResponse = insertRequest.response().get();
    assertTrue(insertResponse.status().success());
    assertMutationToken(insertResponse.mutationToken());
    IncrementRequest incrementRequest = new IncrementRequest(kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), id, 1, Optional.empty(), 0, Optional.empty(), null);
    core.send(incrementRequest);
    IncrementResponse incrementResponse = incrementRequest.response().get();
    assertTrue(incrementResponse.status().success());
    assertMutationToken(incrementResponse.mutationToken());
}
Also used : InsertResponse(com.couchbase.client.core.msg.kv.InsertResponse) IncrementRequest(com.couchbase.client.core.msg.kv.IncrementRequest) InsertRequest(com.couchbase.client.core.msg.kv.InsertRequest) IncrementResponse(com.couchbase.client.core.msg.kv.IncrementResponse) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

IncrementRequest (com.couchbase.client.core.msg.kv.IncrementRequest)1 IncrementResponse (com.couchbase.client.core.msg.kv.IncrementResponse)1 InsertRequest (com.couchbase.client.core.msg.kv.InsertRequest)1 InsertResponse (com.couchbase.client.core.msg.kv.InsertResponse)1 CoreIntegrationTest (com.couchbase.client.core.util.CoreIntegrationTest)1 Test (org.junit.jupiter.api.Test)1