Search in sources :

Example 6 with TenantQuery

use of org.camunda.bpm.engine.identity.TenantQuery in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method deleteTenantMembershipsWileDeleteUser.

@Test
public void deleteTenantMembershipsWileDeleteUser() {
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    User user = identityService.newUser(USER_ONE);
    identityService.saveUser(user);
    identityService.createTenantUserMembership(TENANT_ONE, USER_ONE);
    TenantQuery query = identityService.createTenantQuery().userMember(USER_ONE);
    assertThat(query.count(), is(1L));
    identityService.deleteUser(USER_ONE);
    assertThat(query.count(), is(0L));
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) User(org.camunda.bpm.engine.identity.User) TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 7 with TenantQuery

use of org.camunda.bpm.engine.identity.TenantQuery in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method deleteTenantMembershipsWhileDeleteGroup.

@Test
public void deleteTenantMembershipsWhileDeleteGroup() {
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    Group group = identityService.newGroup(GROUP_ONE);
    identityService.saveGroup(group);
    identityService.createTenantGroupMembership(TENANT_ONE, GROUP_ONE);
    TenantQuery query = identityService.createTenantQuery().groupMember(GROUP_ONE);
    assertThat(query.count(), is(1L));
    identityService.deleteGroup(GROUP_ONE);
    assertThat(query.count(), is(0L));
}
Also used : Group(org.camunda.bpm.engine.identity.Group) Tenant(org.camunda.bpm.engine.identity.Tenant) TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 8 with TenantQuery

use of org.camunda.bpm.engine.identity.TenantQuery in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method deleteTenant.

@Test
public void deleteTenant() {
    // create
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    TenantQuery query = identityService.createTenantQuery();
    assertThat(query.count(), is(1L));
    identityService.deleteTenant("nonExisting");
    assertThat(query.count(), is(1L));
    identityService.deleteTenant(TENANT_ONE);
    assertThat(query.count(), is(0L));
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 9 with TenantQuery

use of org.camunda.bpm.engine.identity.TenantQuery in project camunda-bpm-platform by camunda.

the class TenantQueryTest method queryByUserIncludingGroups.

@Test
public void queryByUserIncludingGroups() {
    TenantQuery query = identityService.createTenantQuery().userMember(USER);
    assertThat(query.includingGroupsOfUser(false).count(), is(1L));
    assertThat(query.includingGroupsOfUser(true).count(), is(2L));
}
Also used : TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 10 with TenantQuery

use of org.camunda.bpm.engine.identity.TenantQuery in project camunda-bpm-platform by camunda.

the class TenantQueryTest method queryByGroup.

@Test
public void queryByGroup() {
    TenantQuery query = identityService.createTenantQuery();
    assertThat(query.groupMember("nonExisting").count(), is(0L));
    assertThat(query.groupMember(GROUP).count(), is(1L));
    assertThat(query.groupMember(GROUP).tenantId(TENANT_TWO).count(), is(1L));
}
Also used : TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Aggregations

TenantQuery (org.camunda.bpm.engine.identity.TenantQuery)20 Test (org.junit.Test)13 Tenant (org.camunda.bpm.engine.identity.Tenant)10 ArrayList (java.util.ArrayList)3 Matchers.anyString (org.mockito.Matchers.anyString)3 Group (org.camunda.bpm.engine.identity.Group)2 User (org.camunda.bpm.engine.identity.User)2 TenantQueryDto (org.camunda.bpm.engine.rest.dto.identity.TenantQueryDto)2 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1