use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testInFilterEmptyElements.
@Test
public void testInFilterEmptyElements() {
QueryParameters query = QueryParameters.query("where=username:in:[johnf,,,,garryz]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.IN, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
Assert.assertEquals(2, query.getFilters().get(0).getValues().size());
Assert.assertEquals("johnf", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("garryz", query.getFilters().get(0).getValues().get(1));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testAndSignInFilter.
@Test
public void testAndSignInFilter() {
QueryParameters query = QueryParameters.query("limit=30&where=title:like:'Tools & Furniture'").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("title", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.LIKE, query.getFilters().get(0).getOperation());
Assert.assertEquals("Tools & Furniture", query.getFilters().get(0).getValue());
Assert.assertNotNull(query.getLimit());
Assert.assertEquals(30, query.getLimit().longValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testQuotesInInFilter.
@Test
public void testQuotesInInFilter() {
QueryParameters query = QueryParameters.query("where=country:in:['Czech Republic',China]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("country", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.IN, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
Assert.assertEquals(2, query.getFilters().get(0).getValues().size());
Assert.assertEquals("Czech Republic", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("China", query.getFilters().get(0).getValues().get(1));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testDateValueFilter.
@Test
public void testDateValueFilter() {
Date d = Date.from(ZonedDateTime.parse("2014-11-26T11:15:08Z").toInstant());
QueryParameters query = QueryParameters.query("where=username:gte:dt'2014-11-26T11:15:08Z'").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.GTE, query.getFilters().get(0).getOperation());
Assert.assertEquals(d, query.getFilters().get(0).getDateValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testNinicFilter.
@Test
public void testNinicFilter() {
QueryParameters query = QueryParameters.query("where=username:ninic:[joHnf,johng]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.NINIC, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
Assert.assertEquals(2, query.getFilters().get(0).getValues().size());
Assert.assertEquals("joHnf", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("johng", query.getFilters().get(0).getValues().get(1));
}
Aggregations