Search in sources :

Example 51 with IgnoreWhen

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

the class KeyValueErrorIntegrationTest method verifyGetAndLockDoubleLock.

/**
 * The mock still returns tmpfail but we want to check that the rerty reason is actually locked as it should
 * be post 5.0.
 */
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void verifyGetAndLockDoubleLock() {
    String validId = UUID.randomUUID().toString();
    collection.upsert(validId, JsonObject.create());
    collection.getAndLock(validId, Duration.ofSeconds(5));
    TimeoutException exception = assertThrows(TimeoutException.class, () -> collection.getAndLock(validId, Duration.ofSeconds(5), getAndLockOptions().timeout(Duration.ofSeconds(1))));
    assertTrue(exception.context().requestContext().retryReasons().contains(RetryReason.KV_LOCKED));
}
Also used : TimeoutException(com.couchbase.client.core.error.TimeoutException) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 52 with IgnoreWhen

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

the class SubdocMutateIntegrationTest method upsertExpandMacroXattr.

@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED })
void upsertExpandMacroXattr() {
    JsonObject updatedContent = checkSingleOpSuccessXattr(JsonObject.create(), Arrays.asList(MutateInSpec.insert("x.foo", MutateInMacro.CAS).xattr()));
    assertNotEquals("${Mutation.CAS}", updatedContent.getString("foo"));
}
Also used : JsonObject(com.couchbase.client.java.json.JsonObject) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 53 with IgnoreWhen

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

the class SubdocMutateIntegrationTest method replaceStringXattr.

@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void replaceStringXattr() {
    JsonObject updatedContent = checkSingleOpSuccessXattr(JsonObject.create().put("foo", "bar"), Arrays.asList(MutateInSpec.replace("x.foo", "bar2").xattr()));
    assertEquals("bar2", updatedContent.getString("foo"));
}
Also used : JsonObject(com.couchbase.client.java.json.JsonObject) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 54 with IgnoreWhen

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

the class SubdocMutateIntegrationTest method insertExpandMacroCRC32Xattr.

@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED })
void insertExpandMacroCRC32Xattr() {
    JsonObject updatedContent = checkSingleOpSuccessXattr(JsonObject.create(), Arrays.asList(MutateInSpec.insert("x.foo", MutateInMacro.VALUE_CRC_32C).xattr()));
    assertNotEquals(MutateInMacro.VALUE_CRC_32C.value(), updatedContent.getString("foo"));
}
Also used : JsonObject(com.couchbase.client.java.json.JsonObject) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 55 with IgnoreWhen

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

the class SubdocMutateIntegrationTest method replaceBodyWithXattrWithDurability.

@IgnoreWhen(missesCapabilities = { Capabilities.SUBDOC_REVIVE_DOCUMENT })
@Test
void replaceBodyWithXattrWithDurability() {
    String id = UUID.randomUUID().toString();
    MutationResult mr = coll.mutateIn(id, Arrays.asList(MutateInSpec.upsert("txn", JsonObject.create()).xattr().createPath()), mutateInOptions().accessDeleted(true).createAsDeleted(true).durability(DurabilityLevel.MAJORITY).storeSemantics(StoreSemantics.INSERT));
    coll.mutateIn(id, Arrays.asList(MutateInSpec.remove("txn").xattr()), mutateInOptions().accessDeleted(true).durability(DurabilityLevel.MAJORITY).storeSemantics(StoreSemantics.REVIVE));
}
Also used : 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)

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