use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class GroupQueryTest method testQueryByMemberOfTenant.
public void testQueryByMemberOfTenant() {
GroupQuery query = identityService.createGroupQuery().memberOfTenant("nonExisting");
verifyQueryResults(query, 0);
query = identityService.createGroupQuery().memberOfTenant("tenant");
verifyQueryResults(query, 1);
Group group = query.singleResult();
assertEquals("frogs", group.getId());
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class GroupQueryTest method testQueryByName.
public void testQueryByName() {
GroupQuery query = identityService.createGroupQuery().groupName("Muppet show characters_");
verifyQueryResults(query, 1);
query = identityService.createGroupQuery().groupName("Famous frogs");
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class GroupQueryTest method testQueryById.
public void testQueryById() {
GroupQuery query = identityService.createGroupQuery().groupId("muppets");
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
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.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class IdentityServiceTenantTest method deleteTenantMembershipsOfTenant.
@Test
public void deleteTenantMembershipsOfTenant() {
Tenant tenant = identityService.newTenant(TENANT_ONE);
identityService.saveTenant(tenant);
User user = identityService.newUser(USER_ONE);
identityService.saveUser(user);
Group group = identityService.newGroup(GROUP_ONE);
identityService.saveGroup(group);
identityService.createTenantUserMembership(TENANT_ONE, USER_ONE);
identityService.createTenantGroupMembership(TENANT_ONE, GROUP_ONE);
UserQuery userQuery = identityService.createUserQuery().memberOfTenant(TENANT_ONE);
GroupQuery groupQuery = identityService.createGroupQuery().memberOfTenant(TENANT_ONE);
assertThat(userQuery.count(), is(1L));
assertThat(groupQuery.count(), is(1L));
identityService.deleteTenant(TENANT_ONE);
assertThat(userQuery.count(), is(0L));
assertThat(groupQuery.count(), is(0L));
}
Aggregations