Example #1
0
  /**
   * Quick Command: Item Type: Mail Action 1: Tag Action 2: Mark Read Action 3: Mark Flagged Action
   * 4: Move To Subfolder
   *
   * @throws HarnessException
   */
  protected QuickCommand getQuickCommand01() throws HarnessException {

    if (command1 != null) {
      // Command already exists, just return it
      return (command1);
    }

    // Create a tag
    String tagname = "tag" + ZimbraSeleniumProperties.getUniqueString();
    ZimbraAccount.AccountZWC()
        .soapSend(
            "<CreateTagRequest xmlns='urn:zimbraMail'>"
                + "<tag name='"
                + tagname
                + "' color='1' />"
                + "</CreateTagRequest>");

    TagItem tag = TagItem.importFromSOAP(ZimbraAccount.AccountZWC(), tagname);
    ZAssert.assertNotNull(tag, "Verify the tag was created");

    // Create a subfolder
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    ZimbraAccount.AccountZWC()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='1' view='message'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountZWC(), foldername);
    ZAssert.assertNotNull(folder, "Verify the subfolder is available");

    // Create the list of actions
    ArrayList<QuickCommandAction> actions = new ArrayList<QuickCommandAction>();
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionTag, tag.getId(), true));
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "read", true));
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "flagged", true));
    actions.add(
        new QuickCommandAction(QuickCommandAction.TypeId.actionFileInto, folder.getId(), true));

    String name = "name" + ZimbraSeleniumProperties.getUniqueString();
    String description = "description" + ZimbraSeleniumProperties.getUniqueString();

    command1 = new QuickCommand(name, description, ItemTypeId.MSG, true);
    command1.addActions(actions);

    return (command1);
  }