Search in sources :

Example 11 with TenantQuery

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

the class TenantQueryTest method queryByName.

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

Example 12 with TenantQuery

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

the class TenantQueryTest method queryByNameLike.

@Test
public void queryByNameLike() {
    TenantQuery query = identityService.createTenantQuery();
    assertThat(query.tenantNameLike("%nonExisting%").count(), is(0L));
    assertThat(query.tenantNameLike("%Tenant\\_1%").count(), is(1L));
    assertThat(query.tenantNameLike("%Tenant%").count(), is(2L));
}
Also used : TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 13 with TenantQuery

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

the class TenantRestServiceQueryTest method setUpMockQuery.

private TenantQuery setUpMockQuery(List<Tenant> tenants) {
    TenantQuery query = mock(TenantQuery.class);
    when(query.list()).thenReturn(tenants);
    when(query.count()).thenReturn((long) tenants.size());
    when(processEngine.getIdentityService().createTenantQuery()).thenReturn(query);
    return query;
}
Also used : TenantQuery(org.camunda.bpm.engine.identity.TenantQuery)

Example 14 with TenantQuery

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

the class AuthenticationFilterPathMatchingTest method setupTenantQueryMock.

protected List<String> setupTenantQueryMock(List<Tenant> tenants) {
    TenantQuery mockTenantQuery = mock(TenantQuery.class);
    when(identityServiceMock.createTenantQuery()).thenReturn(mockTenantQuery);
    when(mockTenantQuery.userMember(anyString())).thenReturn(mockTenantQuery);
    when(mockTenantQuery.includingGroupsOfUser(anyBoolean())).thenReturn(mockTenantQuery);
    when(mockTenantQuery.list()).thenReturn(tenants);
    List<String> tenantIds = new ArrayList<String>();
    for (Tenant tenant : tenants) {
        tenantIds.add(tenant.getId());
    }
    return tenantIds;
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString)

Example 15 with TenantQuery

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

the class TenantQueryTest method queryById.

@Test
public void queryById() {
    TenantQuery query = identityService.createTenantQuery().tenantId(TENANT_ONE);
    assertThat(query.count(), is(1L));
    assertThat(query.list().size(), is(1));
    Tenant tenant = query.singleResult();
    assertThat(tenant, is(notNullValue()));
    assertThat(tenant.getName(), is("Tenant_1"));
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) 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