use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class MockGroupBuilder method build.
@SuppressWarnings("unchecked")
public Group build() {
Group group = mock(Group.class);
when(group.getId()).thenReturn(id);
when(group.getName()).thenReturn(name);
when(group.getType()).thenReturn(type);
return group;
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class AuthenticationFilterPathMatchingTest method setup.
@Before
public void setup() throws ServletException {
currentEngine = getProcessEngine(engineName);
authorizationServiceMock = mock(AuthorizationServiceImpl.class);
identityServiceMock = mock(IdentityServiceImpl.class);
repositoryServiceMock = mock(RepositoryService.class);
when(currentEngine.getAuthorizationService()).thenReturn(authorizationServiceMock);
when(currentEngine.getIdentityService()).thenReturn(identityServiceMock);
// for authentication
userMock = MockProvider.createMockUser();
List<Group> groupMocks = MockProvider.createMockGroups();
groupIds = setupGroupQueryMock(groupMocks);
List<Tenant> tenantMocks = Collections.singletonList(MockProvider.createMockTenant());
tenantIds = setupTenantQueryMock(tenantMocks);
GroupQuery mockGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(mockGroupQuery);
when(mockGroupQuery.groupMember(anyString())).thenReturn(mockGroupQuery);
when(mockGroupQuery.list()).thenReturn(groupMocks);
setupFilter();
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class AuthenticationFilterPathMatchingTest 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 LdapGroupQueryTest method testFilterByGroupId.
public void testFilterByGroupId() {
Group group = identityService.createGroupQuery().groupId("management").singleResult();
assertNotNull(group);
// validate result
assertEquals("management", group.getId());
assertEquals("management", group.getName());
group = identityService.createGroupQuery().groupId("whatever").singleResult();
assertNull(group);
}
use of org.camunda.bpm.engine.identity.Group in project camunda-bpm-platform by camunda.
the class LdapGroupQueryTest method testFilterByGroupName.
public void testFilterByGroupName() {
Group group = identityService.createGroupQuery().groupName("management").singleResult();
assertNotNull(group);
// validate result
assertEquals("management", group.getId());
assertEquals("management", group.getName());
group = identityService.createGroupQuery().groupName("whatever").singleResult();
assertNull(group);
}
Aggregations