Search in sources :

Example 16 with TenantQuery

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

the class TenantQueryTest method queryByNonExistingId.

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

Example 17 with TenantQuery

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

the class TenantQueryTest method queryByIdIn.

@Test
public void queryByIdIn() {
    TenantQuery query = identityService.createTenantQuery();
    assertThat(query.tenantIdIn("non", "existing").count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(2L));
}
Also used : TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 18 with TenantQuery

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

the class TenantQueryTest method queryByUser.

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

Example 19 with TenantQuery

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

the class IdentityServiceTenantTest method deleteTenantGroupMembership.

@Test
public void deleteTenantGroupMembership() {
    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.deleteTenantGroupMembership("nonExisting", GROUP_ONE);
    assertThat(query.count(), is(1L));
    identityService.deleteTenantGroupMembership(TENANT_ONE, "nonExisting");
    assertThat(query.count(), is(1L));
    identityService.deleteTenantGroupMembership(TENANT_ONE, 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 20 with TenantQuery

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

the class IdentityServiceTenantTest method deleteTenantUserMembership.

@Test
public void deleteTenantUserMembership() {
    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.deleteTenantUserMembership("nonExisting", USER_ONE);
    assertThat(query.count(), is(1L));
    identityService.deleteTenantUserMembership(TENANT_ONE, "nonExisting");
    assertThat(query.count(), is(1L));
    identityService.deleteTenantUserMembership(TENANT_ONE, 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)

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