use of org.activiti.engine.identity.GroupQuery in project Activiti by Activiti.
the class GroupQueryEscapeClauseTest method testQueryByNameLike.
public void testQueryByNameLike() {
GroupQuery query = identityService.createGroupQuery().groupNameLike("%\\%%");
assertEquals(1, query.list().size());
assertEquals(1, query.count());
assertEquals("muppets", query.singleResult().getId());
query = identityService.createGroupQuery().groupNameLike("%\\_%");
assertEquals(1, query.list().size());
assertEquals(1, query.count());
assertEquals("frogs", query.singleResult().getId());
}
use of org.activiti.engine.identity.GroupQuery in project Activiti by Activiti.
the class GroupQueryTest method testQuerySorting.
public void testQuerySorting() {
// asc
assertEquals(4, identityService.createGroupQuery().orderByGroupId().asc().count());
assertEquals(4, identityService.createGroupQuery().orderByGroupName().asc().count());
assertEquals(4, identityService.createGroupQuery().orderByGroupType().asc().count());
// desc
assertEquals(4, identityService.createGroupQuery().orderByGroupId().desc().count());
assertEquals(4, identityService.createGroupQuery().orderByGroupName().desc().count());
assertEquals(4, identityService.createGroupQuery().orderByGroupType().desc().count());
// Multiple sortings
GroupQuery query = identityService.createGroupQuery().orderByGroupType().asc().orderByGroupName().desc();
List<Group> groups = query.list();
assertEquals(4, query.count());
assertEquals("security", groups.get(0).getType());
assertEquals("user", groups.get(1).getType());
assertEquals("user", groups.get(2).getType());
assertEquals("user", groups.get(3).getType());
assertEquals("admin", groups.get(0).getId());
assertEquals("muppets", groups.get(1).getId());
assertEquals("mammals", groups.get(2).getId());
assertEquals("frogs", groups.get(3).getId());
}
use of org.activiti.engine.identity.GroupQuery in project Activiti by Activiti.
the class GroupQueryTest method testQueryByType.
public void testQueryByType() {
GroupQuery query = identityService.createGroupQuery().groupType("user");
verifyQueryResults(query, 3);
query = identityService.createGroupQuery().groupType("admin");
verifyQueryResults(query, 0);
}
use of org.activiti.engine.identity.GroupQuery in project Activiti by Activiti.
the class GroupQueryTest method testQueryByInvalidNameLike.
public void testQueryByInvalidNameLike() {
GroupQuery query = identityService.createGroupQuery().groupNameLike("%invalid%");
verifyQueryResults(query, 0);
try {
identityService.createGroupQuery().groupNameLike(null).list();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.identity.GroupQuery in project Activiti by Activiti.
the class GroupQueryTest method testQueryById.
public void testQueryById() {
GroupQuery query = identityService.createGroupQuery().groupId("muppets");
verifyQueryResults(query, 1);
}
Aggregations