コード例 #1
0
  /**
   * Returns all properties necessary for the intialization of the account with
   * <tt>accountPrefix</tt>.
   *
   * @param accountPrefix the prefix contained by all property names for the the account we'd like
   *     to initialized
   * @return a Hashtable that can be used when creating the account in a protocol provider factory.
   */
  private Hashtable<String, String> getAccountProperties(String accountPrefix) {
    Hashtable<String, String> table = new Hashtable<String, String>();

    String userID = System.getProperty(accountPrefix + ProtocolProviderFactory.USER_ID, null);

    assertNotNull(
        "The system property named "
            + accountPrefix
            + ProtocolProviderFactory.USER_ID
            + " has to tontain a valid Jabber address that could be used during "
            + "SIP Communicator's tests.",
        userID);

    table.put(ProtocolProviderFactory.USER_ID, userID);

    String passwd = System.getProperty(accountPrefix + ProtocolProviderFactory.PASSWORD, null);

    assertNotNull(
        "The system property named "
            + accountPrefix
            + ProtocolProviderFactory.PASSWORD
            + " has to contain the password corresponding to the account "
            + "specified in "
            + accountPrefix
            + ProtocolProviderFactory.USER_ID,
        passwd);

    table.put(ProtocolProviderFactory.PASSWORD, passwd);

    String serverAddress =
        System.getProperty(accountPrefix + ProtocolProviderFactory.SERVER_ADDRESS, null);

    // optional
    if (serverAddress != null) table.put(ProtocolProviderFactory.SERVER_ADDRESS, serverAddress);

    String serverPort =
        System.getProperty(accountPrefix + ProtocolProviderFactory.SERVER_PORT, null);

    // optional
    if (serverPort != null) table.put(ProtocolProviderFactory.SERVER_PORT, serverPort);

    return table;
  }