Search in sources :

Example 76 with IgnoreWhen

use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.

the class CreateAsDeletedIntegrationTest method replaceTombstoneWithTxnXattrWithCAS.

@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void replaceTombstoneWithTxnXattrWithCAS() {
    String id = docId();
    insertTombstoneWithTxnXattr(coll, id, JsonObject.create());
    LookupInResult result = assertIsTombstone(coll, id);
    coll.mutateIn(id, Collections.singletonList(MutateInSpec.upsert("txn", JsonObject.create()).xattr()), MutateInOptions.mutateInOptions().storeSemantics(StoreSemantics.REPLACE).cas(result.cas()).accessDeleted(true));
}
Also used : LookupInResult(com.couchbase.client.java.kv.LookupInResult) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 77 with IgnoreWhen

use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.

the class CreateAsDeletedIntegrationTest method replaceTombstoneWithTxnXattrWithCASWhichHasChanged.

@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void replaceTombstoneWithTxnXattrWithCASWhichHasChanged() {
    String id = docId();
    insertTombstoneWithTxnXattr(coll, id, JsonObject.create());
    LookupInResult result = assertIsTombstone(coll, id);
    upsertEmptyTombstone(coll, id);
    LookupInResult result2 = assertIsTombstone(coll, id);
    assertNotEquals(result.cas(), result2.cas());
    assertThrows(CasMismatchException.class, () -> {
        coll.mutateIn(id, Collections.singletonList(MutateInSpec.insert("txn", JsonObject.create()).xattr()), MutateInOptions.mutateInOptions().cas(// note using the original CAS not the changed one
        result.cas()).accessDeleted(true));
    });
}
Also used : LookupInResult(com.couchbase.client.java.kv.LookupInResult) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 78 with IgnoreWhen

use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.

the class KeyValueIntegrationTest method exists.

/**
 * Mock does not support Get Meta, so we need to ignore it there.
 */
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void exists() {
    String id = UUID.randomUUID().toString();
    assertFalse(collection.exists(id).exists());
    MutationResult insertResult = collection.insert(id, "Hello, World");
    assertTrue(insertResult.cas() != 0);
    ExistsResult existsResult = collection.exists(id);
    assertEquals(insertResult.cas(), existsResult.cas());
    assertTrue(existsResult.exists());
    assertFalse(collection.exists("some_id").exists());
}
Also used : ExistsResult(com.couchbase.client.java.kv.ExistsResult) MutationResult(com.couchbase.client.java.kv.MutationResult) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 79 with IgnoreWhen

use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.

the class ClusterLevelQueryIntegrationTest method performsClusterLevelQueryWithoutOpenBucket.

@Test
@IgnoreWhen(missesCapabilities = { Capabilities.GLOBAL_CONFIG, Capabilities.QUERY }, clusterTypes = ClusterType.CAVES)
void performsClusterLevelQueryWithoutOpenBucket() {
    cluster.waitUntilReady(Duration.ofSeconds(5));
    QueryResult result = cluster.query("select 1=1", queryOptions().clientContextId("my-context-id"));
    assertEquals(1, result.rowsAsObject().size());
    assertEquals("my-context-id", result.metaData().clientContextId());
}
Also used : QueryResult(com.couchbase.client.java.query.QueryResult) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

IgnoreWhen (com.couchbase.client.test.IgnoreWhen)79 Test (org.junit.jupiter.api.Test)78 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)70 JsonObject (com.couchbase.client.java.json.JsonObject)41 GetResult (com.couchbase.client.java.kv.GetResult)15 MutationResult (com.couchbase.client.java.kv.MutationResult)13 CoreIntegrationTest (com.couchbase.client.core.util.CoreIntegrationTest)9 RateLimitedException (com.couchbase.client.core.error.RateLimitedException)8 TimeoutException (com.couchbase.client.core.error.TimeoutException)7 LookupInResult (com.couchbase.client.java.kv.LookupInResult)7 CouchbaseException (com.couchbase.client.core.error.CouchbaseException)6 ReplaceBodyWithXattr (com.couchbase.client.java.kv.ReplaceBodyWithXattr)6 SearchIndex (com.couchbase.client.java.manager.search.SearchIndex)5 CasMismatchException (com.couchbase.client.core.error.CasMismatchException)4 MutateInResult (com.couchbase.client.java.kv.MutateInResult)4 TestNodeConfig (com.couchbase.client.test.TestNodeConfig)4 DocumentNotFoundException (com.couchbase.client.core.error.DocumentNotFoundException)3 FeatureNotAvailableException (com.couchbase.client.core.error.FeatureNotAvailableException)3 UnambiguousTimeoutException (com.couchbase.client.core.error.UnambiguousTimeoutException)3 Core (com.couchbase.client.core.Core)2