use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class CouchbaseTemplateQueryCollectionIntegrationTests method findByQueryOptions.
@Test
public void findByQueryOptions() {
// 4
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofNanos(10));
assertThrows(AmbiguousTimeoutException.class, () -> couchbaseTemplate.findByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(otherScope).inCollection(otherCollection).withOptions(options).all());
}
use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class JavaIntegrationTests method toQueryOptions.
private static QueryOptions toQueryOptions(CommonOptions<?>.BuiltCommonOptions options) {
QueryOptions result = QueryOptions.queryOptions();
options.timeout().ifPresent(result::timeout);
options.retryStrategy().ifPresent(result::retryStrategy);
return result;
}
use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method removeByQuery.
@Test
public void removeByQuery() {
// 8
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(scopeName).inCollection(collectionName).one(vie.withIcao("lowe")).block();
List<RemoveResult> removeResults = template.removeByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(scopeName).inCollection(collectionName).withOptions(options).matching(Query.query(QueryCriteria.where("iata").is(vie.getIata()))).all().collectList().block();
assertEquals(saved.getId(), removeResults.get(0).getId());
}
use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method removeByQueryOther.
@Test
public void removeByQueryOther() {
// 8
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("lown")).block();
List<RemoveResult> removeResults = template.removeByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(otherScope).inCollection(otherCollection).withOptions(options).matching(Query.query(QueryCriteria.where("iata").is(vie.getIata()))).all().collectList().block();
assertEquals(saved.getId(), removeResults.get(0).getId());
}
use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByQuery.
@Test
public void findByQuery() {
// 4
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(scopeName).inCollection(collectionName).one(vie.withIcao("lowa")).block();
try {
List<Airport> found = template.findByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(scopeName).inCollection(collectionName).withOptions(options).all().collectList().block();
assertEquals(saved.getId(), found.get(0).getId());
} finally {
template.removeById().inScope(scopeName).inCollection(collectionName).one(saved.getId()).block();
}
}
Aggregations