use of com.example.graphql.client.betterbotz.products.GetProductsWithFilterQuery in project stargate by stargate.
the class ApolloTestBase method getProducts.
protected static Optional<GetProductsWithFilterQuery.Products> getProducts(ApolloClient client, int pageSize, Optional<String> pageState) {
ProductsFilterInput filterInput = ProductsFilterInput.builder().build();
QueryOptions.Builder optionsBuilder = QueryOptions.builder().pageSize(pageSize).consistency(QueryConsistency.LOCAL_QUORUM);
pageState.ifPresent(optionsBuilder::pageState);
QueryOptions options = optionsBuilder.build();
GetProductsWithFilterQuery query = GetProductsWithFilterQuery.builder().filter(filterInput).options(options).build();
GetProductsWithFilterQuery.Data result = getObservable(client.query(query));
assertThat(result.getProducts()).hasValueSatisfying(products -> {
assertThat(products.getValues()).hasValueSatisfying(values -> {
assertThat(values).hasSizeLessThanOrEqualTo(pageSize);
});
});
return result.getProducts();
}
use of com.example.graphql.client.betterbotz.products.GetProductsWithFilterQuery in project stargate by stargate.
the class ApolloTestBase method getProductValues.
protected List<GetProductsWithFilterQuery.Value> getProductValues(ApolloClient client, String productId) {
ProductsFilterInput filterInput = ProductsFilterInput.builder().id(UuidFilterInput.builder().eq(productId).build()).build();
QueryOptions options = QueryOptions.builder().consistency(QueryConsistency.LOCAL_QUORUM).build();
GetProductsWithFilterQuery query = GetProductsWithFilterQuery.builder().filter(filterInput).options(options).build();
GetProductsWithFilterQuery.Data result = getObservable(client.query(query));
assertThat(result.getProducts()).isPresent();
GetProductsWithFilterQuery.Products products = result.getProducts().get();
assertThat(products.getValues()).isPresent();
return products.getValues().get();
}
Aggregations