Search in sources :

Example 1 with SubdocMutateResponse

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

the class MutationTokenIntegrationTest method tokenOnSubdocMutate.

@Test
void tokenOnSubdocMutate() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "{}".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());
    List<SubdocMutateRequest.Command> commands = new ArrayList<>();
    commands.add(new SubdocMutateRequest.Command(SubdocCommandType.DICT_ADD, "foo", "\"bar\"".getBytes(UTF_8), true, false, false, 0));
    SubdocMutateRequest subdocMutateRequest = new SubdocMutateRequest(kvTimeout, core.context(), collectionIdentifier, null, env.retryStrategy(), id, false, false, false, false, false, commands, 0, false, 0, Optional.empty(), null);
    core.send(subdocMutateRequest);
    SubdocMutateResponse subdocMutateResponse = subdocMutateRequest.response().get();
    assertTrue(subdocMutateResponse.status().success());
    assertMutationToken(subdocMutateResponse.mutationToken());
}
Also used : SubdocMutateRequest(com.couchbase.client.core.msg.kv.SubdocMutateRequest) SubdocMutateResponse(com.couchbase.client.core.msg.kv.SubdocMutateResponse) UpsertResponse(com.couchbase.client.core.msg.kv.UpsertResponse) UpsertRequest(com.couchbase.client.core.msg.kv.UpsertRequest) ArrayList(java.util.ArrayList) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

SubdocMutateRequest (com.couchbase.client.core.msg.kv.SubdocMutateRequest)1 SubdocMutateResponse (com.couchbase.client.core.msg.kv.SubdocMutateResponse)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 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1