Search in sources :

Example 6 with ExistsOptions

use of com.couchbase.client.java.kv.ExistsOptions in project spring-data-couchbase by spring-projects.

the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method existsByIdOptions.

@Test
public void existsByIdOptions() {
    // 1 - Options
    ExistsOptions options = ExistsOptions.existsOptions().timeout(Duration.ofNanos(10));
    assertThrows(UnambiguousTimeoutException.class, () -> template.existsById().inScope(otherScope).inCollection(otherCollection).withOptions(options).one(vie.getId()).block());
}
Also used : ExistsOptions(com.couchbase.client.java.kv.ExistsOptions) Test(org.junit.jupiter.api.Test)

Example 7 with ExistsOptions

use of com.couchbase.client.java.kv.ExistsOptions in project spring-data-couchbase by spring-projects.

the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method existsByIdOther.

@Test
public void existsByIdOther() {
    // 1
    GetOptions options = GetOptions.getOptions().timeout(Duration.ofSeconds(10));
    ExistsOptions existsOptions = ExistsOptions.existsOptions().timeout(Duration.ofSeconds(10));
    Airport saved = template.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("lowg")).block();
    try {
        Boolean exists = template.existsById().inScope(otherScope).inCollection(otherCollection).withOptions(existsOptions).one(vie.getId()).block();
        assertTrue(exists, "Airport should exist: " + vie.getId());
    } finally {
        template.removeById().inScope(otherScope).inCollection(otherCollection).one(vie.getId()).block();
    }
}
Also used : Airport(org.springframework.data.couchbase.domain.Airport) ExistsOptions(com.couchbase.client.java.kv.ExistsOptions) GetOptions(com.couchbase.client.java.kv.GetOptions) Test(org.junit.jupiter.api.Test)

Aggregations

ExistsOptions (com.couchbase.client.java.kv.ExistsOptions)7 Test (org.junit.jupiter.api.Test)6 GetOptions (com.couchbase.client.java.kv.GetOptions)4 Airport (org.springframework.data.couchbase.domain.Airport)4 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)1 GetMetaRequest (com.couchbase.client.core.msg.kv.GetMetaRequest)1 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)1 Duration (java.time.Duration)1