use of com.couchbase.client.java.analytics.AnalyticsOptions in project spring-data-couchbase by spring-projects.
the class CouchbaseTemplateQueryCollectionIntegrationTests method findByAnalyticsOther.
@Test
// needs analytics data set
@Disabled
public void findByAnalyticsOther() {
// 2
AnalyticsOptions options = AnalyticsOptions.analyticsOptions().timeout(Duration.ofSeconds(10));
Airport saved = couchbaseTemplate.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("566"));
try {
List<Airport> found = couchbaseTemplate.findByAnalytics(Airport.class).inScope(otherScope).inCollection(otherCollection).withOptions(options).all();
assertEquals(saved, found);
} finally {
couchbaseTemplate.removeById().inScope(otherScope).inCollection(otherCollection).one(saved.getId());
}
}
use of com.couchbase.client.java.analytics.AnalyticsOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByAnalyticsOther.
@Test
// needs analytics data set
@Disabled
public void findByAnalyticsOther() {
// 2
AnalyticsOptions options = AnalyticsOptions.analyticsOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("lowh")).block();
try {
List<Airport> found = template.findByAnalytics(Airport.class).inScope(otherScope).inCollection(otherCollection).withOptions(options).all().collectList().block();
assertEquals(saved, found);
} finally {
template.removeById().inScope(otherScope).inCollection(otherCollection).one(saved.getId()).block();
}
}
use of com.couchbase.client.java.analytics.AnalyticsOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByAnalyticsOptions.
@Test
// needs analytics data set
@Disabled
public void findByAnalyticsOptions() {
// 2
AnalyticsOptions options = AnalyticsOptions.analyticsOptions().timeout(Duration.ofNanos(10));
assertThrows(AmbiguousTimeoutException.class, () -> template.findByAnalytics(Airport.class).inScope(otherScope).inCollection(otherCollection).withOptions(options).all().collectList().block());
}
use of com.couchbase.client.java.analytics.AnalyticsOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method findByAnalytics.
@Test
// needs analytics data set
@Disabled
public void findByAnalytics() {
// 2
AnalyticsOptions options = AnalyticsOptions.analyticsOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(scopeName).inCollection(collectionName).one(vie.withIcao("low8")).block();
try {
List<Airport> found = template.findByAnalytics(Airport.class).inScope(scopeName).inCollection(collectionName).withOptions(options).all().collectList().block();
assertEquals(saved, found);
} finally {
template.removeById().inScope(scopeName).inCollection(collectionName).one(saved.getId()).block();
}
}
use of com.couchbase.client.java.analytics.AnalyticsOptions in project couchbase-jvm-clients by couchbase.
the class AsyncScope method analyticsQuery.
/**
* Performs an Analytics query with custom {@link AnalyticsOptions}.
*
* @param statement the Analytics query statement as a raw string.
* @param options the custom options for this analytics query.
* @return the {@link AnalyticsResult} once the response arrives successfully.
*/
public CompletableFuture<AnalyticsResult> analyticsQuery(final String statement, final AnalyticsOptions options) {
notNull(options, "AnalyticsOptions", () -> new ReducedAnalyticsErrorContext(statement));
AnalyticsOptions.Built opts = options.build();
JsonSerializer serializer = opts.serializer() == null ? environment.jsonSerializer() : opts.serializer();
return AnalyticsAccessor.analyticsQueryAsync(core, analyticsRequest(statement, opts), serializer);
}
Aggregations