use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method expiration.
@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED, ClusterType.CAVES })
void expiration() {
JsonObject content = JsonObject.create().put("hello", "world");
String docId = prepare(content);
coll.mutateIn(docId, Arrays.asList(MutateInSpec.insert("foo2", "bar2")), MutateInOptions.mutateInOptions().expiry(Duration.ofSeconds(10)));
GetResult result = coll.get(docId, GetOptions.getOptions().withExpiry(true));
assertTrue(result.expiry().isPresent());
assertTrue(result.expiry().get().getSeconds() != 0);
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method reviveDocumentWithCAS.
@IgnoreWhen(missesCapabilities = { Capabilities.SUBDOC_REVIVE_DOCUMENT })
@Test
void reviveDocumentWithCAS() {
String docId = docId();
JsonObject body = JsonObject.create().put("foo", "bar");
MutateInResult mr = coll.mutateIn(docId, Collections.singletonList(upsert("txn", JsonObject.create().put("stgd", body).put("baz", "qux")).xattr().createPath()), MutateInOptions.mutateInOptions().createAsDeleted(true).accessDeleted(true).storeSemantics(StoreSemantics.INSERT));
// Create a CAS mismatch
coll.mutateIn(docId, Collections.singletonList(upsert("txn", JsonObject.create().put("stgd", body).put("baz", "qux")).xattr().createPath()), MutateInOptions.mutateInOptions().accessDeleted(true));
try {
coll.mutateIn(docId, Arrays.asList(new ReplaceBodyWithXattr("txn.stgd"), MutateInSpec.remove("txn").xattr()), MutateInOptions.mutateInOptions().accessDeleted(true).cas(mr.cas()).storeSemantics(StoreSemantics.REVIVE));
fail();
} catch (CasMismatchException ignored) {
}
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method insertExpandMacroXattr.
@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED })
void insertExpandMacroXattr() {
JsonObject updatedContent = checkSingleOpSuccessXattr(JsonObject.create(), Arrays.asList(MutateInSpec.insert("x.foo", MutateInMacro.CAS).xattr()));
assertNotEquals("${Mutation.CAS}", updatedContent.getString("foo"));
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method replaceBodyWithXattrSimulatingTransactionalInsert.
@IgnoreWhen(missesCapabilities = { Capabilities.SUBDOC_REVIVE_DOCUMENT })
@Test
void replaceBodyWithXattrSimulatingTransactionalInsert() {
String docId = docId();
JsonObject body = JsonObject.create().put("foo", "bar");
coll.mutateIn(docId, Collections.singletonList(upsert("txn", JsonObject.create().put("stgd", body).put("baz", "qux")).xattr().createPath()), MutateInOptions.mutateInOptions().createAsDeleted(true).accessDeleted(true).storeSemantics(StoreSemantics.INSERT));
coll.mutateIn(docId, Arrays.asList(new ReplaceBodyWithXattr("txn.stgd"), MutateInSpec.remove("txn").xattr()), MutateInOptions.mutateInOptions().accessDeleted(true).storeSemantics(StoreSemantics.REVIVE));
GetResult gr = coll.get(docId);
assertEquals(gr.contentAsObject(), body);
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method xattrOpsAreReordered.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void xattrOpsAreReordered() {
JsonObject content = JsonObject.create();
String docId = prepareXattr(content);
MutateInResult result = coll.mutateIn(docId, Arrays.asList(MutateInSpec.insert("foo2", "bar2"), MutateInSpec.increment("x.foo", 5).xattr()));
assertThrows(NoSuchElementException.class, () -> result.contentAs(0, String.class));
assertEquals(5, result.contentAs(1, Integer.class));
}
Aggregations