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());
}
Aggregations