Search in sources :

Example 1 with Project

use of com.github.tfaga.lynx.test.entities.Project in project lynx by TFaga.

the class JPAUtilsFiltersTest method testEnumInFilter.

@Test
public void testEnumInFilter() {
    QueryFilter qf = new QueryFilter();
    qf.setField("status");
    qf.setOperation(FilterOperation.IN);
    qf.getValues().add("ACTIVE");
    QueryParameters q = new QueryParameters();
    q.getFilters().add(qf);
    List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
    Assert.assertNotNull(projects);
    Assert.assertEquals(50, projects.size());
}
Also used : Project(com.github.tfaga.lynx.test.entities.Project) QueryFilter(com.github.tfaga.lynx.beans.QueryFilter) QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 2 with Project

use of com.github.tfaga.lynx.test.entities.Project in project lynx by TFaga.

the class JPAUtilsFiltersTest method testEnumNinFilter.

@Test
public void testEnumNinFilter() {
    QueryFilter qf = new QueryFilter();
    qf.setField("status");
    qf.setOperation(FilterOperation.NIN);
    qf.getValues().add("ACTIVE");
    qf.getValues().add("INACTIVE");
    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());
}
Also used : Project(com.github.tfaga.lynx.test.entities.Project) QueryFilter(com.github.tfaga.lynx.beans.QueryFilter) QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 3 with Project

use of com.github.tfaga.lynx.test.entities.Project in project lynx by TFaga.

the class JPAUtilsFiltersTest method testUuidNinFilter.

@Test
public void testUuidNinFilter() {
    QueryFilter qf = new QueryFilter();
    qf.setField("publicId");
    qf.setOperation(FilterOperation.NIN);
    qf.getValues().add("b3781a0e-fb85-45d1-bd5f-d38802a546d2");
    qf.getValues().add("6a749969-9990-4ef0-856a-7e2533b6dc9e");
    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());
}
Also used : Project(com.github.tfaga.lynx.test.entities.Project) QueryFilter(com.github.tfaga.lynx.beans.QueryFilter) QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 4 with Project

use of com.github.tfaga.lynx.test.entities.Project in project lynx by TFaga.

the class JPAUtilsFiltersTest method testEnumFilter.

@Test
public void testEnumFilter() {
    QueryFilter qf = new QueryFilter();
    qf.setField("status");
    qf.setOperation(FilterOperation.EQ);
    qf.setValue("ACTIVE");
    QueryParameters q = new QueryParameters();
    q.getFilters().add(qf);
    List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
    Assert.assertNotNull(projects);
    Assert.assertEquals(50, projects.size());
}
Also used : Project(com.github.tfaga.lynx.test.entities.Project) QueryFilter(com.github.tfaga.lynx.beans.QueryFilter) QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 5 with Project

use of com.github.tfaga.lynx.test.entities.Project in project lynx by TFaga.

the class JPAUtilsFiltersTest method testUuidInFilter.

@Test
public void testUuidInFilter() {
    QueryFilter qf = new QueryFilter();
    qf.setField("publicId");
    qf.setOperation(FilterOperation.IN);
    qf.getValues().add("b3781a0e-fb85-45d1-bd5f-d38802a546d2");
    qf.getValues().add("6a749969-9990-4ef0-856a-7e2533b6dc9e");
    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());
}
Also used : Project(com.github.tfaga.lynx.test.entities.Project) QueryFilter(com.github.tfaga.lynx.beans.QueryFilter) QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Aggregations

QueryFilter (com.github.tfaga.lynx.beans.QueryFilter)6 QueryParameters (com.github.tfaga.lynx.beans.QueryParameters)6 Project (com.github.tfaga.lynx.test.entities.Project)6 Test (org.junit.Test)6