use of com.couchbase.client.java.json.JsonObject in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method arrayAppendListString.
@Test
public void arrayAppendListString() {
JsonObject updatedContent = checkSingleOpSuccess(JsonObject.create().put("foo", JsonArray.from("hello")), Arrays.asList(MutateInSpec.arrayAppend("foo", Arrays.asList("world", Arrays.asList("mars", "jupiter")))));
assertEquals(JsonArray.from("hello", "world", JsonArray.from("mars", "jupiter")), updatedContent.getArray("foo"));
}
use of com.couchbase.client.java.json.JsonObject in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method arrayInsertUniqueDoesNotExist.
@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED })
void arrayInsertUniqueDoesNotExist() {
JsonObject updatedContent = checkSingleOpSuccess(JsonObject.create().put("foo", JsonArray.from("hello", "world")), Arrays.asList(MutateInSpec.arrayAddUnique("foo", "cruel")));
assertEquals(JsonArray.from("hello", "world", "cruel"), updatedContent.getArray("foo"));
}
use of com.couchbase.client.java.json.JsonObject in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method arrayAppendXattr.
@Test
void arrayAppendXattr() {
JsonObject updatedContent = checkSingleOpSuccessXattr(JsonObject.create().put("foo", JsonArray.from("hello")), Arrays.asList(MutateInSpec.arrayAppend("x.foo", Arrays.asList("world")).xattr()));
assertEquals(JsonArray.from("hello", "world"), updatedContent.getArray("foo"));
}
use of com.couchbase.client.java.json.JsonObject in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method moreThan16.
@Test
void moreThan16() {
JsonObject content = JsonObject.create().put("hello", "world");
String docId = prepare(content);
assertThrows(InvalidArgumentException.class, () -> coll.mutateIn(docId, Arrays.asList(MutateInSpec.insert("foo0", "bar0"), MutateInSpec.insert("foo1", "bar1"), MutateInSpec.insert("foo2", "bar2"), MutateInSpec.insert("foo3", "bar3"), MutateInSpec.insert("foo4", "bar4"), MutateInSpec.insert("foo5", "bar5"), MutateInSpec.insert("foo6", "bar6"), MutateInSpec.insert("foo7", "bar7"), MutateInSpec.insert("foo8", "bar8"), MutateInSpec.insert("foo9", "bar9"), MutateInSpec.insert("foo10", "bar10"), MutateInSpec.insert("foo11", "bar11"), MutateInSpec.insert("foo12", "bar12"), MutateInSpec.insert("foo13", "bar13"), MutateInSpec.insert("foo14", "bar14"), MutateInSpec.insert("foo15", "bar15"), MutateInSpec.insert("foo16", "bar16"))));
}
use of com.couchbase.client.java.json.JsonObject in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method upsertString.
@Test
void upsertString() {
JsonObject updatedContent = checkSingleOpSuccess(JsonObject.create().put("foo", "bar"), Arrays.asList(upsert("foo", "bar2")));
assertEquals("bar2", updatedContent.getString("foo"));
}
Aggregations