use of org.camunda.bpm.engine.identity.Tenant 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.Tenant in project camunda-bpm-platform by camunda.
the class TenantResourceImpl method getTenant.
public TenantDto getTenant(UriInfo context) {
Tenant tenant = findTenantObject();
if (tenant == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Tenant with id " + resourceId + " does not exist");
}
TenantDto dto = TenantDto.fromTenant(tenant);
return dto;
}
use of org.camunda.bpm.engine.identity.Tenant 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"));
}
use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.
the class IdentityServiceTenantTest method updateTenant.
@Test
public void updateTenant() {
// create
Tenant tenant = identityService.newTenant(TENANT_ONE);
tenant.setName("Tenant");
identityService.saveTenant(tenant);
// update
tenant = identityService.createTenantQuery().singleResult();
assertThat(tenant, is(notNullValue()));
tenant.setName("newName");
identityService.saveTenant(tenant);
tenant = identityService.createTenantQuery().singleResult();
assertEquals("newName", tenant.getName());
}
use of org.camunda.bpm.engine.identity.Tenant 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));
}
Aggregations