示例#1
0
  @Override
  public void confirmShellCreateNewXMPPAccount(JID jid, String password) throws RemoteException {
    SWTBotShell shell = new SWTBot().shell(SHELL_CREATE_XMPP_JABBER_ACCOUNT);
    shell.activate();

    shell.bot().textWithLabel(LABEL_XMPP_JABBER_SERVER).setText(jid.getDomain());
    shell.bot().textWithLabel(LABEL_USER_NAME).setText(jid.getName());
    shell.bot().textWithLabel(LABEL_PASSWORD).setText(password);
    shell.bot().textWithLabel(LABEL_REPEAT_PASSWORD).setText(password);

    shell.bot().button(FINISH).click();
    try {
      shell.bot().waitUntil(Conditions.shellCloses(shell));
    } catch (TimeoutException e) {
      String errorMessage = ((WizardDialog) shell.widget.getData()).getMessage();
      if (errorMessage.matches(ERROR_MESSAGE_TOO_FAST_REGISTER_ACCOUNTS + ".*"))
        throw new RuntimeException("you are not allowed to register accounts so fast");
      else if (errorMessage.matches(ERROR_MESSAGE_ACCOUNT_ALREADY_EXISTS + ".*\n*.*"))
        throw new RuntimeException("the Account " + jid.getBase() + " already exists");
    }
  }