当前位置: 首页>>代码示例>>Java>>正文


Java Group类代码示例

本文整理汇总了Java中org.camunda.bpm.engine.identity.Group的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Group类属于org.camunda.bpm.engine.identity包,在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGroupPaging

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
public static void testGroupPaging(IdentityService identityService) {
  Set<String> groupNames = new HashSet<String>();
  List<Group> groups = identityService.createGroupQuery().listPage(0, 2);
  assertEquals(2, groups.size());
  checkPagingResults(groupNames, groups.get(0).getId(), groups.get(1).getId());

  groups = identityService.createGroupQuery().listPage(2, 2);
  assertEquals(2, groups.size());
  checkPagingResults(groupNames, groups.get(0).getId(), groups.get(1).getId());

  groups = identityService.createGroupQuery().listPage(4, 2);
  assertEquals(2, groups.size());
  assertFalse(groupNames.contains(groups.get(0).getId()));
  groupNames.add(groups.get(0).getId());

  groups = identityService.createGroupQuery().listPage(6, 2);
  assertEquals(0, groups.size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:LdapTestUtilities.java

示例2: createIdentityMocks

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
private void createIdentityMocks() {
  // identity
  UserQuery sampleUserQuery = mock(UserQuery.class);
  GroupQuery sampleGroupQuery = mock(GroupQuery.class);
  List<User> mockUsers = new ArrayList<User>();
  User mockUser = MockProvider.createMockUser();
  mockUsers.add(mockUser);

  // user query
  when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
  when(sampleUserQuery.list()).thenReturn(mockUsers);

  // group query
  List<Group> mockGroups = MockProvider.createMockGroups();
  when(sampleGroupQuery.groupMember(anyString())).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.orderByGroupName()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.asc()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.list()).thenReturn(mockGroups);

  when(mockIdentityService.createGroupQuery()).thenReturn(sampleGroupQuery);
  when(mockIdentityService.createUserQuery()).thenReturn(sampleUserQuery);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:ProcessEngineRestServiceTest.java

示例3: createMockIdentityQueries

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
private void createMockIdentityQueries() {
  UserQuery sampleUserQuery = mock(UserQuery.class);

  List<User> mockUsers = new ArrayList<User>();

  mockUser = MockProvider.createMockUser();
  mockUsers.add(mockUser);

  when(sampleUserQuery.list()).thenReturn(mockUsers);
  when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
  when(sampleUserQuery.count()).thenReturn((long) mockUsers.size());

  GroupQuery sampleGroupQuery = mock(GroupQuery.class);

  List<Group> mockGroups = MockProvider.createMockGroups();
  when(sampleGroupQuery.list()).thenReturn(mockGroups);
  when(sampleGroupQuery.groupMember(anyString())).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.orderByGroupName()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.orderByGroupId()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.orderByGroupType()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.asc()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.desc()).thenReturn(sampleGroupQuery);

  when(processEngine.getIdentityService().createGroupQuery()).thenReturn(sampleGroupQuery);
  when(processEngine.getIdentityService().createUserQuery()).thenReturn(sampleUserQuery);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:IdentityRestServiceQueryTest.java

示例4: tearDown

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@After
public void tearDown() {
  Mocks.reset();

  for (Group group : identityService.createGroupQuery().list()) {
    identityService.deleteGroup(group.getId());
  }
  for (User user : identityService.createUserQuery().list()) {
    identityService.deleteUser(user.getId());
  }
  for (Task task : taskService.createTaskQuery().list()) {
    if (task.getProcessInstanceId() == null) {
      taskService.deleteTask(task.getId(), true);
    }
  }

  identityService.clearAuthentication();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:TaskQueryExpressionTest.java

示例5: checkPassword

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Override
public boolean checkPassword(final String userId, final String password) {

  // Create and Save a User
  final User user = super.createNewUser(userId);
  user.setPassword(password);
  super.saveUser(user);

  // Create and Save a Group
  final String groupId = userId+"_group";
  final Group group = super.createNewGroup(groupId);
  group.setName(groupId);
  super.saveGroup(group);

  // Create the corresponding Membership
  super.createMembership(userId, groupId);

  return super.checkPassword(userId, password);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:TestDbIdentityServiceProviderExtension.java

示例6: testQueryByMember

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
public void testQueryByMember() {
  GroupQuery query = identityService.createGroupQuery().groupMember("fozzie");
  verifyQueryResults(query, 2);

  query = identityService.createGroupQuery().groupMember("kermit");
  verifyQueryResults(query, 3);

  query = query.orderByGroupId().asc();
  List<Group> groups = query.list();
  assertEquals(3, groups.size());
  assertEquals("admin", groups.get(0).getId());
  assertEquals("frogs", groups.get(1).getId());
  assertEquals("muppets", groups.get(2).getId());

  query = query.groupType("user");
  groups = query.list();
  assertEquals(2, groups.size());
  assertEquals("frogs", groups.get(0).getId());
  assertEquals("muppets", groups.get(1).getId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:GroupQueryTest.java

示例7: testUpdateExistingGroup

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void testUpdateExistingGroup() {
  Group initialGroup = MockProvider.createMockGroup();
  Group groupUpdate = MockProvider.createMockGroupUpdate();
  GroupQuery sampleGroupQuery = mock(GroupQuery.class);
  when(identityServiceMock.createGroupQuery()).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.groupId(MockProvider.EXAMPLE_GROUP_ID)).thenReturn(sampleGroupQuery);
  when(sampleGroupQuery.singleResult()).thenReturn(initialGroup);

  given().pathParam("id", MockProvider.EXAMPLE_GROUP_ID)
    .body(GroupDto.fromGroup(groupUpdate)).contentType(ContentType.JSON)
    .then().expect().statusCode(Status.NO_CONTENT.getStatusCode())
    .when().put(GROUP_URL);

  // initial group was updated
  verify(initialGroup).setName(groupUpdate.getName());

  // and then saved
  verify(identityServiceMock).saveGroup(initialGroup);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:GroupRestServiceInteractionTest.java

示例8: testDeleteMembership

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void testDeleteMembership() {
  Group sales = identityService.newGroup("sales");
  identityService.saveGroup(sales);

  User johndoe = identityService.newUser("johndoe");
  identityService.saveUser(johndoe);
  // Add membership
  identityService.createMembership(johndoe.getId(), sales.getId());

  List<Group> groups = identityService.createGroupQuery().groupMember(johndoe.getId()).list();
  assertTrue(groups.size() == 1);
  assertEquals("sales", groups.get(0).getId());

  // Delete the membership and check members of sales group
  identityService.deleteMembership(johndoe.getId(), sales.getId());
  groups = identityService.createGroupQuery().groupMember(johndoe.getId()).list();
  assertTrue(groups.size() == 0);

  identityService.deleteGroup("sales");
  identityService.deleteUser("johndoe");
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:IdentityServiceTest.java

示例9: testGroupOptimisticLockingException

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void testGroupOptimisticLockingException() {
  Group group = identityService.newGroup("group");
  identityService.saveGroup(group);

  Group group1 = identityService.createGroupQuery().singleResult();
  Group group2 = identityService.createGroupQuery().singleResult();

  group1.setName("name one");
  identityService.saveGroup(group1);

  thrown.expect(OptimisticLockingException.class);

  group2.setName("name two");
  identityService.saveGroup(group2);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:IdentityServiceTest.java

示例10: testWriteMultipleEntitiesInOneTransaction

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
public void testWriteMultipleEntitiesInOneTransaction(){

    // the identity service provider registered with the engine creates a user, a group, and a membership
    // in the following call:
    Assert.assertTrue(identityService.checkPassword("multipleEntities", "inOneStep"));
    User user = identityService.createUserQuery().userId("multipleEntities").singleResult();

    Assert.assertNotNull(user);
    Assert.assertEquals("multipleEntities", user.getId());
    Assert.assertEquals("{SHA}pfdzmt+49nwknTy7xhZd7ZW5suI=", user.getPassword());

    // It is expected, that the User is in exactly one Group
    List<Group> groups = this.identityService.createGroupQuery().groupMember("multipleEntities").list();
    Assert.assertEquals(1, groups.size());

    Group group = groups.get(0);
    Assert.assertEquals("multipleEntities_group", group.getId());

    // clean the Db
    identityService.deleteMembership("multipleEntities", "multipleEntities_group");
    identityService.deleteGroup("multipleEntities_group");
    identityService.deleteUser("multipleEntities");
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:WriteMultipleEntitiesInOneTransactionTest.java

示例11: testGroupCreateThrowsAuthorizationException

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void testGroupCreateThrowsAuthorizationException() {
  Group newGroup = MockProvider.createMockGroup();
  String message = "exception expected";
  when(identityServiceMock.newGroup(newGroup.getId())).thenThrow(new AuthorizationException(message));

  given()
    .body(GroupDto.fromGroup(newGroup))
    .contentType(ContentType.JSON)
  .then().expect()
    .statusCode(Status.FORBIDDEN.getStatusCode())
    .contentType(ContentType.JSON)
    .body("type", equalTo(AuthorizationException.class.getSimpleName()))
    .body("message", equalTo(message))
  .when()
    .post(GROUP_CREATE_URL);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:GroupRestServiceInteractionTest.java

示例12: testSaveGroupThrowsAuthorizationException

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void testSaveGroupThrowsAuthorizationException() {
  Group newGroup = MockProvider.createMockGroup();

  String message = "exception expected";
  when(identityServiceMock.newGroup(newGroup.getId())).thenReturn(newGroup);
  doThrow(new AuthorizationException(message)).when(identityServiceMock).saveGroup(newGroup);

  given()
    .body(GroupDto.fromGroup(newGroup))
    .contentType(ContentType.JSON)
  .then().expect()
    .statusCode(Status.FORBIDDEN.getStatusCode())
    .contentType(ContentType.JSON)
    .body("type", equalTo(AuthorizationException.class.getSimpleName()))
    .body("message", equalTo(message))
  .when()
    .post(GROUP_CREATE_URL);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:GroupRestServiceInteractionTest.java

示例13: deleteTenantGroupMembership

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@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));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:IdentityServiceTenantTest.java

示例14: deleteTenantMembershipsWhileDeleteGroup

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@Test
public void deleteTenantMembershipsWhileDeleteGroup() {
  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.deleteGroup(GROUP_ONE);
  assertThat(query.count(), is(0L));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:IdentityServiceTenantTest.java

示例15: deleteTenantMembershipsOfTenant

import org.camunda.bpm.engine.identity.Group; //导入依赖的package包/类
@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));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:IdentityServiceTenantTest.java


注:本文中的org.camunda.bpm.engine.identity.Group类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。