use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.
the class UserQueryTest method testQueryByFirstName.
public void testQueryByFirstName() {
UserQuery query = identityService.createUserQuery().userFirstName("Gonzo");
verifyQueryResults(query, 1);
User result = query.singleResult();
assertEquals("gonzo", result.getId());
}
use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.
the class UserQueryTest method testQueryByMemberOfTenant.
public void testQueryByMemberOfTenant() {
UserQuery query = identityService.createUserQuery().memberOfTenant("nonExisting");
verifyQueryResults(query, 0);
query = identityService.createUserQuery().memberOfTenant("tenant");
verifyQueryResults(query, 1);
User result = query.singleResult();
assertEquals("kermit", result.getId());
}
use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.
the class UserQueryTest method testQueryByNoCriteria.
public void testQueryByNoCriteria() {
UserQuery query = identityService.createUserQuery();
verifyQueryResults(query, 3);
}
use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.
the class IdentityServiceTenantTest method deleteTenantMembershipsOfTenant.
@Test
public void deleteTenantMembershipsOfTenant() {
Tenant tenant = identityService.newTenant(TENANT_ONE);
identityService.saveTenant(tenant);
User user = identityService.newUser(USER_ONE);
identityService.saveUser(user);
Group group = identityService.newGroup(GROUP_ONE);
identityService.saveGroup(group);
identityService.createTenantUserMembership(TENANT_ONE, USER_ONE);
identityService.createTenantGroupMembership(TENANT_ONE, GROUP_ONE);
UserQuery userQuery = identityService.createUserQuery().memberOfTenant(TENANT_ONE);
GroupQuery groupQuery = identityService.createGroupQuery().memberOfTenant(TENANT_ONE);
assertThat(userQuery.count(), is(1L));
assertThat(groupQuery.count(), is(1L));
identityService.deleteTenant(TENANT_ONE);
assertThat(userQuery.count(), is(0L));
assertThat(groupQuery.count(), is(0L));
}
use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testUserResourceOptionsUnauthenticated.
@Test
public void testUserResourceOptionsUnauthenticated() {
String fullUserUrl = "http://localhost:" + PORT + TEST_RESOURCE_ROOT_PATH + "/user/" + MockProvider.EXAMPLE_USER_ID;
User sampleUser = MockProvider.createMockUser();
UserQuery sampleUserQuery = mock(UserQuery.class);
when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
when(sampleUserQuery.singleResult()).thenReturn(sampleUser);
when(identityServiceMock.getCurrentAuthentication()).thenReturn(null);
when(processEngineConfigurationMock.isAuthorizationEnabled()).thenReturn(true);
given().pathParam("id", MockProvider.EXAMPLE_USER_ID).then().statusCode(Status.OK.getStatusCode()).body("links[0].href", equalTo(fullUserUrl + "/profile")).body("links[0].method", equalTo(HttpMethod.GET)).body("links[0].rel", equalTo("self")).body("links[1].href", equalTo(fullUserUrl)).body("links[1].method", equalTo(HttpMethod.DELETE)).body("links[1].rel", equalTo("delete")).body("links[2].href", equalTo(fullUserUrl + "/profile")).body("links[2].method", equalTo(HttpMethod.PUT)).body("links[2].rel", equalTo("update")).when().options(USER_URL);
verify(identityServiceMock, times(2)).getCurrentAuthentication();
}
Aggregations