use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByQueryOptions.
@Test
public void findByQueryOptions() {
// 4
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofNanos(10));
assertThrows(AmbiguousTimeoutException.class, () -> template.findByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(otherScope).inCollection(otherCollection).withOptions(options).all().collectList().block());
}
use of com.couchbase.client.java.query.QueryOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByQueryOther.
@Test
public void findByQueryOther() {
// 4
QueryOptions options = QueryOptions.queryOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("lowj")).block();
try {
List<Airport> found = template.findByQuery(Airport.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).inScope(otherScope).inCollection(otherCollection).withOptions(options).all().collectList().block();
assertEquals(saved.getId(), found.get(0).getId());
} finally {
template.removeById().inScope(otherScope).inCollection(otherCollection).one(saved.getId()).block();
}
}
use of com.couchbase.client.java.query.QueryOptions in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method reactiveSelect.
@Test
void reactiveSelect() {
String id = insertDoc();
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS);
Mono<ReactiveQueryResult> result = cluster.reactive().query("select * from " + bucketName + " where meta().id=\"" + id + "\"", options);
List<JsonObject> rows = result.flux().flatMap(ReactiveQueryResult::rowsAsObject).collectList().block();
assertNotNull(rows);
assertEquals(1, rows.size());
}
use of com.couchbase.client.java.query.QueryOptions in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method getProfileWhenRequested.
@Test
void getProfileWhenRequested() {
String id = insertDoc();
QueryOptions options = queryOptions().profile(QueryProfile.TIMINGS);
QueryResult result = cluster.query("select * from " + bucketName + " where meta().id=\"" + id + "\"", options);
JsonObject profile = result.metaData().profile().get();
assertTrue(profile.size() > 0);
}
use of com.couchbase.client.java.query.QueryOptions in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method asyncPositionalParameterizedSelectQuery.
@Test
void asyncPositionalParameterizedSelectQuery() throws Exception {
String id = insertDoc();
QueryOptions options = queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS).parameters(JsonArray.from(id));
CompletableFuture<QueryResult> result = cluster.async().query("select * from " + bucketName + " where meta().id=$1", options);
List<JsonObject> rows = result.get().rowsAs(JsonObject.class);
assertEquals(1, rows.size());
}
Aggregations