Search in sources :

Example 1 with DecrementResponse

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

the class MutationTokenIntegrationTest method tokenOnDecrement.

@Test
void tokenOnDecrement() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "10".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());
    DecrementRequest decrementRequest = new DecrementRequest(kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), id, 1, Optional.empty(), 0, Optional.empty(), null);
    core.send(decrementRequest);
    DecrementResponse decrementResponse = decrementRequest.response().get();
    assertTrue(decrementResponse.status().success());
    assertMutationToken(decrementResponse.mutationToken());
}
Also used : InsertResponse(com.couchbase.client.core.msg.kv.InsertResponse) InsertRequest(com.couchbase.client.core.msg.kv.InsertRequest) DecrementRequest(com.couchbase.client.core.msg.kv.DecrementRequest) DecrementResponse(com.couchbase.client.core.msg.kv.DecrementResponse) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

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