Search in sources :

Example 31 with CQLWrapper

use of org.folio.rest.persist.cql.CQLWrapper in project raml-module-builder by folio-org.

the class CQLWrapperTest method wrap.

@Test
public void wrap() throws FieldException {
    CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("cql.allRecords=1");
    wrapper.addWrapper(wrapper);
    wrapper.addWrapper(wrapper, "or");
    assertThat(wrapper.toString(), is(" WHERE true and true or true"));
}
Also used : CQL2PgJSON(org.z3950.zing.cql.cql2pgjson.CQL2PgJSON) CQLWrapper(org.folio.rest.persist.cql.CQLWrapper) Test(org.junit.Test)

Example 32 with CQLWrapper

use of org.folio.rest.persist.cql.CQLWrapper in project raml-module-builder by folio-org.

the class CQLWrapperTest method invalidCQL.

@Test(expected = IllegalStateException.class)
public void invalidCQL() throws FieldException {
    CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("or name=miller");
    wrapper.toString();
}
Also used : CQL2PgJSON(org.z3950.zing.cql.cql2pgjson.CQL2PgJSON) CQLWrapper(org.folio.rest.persist.cql.CQLWrapper) Test(org.junit.Test)

Aggregations

CQLWrapper (org.folio.rest.persist.cql.CQLWrapper)32 List (java.util.List)24 FieldException (org.z3950.zing.cql.cql2pgjson.FieldException)22 Validate (org.folio.rest.annotations.Validate)12 CQL2PgJSON (org.z3950.zing.cql.cql2pgjson.CQL2PgJSON)12 PostgresClient (org.folio.rest.persist.PostgresClient)9 CQLParseException (org.z3950.zing.cql.CQLParseException)8 Test (org.junit.Test)6 Limit (org.folio.rest.persist.Criteria.Limit)4 Offset (org.folio.rest.persist.Criteria.Offset)4 HoldingsRecord (org.folio.rest.jaxrs.model.HoldingsRecord)3 Instance (org.folio.rest.jaxrs.model.Instance)3 ArrayList (java.util.ArrayList)2 OutStream (org.folio.rest.tools.utils.OutStream)2 io.vertx.core (io.vertx.core)1 Logger (io.vertx.core.logging.Logger)1 LoggerFactory (io.vertx.core.logging.LoggerFactory)1 Async (io.vertx.ext.unit.Async)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1