use of org.folio.cql2pgjson.exception.CQL2PgJSONException in project raml-module-builder by folio-org.
the class ConnIT method streamGetDoneHandlerWithThrowable.
@Test
void streamGetDoneHandlerWithThrowable(VertxTestContext vtc) throws CQL2PgJSONException {
CQLWrapper cqlWrapper = new CQLWrapper(new CQL2PgJSON("jsonb"), "key=b");
with(randomUuid(), "a", randomUuid(), "b", trans -> {
return trans.streamGet("t", Pojo.class, cqlWrapper, info -> info.result().handler(x -> {
throw new RuntimeException("foo");
}));
}).onComplete(failingThenComplete(vtc, t -> assertThat(t).hasMessage("foo")));
}
use of org.folio.cql2pgjson.exception.CQL2PgJSONException in project raml-module-builder by folio-org.
the class ConnIT method streamGet.
@ParameterizedTest
@CsvSource({ "key=*, 2", "key=b, 1", "key=x, 0" })
void streamGet(String cql, int total, VertxTestContext vtc) throws CQL2PgJSONException {
AtomicInteger count = new AtomicInteger();
AtomicBoolean end = new AtomicBoolean();
CQLWrapper cqlWrapper = new CQLWrapper(new CQL2PgJSON("jsonb"), cql);
with(randomUuid(), "a", randomUuid(), "b", trans -> {
return trans.streamGet("t", Pojo.class, cqlWrapper, as -> {
PostgresClientStreamResult<Pojo> r = as.result();
assertThat(r.resultInfo().getTotalRecords()).isEqualTo(total);
r.handler(x -> count.incrementAndGet());
r.exceptionHandler(t -> vtc.failNow(t));
r.endHandler(x -> end.set(true));
});
}).onComplete(succeedingThenComplete(vtc, x -> {
assertThat(count.get()).isEqualTo(total);
assertThat(end.get()).isTrue();
}));
}
Aggregations