コード例 #1
0
  @Test(expected = MembershipPolicyException.class)
  public void testAssignUsersToForbiddenGroup() throws Exception {
    long[] forbiddenGroupIds = addForbiddenGroups();

    UserServiceUtil.addGroupUsers(
        forbiddenGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext());
  }
コード例 #2
0
  @Test
  public void testPropagateWhenAssigningUsersToRequiredGroup() throws Exception {

    long[] requiredGroupIds = addRequiredGroups();

    UserServiceUtil.addGroupUsers(
        requiredGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext());

    Assert.assertTrue(isPropagateMembership());
  }
コード例 #3
0
  @Test
  public void testAssignUsersToRequiredGroup() throws Exception {
    long[] requiredGroupIds = addRequiredGroups();

    int initialGroupUsersCount = UserLocalServiceUtil.getGroupUsersCount(requiredGroupIds[0]);

    UserServiceUtil.addGroupUsers(
        requiredGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext());

    Assert.assertEquals(
        initialGroupUsersCount + 2, UserLocalServiceUtil.getGroupUsersCount(requiredGroupIds[0]));
    Assert.assertTrue(isPropagateMembership());
  }