コード例 #1
0
  public void testSetFlags() throws Exception {
    NavigableMap<Long, FileInfo> fis =
        imapService.getFolderStatus(
                authenticationService.getCurrentUserName(),
                testImapFolderNodeRef,
                ImapViewMode.ARCHIVE)
            .search;
    if (fis != null && fis.size() > 0) {
      FileInfo messageFileInfo = fis.firstEntry().getValue();
      try {
        setFlags(messageFileInfo);
        fail("Can't set flags");
      } catch (Exception e) {
        if (e instanceof AccessDeniedException) {
          // expected
        } else {
          throw e;
        }
      }

      reauthenticate(USER_NAME, USER_PASSWORD);

      permissionService.setPermission(
          testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);

      reauthenticate(anotherUserName, anotherUserName);

      setFlags(messageFileInfo);
    }
  }
コード例 #2
0
  protected void runAs(String userName) {
    authenticationService.authenticate(userName, userName.toCharArray());
    assertNotNull(authenticationService.getCurrentUserName());
    // for(GrantedAuthority authority : woof.getAuthorities())
    // {
    // System.out.println("Auth = "+authority.getAuthority());
    // }

  }
コード例 #3
0
  public void testGetFlags() throws Exception {
    NavigableMap<Long, FileInfo> fis =
        imapService.getFolderStatus(
                authenticationService.getCurrentUserName(),
                testImapFolderNodeRef,
                ImapViewMode.ARCHIVE)
            .search;
    if (fis != null && fis.size() > 0) {
      FileInfo messageFileInfo = fis.firstEntry().getValue();

      reauthenticate(USER_NAME, USER_PASSWORD);

      permissionService.setPermission(
          testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);

      imapService.setFlags(messageFileInfo, flags, true);

      reauthenticate(anotherUserName, anotherUserName);

      Flags fl = imapService.getFlags(messageFileInfo);
      assertTrue(fl.contains(flags));
    }
  }
コード例 #4
0
  public void testSetFlag() throws Exception {
    NavigableMap<Long, FileInfo> fis =
        imapService.getFolderStatus(
                authenticationService.getCurrentUserName(),
                testImapFolderNodeRef,
                ImapViewMode.ARCHIVE)
            .search;
    if (fis != null && fis.size() > 0) {
      FileInfo messageFileInfo = fis.firstEntry().getValue();

      reauthenticate(USER_NAME, USER_PASSWORD);

      permissionService.setPermission(
          testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);

      reauthenticate(anotherUserName, anotherUserName);

      imapService.setFlag(messageFileInfo, Flags.Flag.RECENT, true);

      Serializable prop =
          nodeService.getProperty(messageFileInfo.getNodeRef(), ImapModel.PROP_FLAG_RECENT);
      assertNotNull("Can't set RECENT flag", prop);
    }
  }