Search in sources :

Example 36 with MutationResult

use of com.couchbase.client.java.kv.MutationResult in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnInsert.

@Test
void tokenOnInsert() {
    String id = UUID.randomUUID().toString();
    MutationResult result = collection.insert(id, JsonObject.create());
    assertMutationToken(result.mutationToken());
}
Also used : MutationResult(com.couchbase.client.java.kv.MutationResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 37 with MutationResult

use of com.couchbase.client.java.kv.MutationResult in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnUpsert.

@Test
void tokenOnUpsert() {
    String id = UUID.randomUUID().toString();
    MutationResult result = collection.upsert(id, JsonObject.create());
    assertMutationToken(result.mutationToken());
}
Also used : MutationResult(com.couchbase.client.java.kv.MutationResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 38 with MutationResult

use of com.couchbase.client.java.kv.MutationResult in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnSubdocMutate.

@Test
void tokenOnSubdocMutate() {
    String id = UUID.randomUUID().toString();
    MutationResult result = collection.upsert(id, JsonObject.create());
    assertMutationToken(result.mutationToken());
    MutateInResult mutateResult = collection.mutateIn(id, Arrays.asList(MutateInSpec.insert("foo", true)));
    assertMutationToken(mutateResult.mutationToken());
}
Also used : MutateInResult(com.couchbase.client.java.kv.MutateInResult) MutationResult(com.couchbase.client.java.kv.MutationResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 39 with MutationResult

use of com.couchbase.client.java.kv.MutationResult in project couchbase-jvm-clients by couchbase.

the class ObserveIntegrationTest method removePersistToActive.

@Test
void removePersistToActive() {
    String id = UUID.randomUUID().toString();
    MutationResult result = collection.insert(id, "some value", insertOptions().durability(PersistTo.ACTIVE, ReplicateTo.NONE));
    assertTrue(result.cas() != 0);
    MutationResult removeResult = collection.remove(id, removeOptions().durability(PersistTo.ACTIVE, ReplicateTo.NONE));
    assertTrue(removeResult.cas() != 0);
    assertTrue(result.cas() != removeResult.cas());
    assertTrue(result.mutationToken().isPresent());
}
Also used : MutationResult(com.couchbase.client.java.kv.MutationResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 40 with MutationResult

use of com.couchbase.client.java.kv.MutationResult in project couchbase-jvm-clients by couchbase.

the class ObserveIntegrationTest method persistToActive.

@Test
void persistToActive() {
    String id = UUID.randomUUID().toString();
    MutationResult result = collection.insert(id, "some value", insertOptions().durability(PersistTo.ACTIVE, ReplicateTo.NONE));
    assertTrue(result.cas() != 0);
    assertTrue(result.mutationToken().isPresent());
}
Also used : MutationResult(com.couchbase.client.java.kv.MutationResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

MutationResult (com.couchbase.client.java.kv.MutationResult)42 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)40 Test (org.junit.jupiter.api.Test)40 JsonObject (com.couchbase.client.java.json.JsonObject)16 IgnoreWhen (com.couchbase.client.test.IgnoreWhen)13 GetResult (com.couchbase.client.java.kv.GetResult)11 SearchQuery.queryString (com.couchbase.client.java.search.SearchQuery.queryString)5 SearchResult (com.couchbase.client.java.search.result.SearchResult)5 DocumentNotFoundException (com.couchbase.client.core.error.DocumentNotFoundException)4 TimeoutException (com.couchbase.client.core.error.TimeoutException)3 Bucket (com.couchbase.client.java.Bucket)2 Collection (com.couchbase.client.java.Collection)2 ExistsResult (com.couchbase.client.java.kv.ExistsResult)2 QueryOptions (com.couchbase.client.java.query.QueryOptions)2 QueryResult (com.couchbase.client.java.query.QueryResult)2 ReactiveQueryResult (com.couchbase.client.java.query.ReactiveQueryResult)2 CasMismatchException (com.couchbase.client.core.error.CasMismatchException)1 CouchbaseException (com.couchbase.client.core.error.CouchbaseException)1 DocumentExistsException (com.couchbase.client.core.error.DocumentExistsException)1 RateLimitedException (com.couchbase.client.core.error.RateLimitedException)1