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));
}
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));
}
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;
}
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;
}
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"));
}
Aggregations