use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testIsNullFilter.
@Test
public void testIsNullFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("description");
qf.setOperation(FilterOperation.ISNULL);
qf.setValue("");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(1, projects.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testNeqic.
@Test
public void testNeqic() {
QueryFilter qf = new QueryFilter();
qf.setField("firstname");
qf.setOperation(FilterOperation.NEQIC);
qf.setValue("JaCK");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(98, users.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testDateEq.
@Test
public void testDateEq() {
QueryFilter qf = new QueryFilter();
qf.setField("createdAt");
qf.setOperation(FilterOperation.EQ);
qf.setValue("2014-09-11T12:35:07Z");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(1, users.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testEmbeddedRelation.
@Test
public void testEmbeddedRelation() {
QueryFilter qf = new QueryFilter();
qf.setField("address.country");
qf.setOperation(FilterOperation.EQ);
qf.setValue("China");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(24, users.size());
Assert.assertNotNull(users.get(0).getAddress());
Assert.assertNotNull(users.get(0).getAddress().getCountry());
Assert.assertEquals("China", users.get(0).getAddress().getCountry());
Assert.assertNotNull(users.get(23).getAddress());
Assert.assertNotNull(users.get(23).getAddress().getCountry());
Assert.assertEquals("China", users.get(23).getAddress().getCountry());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testUuidFilter.
@Test
public void testUuidFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("publicId");
qf.setOperation(FilterOperation.EQ);
qf.setValue("b3781a0e-fb85-45d1-bd5f-d38802a546d2");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(0, projects.size());
}
Aggregations