use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class FetchAndLockRestServiceInteractionTest method setupGroupQueryMock.
private List<String> setupGroupQueryMock(List<Group> groups) {
GroupQuery mockGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(mockGroupQuery);
when(mockGroupQuery.groupMember(anyString())).thenReturn(mockGroupQuery);
when(mockGroupQuery.list()).thenReturn(groups);
List<String> groupIds = new ArrayList<String>();
for (Group groupMock : groups) {
groupIds.add(groupMock.getId());
}
return groupIds;
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class MockProvider method createMockGroupUpdate.
public static Group createMockGroupUpdate() {
Group mockGroup = mock(Group.class);
when(mockGroup.getId()).thenReturn(EXAMPLE_GROUP_ID);
when(mockGroup.getName()).thenReturn(EXAMPLE_GROUP_NAME_UPDATE);
return mockGroup;
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class AbstractAuthenticationFilterTest method setupGroupQueryMock.
protected List<String> setupGroupQueryMock(List<Group> groups) {
GroupQuery mockGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(mockGroupQuery);
when(mockGroupQuery.groupMember(anyString())).thenReturn(mockGroupQuery);
when(mockGroupQuery.list()).thenReturn(groups);
List<String> groupIds = new ArrayList<String>();
for (Group groupMock : groups) {
groupIds.add(groupMock.getId());
}
return groupIds;
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class AbstractAuthenticationFilterTest method setup.
@Before
public void setup() {
authorizationServiceMock = mock(AuthorizationServiceImpl.class);
identityServiceMock = mock(IdentityServiceImpl.class);
repositoryServiceMock = mock(RepositoryService.class);
when(processEngine.getAuthorizationService()).thenReturn(authorizationServiceMock);
when(processEngine.getIdentityService()).thenReturn(identityServiceMock);
when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
// for authentication
userMock = MockProvider.createMockUser();
List<Group> groupMocks = MockProvider.createMockGroups();
groupIds = setupGroupQueryMock(groupMocks);
List<Tenant> tenantMocks = Collections.singletonList(MockProvider.createMockTenant());
tenantIds = setupTenantQueryMock(tenantMocks);
// example method
ProcessDefinition mockDefinition = MockProvider.createMockDefinition();
List<ProcessDefinition> mockDefinitions = Arrays.asList(mockDefinition);
ProcessDefinitionQuery mockQuery = mock(ProcessDefinitionQuery.class);
when(repositoryServiceMock.createProcessDefinitionQuery()).thenReturn(mockQuery);
when(mockQuery.list()).thenReturn(mockDefinitions);
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class LdapGroupQueryTest method testFilterByGroupNameLike.
public void testFilterByGroupNameLike() {
Group group = identityService.createGroupQuery().groupNameLike("manage*").singleResult();
assertNotNull(group);
// validate result
assertEquals("management", group.getId());
assertEquals("management", group.getName());
group = identityService.createGroupQuery().groupNameLike("what*").singleResult();
assertNull(group);
}
Aggregations