Пример #1
0
  @Test
  public void testDescribeUserSetChanges() throws Exception {
    String changes = null;

    HttpSession httpSession = getSession();
    UserContext.newContext(getRequest(), m_user, m_customer);

    changes = DiffUtils.describeUserSetChanges(null, null, null);
    assertNull("DiffUtils.describeUserSetChanges(null, null, null) should return null", changes);

    SavedUserSet susOld = new SavedUserSet(m_customer.getCustID());
    SavedUserSet susNew = new SavedUserSet(m_customer.getCustID());

    changes = DiffUtils.describeUserSetChanges(getRequest(), susOld, susNew);
    assertNull("Expected no diffs for 2 identical user sets", changes);

    List<SearchConstraint> constraints;
    constraints = new ArrayList<SearchConstraint>();
    constraints.add(
        new SearchConstraint(
            IUserManager.PROP_USERID,
            SearchConstraintOperator.CONSTRAINT_EQUALS,
            m_user.getUserID()));

    susNew.addUsers(constraints);

    changes = DiffUtils.describeUserSetChanges(getRequest(), susOld, susNew);
    assertNotNull("Expected diffs on 2 different user sets", changes);
  }
Пример #2
0
  @Test
  public void testDescribeReviewerGroupReviewerChanges() throws Exception {
    String changes = null;

    UserContext.newContext(getRequest(), m_user, m_customer);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(null, null, null);
    assertNull(
        "DiffUtils.describeReviewerGroupReviewerChanges(null, null, null) should return null",
        changes);

    List<SearchConstraint> constraints;
    constraints = new ArrayList<SearchConstraint>();
    constraints.add(
        new SearchConstraint(
            IUserManager.PROP_USERID,
            SearchConstraintOperator.CONSTRAINT_EQUALS,
            m_user.getUserID()));

    SavedUserSet reviewers = new SavedUserSet(m_customer.getCustID());
    reviewers.addUsers(constraints);

    ReviewerGroup oldRG =
        new ReviewerGroup(m_customer.getCustID(), 1, "name", reviewers, null, "extra");
    ReviewerGroup newRG =
        new ReviewerGroup(m_customer.getCustID(), 1, "name", reviewers, null, "extra");

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNull("Expected no diffs for 2 identical user sets", changes);

    reviewers = new SavedUserSet(m_customer.getCustID());
    newRG.setReviewers(reviewers);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNotNull("Expected diffs on 2 different reviewer groups", changes);

    SavedUserSet reviewers1 = new SavedUserSet(m_customer.getCustID());
    reviewers1.addConstraintSets(InternalUserSets.getAllUsersSet(m_customer.getCustID()));
    oldRG.setReviewers(reviewers1);

    SavedUserSet reviewers2 = new SavedUserSet(m_customer.getCustID());
    newRG.setReviewers(reviewers2);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNotNull("Expected diffs on 2 different reviewer groups", changes);
  }
Пример #3
0
  @SuppressWarnings("unchecked")
  protected void setupFolderSyncZone() throws Exception {

    int custId = getJspTestUtils().getCustId();
    IFolderSyncManager folderMgr = ManagementContainer.getInstance().getFolderSyncManager();
    IUserManager userService = ManagementContainer.getInstance().getUserManager();

    UserAccount account = userService.getUser(getJspTestUtils().getUserAddress());
    m_userId = account.getUserID();

    // first create the topology and zone itself
    CustomerTopology ct = createTopology();
    Iterator serverIterator = ct.getAllServers();
    if (!serverIterator.hasNext()) {
      fail("No server in topology.");
    }
    CustomerServer server = (CustomerServer) serverIterator.next();
    Iterator storesIterator = ct.getAllStores();
    if (!storesIterator.hasNext()) {
      fail("No stores in server.");
    }
    CustomerStore store = (CustomerStore) storesIterator.next();
    FolderSyncZone zone = new FolderSyncZone();
    zone.setCustomerId(getJspTestUtils().getCustId());
    zone.setDisplayName("foobar");
    zone.setRegistrationKey("12345");
    zone.getServers().add(server);
    folderMgr.saveFolderSyncZone(zone);

    // now enable the user for folder sync
    account.setMessageStoreID(store.getStoreID());
    userService.updateUsers(Arrays.asList(account));
    SavedUserSet userSet = new SavedUserSet(custId);
    List<Integer> userIDs = Arrays.asList(account.getUserID());
    List<SearchConstraint> oldScList = new ArrayList<SearchConstraint>();
    oldScList.add(
        new SearchConstraint(
            UserManagerConstants.PROP_USERID,
            SearchConstraintOperator.CONSTRAINT_IN_LIST,
            userIDs));
    userSet.addUsers(oldScList);
    folderMgr.saveUserSetEnabledForSync(custId, userSet);
  }
Пример #4
0
  @Test
  public void verifyRetentionPolicyFilterForRetentionHolds() throws Exception {
    // Create a new Test User
    LOGGER.info("Creating a new Test user");
    String currentTime = Long.toString(System.currentTimeMillis());
    String userName = "******" + currentTime;
    String userAddress = userName + "@" + getJspTestUtils().getDomain();
    String password = getJspTestUtils().getPasswd();

    getJspTestUtils().createTestUser(userName, userAddress, password);

    int custId = getJspTestUtils().getCustId();
    LOGGER.info("Test user creation completed:" + userAddress);
    LOGGER.info("Customer Id is: " + Integer.toString(custId));

    // Get Retention policy manager, Reviewer group manager and User manager
    IRetentionPolicyManager mgr = ManagementContainer.getInstance().getRetentionPolicyManager();
    IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager();
    IUserManager um = ManagementContainer.getInstance().getUserManager();

    // Create Reviewer User set-1  for reviewers
    UserAccount reviewer1 = um.findUserForEmail(getJspTestUtils().m_userAddress);
    SavedUserSet sus1 = new SavedUserSet(custId);
    sus1.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer1.getUserID()))));
    // sus1.setInternal(true);
    sus1.setName("REVIEWERS-1");
    um.saveUserSet(sus1);
    // Create User set-1 for users whose mails will be reviewed by reviewer
    SavedUserSet scope1 = InternalUserSets.getAllUsersSet(custId);
    // scope1.setInternal(true);
    scope1.setName("SCOPE-1");
    um.saveUserSet(scope1);
    // Create Reviewer group-1
    LOGGER.info("Creating Reviewer group reviewerGrp1");
    ReviewerGroup rg1 = rgm.createReviewerGroup(custId, "reviewerGrp1", sus1, scope1, null);
    rgm.updateReviewerGroup(rg1);
    rg1 = rgm.getReviewerGroup(custId, "reviewerGrp1");
    LOGGER.info(
        "Reviewer group creation done. Reviewer group details-> GroupId:"
            + rg1.getGroupID()
            + ";GroupName:"
            + rg1.getGroupName());

    RetentionPolicy qblh1 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-1",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp1");
    LOGGER.info(
        "Query based legal hold QBLH-1 details-> Policy Id:"
            + qblh1.getId()
            + ";Policy Name:"
            + qblh1.getName());

    // Create Reviewer User set-2 for reviewers
    UserAccount reviewer2 = um.findUserForEmail(userAddress);
    SavedUserSet sus2 = new SavedUserSet(custId);
    sus2.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer2.getUserID()))));
    sus2.setName("REVIEWERS-2");
    um.saveUserSet(sus2);
    // Create User set-2 for users whose mails will be reviewed by reviewer
    SavedUserSet scope2 = InternalUserSets.getAllUsersSet(custId);
    scope2.setName("SCOPE-2");
    um.saveUserSet(scope2);
    // Create Reviewer group-2
    ReviewerGroup rg2 = rgm.createReviewerGroup(custId, "reviewerGrp2", sus2, scope2, null);
    rgm.updateReviewerGroup(rg2);
    rg2 = rgm.getReviewerGroup(custId, "reviewerGrp2");
    LOGGER.info("Reviewer group details:" + rg2.getGroupID() + ";" + rg2.getGroupName());
    RetentionPolicy qblh2 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-2",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp2");
    LOGGER.info(
        "Query based legal hold QBLH-2 details-> Policy Id:"
            + qblh2.getId()
            + ";Policy Name:"
            + qblh2.getName());

    // Login as reviewer-1  and verify QBLH-1 is visible to reviewer-1 and QBLH-2 is not visible
    LOGGER.info("Logging in as reviewer-1");
    getJspTestUtils()
        .login(getJspTestUtils().m_cappLoginUrl, getJspTestUtils().m_userAddress, password);
    getJspTestUtils().navigateToArchivePage();
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-1 is not present for REVIEWERS-1",
        getJspTestUtils().findElement(By.linkText("QBLH-1")));
    assertFalse(
        "Query Based legal hold QBLH-2 is present for REVIEWERS-1",
        getJspTestUtils().isElement(By.linkText("QBLH-2")));
    getJspTestUtils().logout();

    // Login as reviewer-2  and verify QBLH-2 is visible to reviewer-2 and QBLH-1 is not visible
    LOGGER.info("Logging in as reviewer-2");
    getJspTestUtils().login(getJspTestUtils().m_cappLoginUrl, userAddress, password);
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-2 is not present for REVIEWERS-2",
        getJspTestUtils().findElement(By.linkText("QBLH-2")));
    assertFalse(
        "Query Based legal hold QBLH-1 is present for REVIEWERS-2",
        getJspTestUtils().isElement(By.linkText("QBLH-1")));
    getJspTestUtils().logout();
  }