use of org.folio.cql2pgjson.exception.FieldException in project raml-module-builder by folio-org.
the class PostgresClientIT method assertCQLWrapper.
private void assertCQLWrapper(TestContext context, Function<CQLWrapper, Future<Results<StringPojo>>> function) {
try {
JsonArray ids = new JsonArray().add(randomUuid()).add(randomUuid());
insertXAndSingleQuotePojo(context, ids);
CQLWrapper cqlWrapper = new CQLWrapper(new CQL2PgJSON("jsonb"), "key = x");
function.apply(cqlWrapper).onComplete(context.asyncAssertSuccess(res -> {
assertThat(res.getResults().size(), is(1));
assertThat(res.getResults().get(0).getId(), is(ids.getString(0)));
}));
} catch (FieldException e) {
context.fail(e);
}
}
use of org.folio.cql2pgjson.exception.FieldException in project raml-module-builder by folio-org.
the class PostgresClientIT method streamGetWithFacetsZeroHits.
@Test
public void streamGetWithFacetsZeroHits(TestContext context) throws FieldException {
AtomicInteger objectCount = new AtomicInteger();
Async async = context.async();
List<FacetField> facets = new ArrayList<FacetField>();
facets.add(new FacetField("jsonb->>'edition'"));
facets.add(new FacetField("jsonb->>'title'"));
createTableWithPoLines(context);
CQLWrapper wrapper = new CQLWrapper(new CQL2PgJSON("jsonb"), "edition=Millenium edition");
postgresClient.streamGet(MOCK_POLINES_TABLE, Object.class, "jsonb", wrapper, true, null, facets, context.asyncAssertSuccess(sr -> {
ResultInfo resultInfo = sr.resultInfo();
context.assertEquals(0, resultInfo.getTotalRecords());
context.assertEquals(0, resultInfo.getFacets().size());
sr.handler(streamHandler -> objectCount.incrementAndGet());
sr.endHandler(x -> {
context.assertEquals(0, objectCount.get());
async.complete();
});
}));
async.awaitSuccess();
}
use of org.folio.cql2pgjson.exception.FieldException in project raml-module-builder by folio-org.
the class PostgresClientIT method streamGetWithFilterZeroHits.
@Test
public void streamGetWithFilterZeroHits(TestContext context) throws FieldException {
AtomicInteger objectCount = new AtomicInteger();
Async async = context.async();
createTableWithPoLines(context);
CQLWrapper wrapper = new CQLWrapper(new CQL2PgJSON("jsonb"), "edition=Millenium edition");
postgresClient.streamGet(MOCK_POLINES_TABLE, Object.class, "jsonb", wrapper, false, null, context.asyncAssertSuccess(sr -> {
context.assertEquals(0, sr.resultInfo().getTotalRecords());
sr.handler(streamHandler -> objectCount.incrementAndGet());
sr.endHandler(x -> {
context.assertEquals(0, objectCount.get());
async.complete();
});
}));
async.awaitSuccess();
}
Aggregations