use of com.couchbase.client.java.kv.ReplaceBodyWithXattr in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method replaceBodyWithXattrSimulatingTransactionalReplace.
@IgnoreWhen(missesCapabilities = { Capabilities.SUBDOC_REPLACE_BODY_WITH_XATTR })
@Test
void replaceBodyWithXattrSimulatingTransactionalReplace() {
String docId = docId();
JsonObject body = JsonObject.create().put("foo", "bar");
coll.upsert(docId, JsonObject.create());
MutateInResult mr = coll.mutateIn(docId, Collections.singletonList(upsert("txn", JsonObject.create().put("stgd", body).put("baz", "qux")).xattr().createPath()), MutateInOptions.mutateInOptions().accessDeleted(true));
coll.mutateIn(docId, Arrays.asList(new ReplaceBodyWithXattr("txn.stgd"), MutateInSpec.remove("txn").xattr()), MutateInOptions.mutateInOptions().cas(mr.cas()));
GetResult gr = coll.get(docId);
assertEquals(gr.contentAsObject(), body);
}
Aggregations