Esempio n. 1
0
  /**
   * @param args
   * @throws HarnessException
   */
  public static void main(String[] args) throws HarnessException {

    // Configure log4j using the basic configuration
    BasicConfigurator.configure();

    // Use the pre-provisioned global admin account to send a basic request
    ZimbraAdminAccount.GlobalAdmin().soapSend("<GetVersionInfoRequest xmlns='urn:zimbraAdmin'/>");
    if (!ZimbraAdminAccount.GlobalAdmin().soapMatch("//admin:GetVersionInfoResponse", null, null))
      throw new HarnessException("GetVersionInfoRequest did not return GetVersionInfoResponse");

    // Create a new global admin account
    String domain =
        ZimbraSeleniumProperties.getStringProperty("server.host", "qa60.lab.zimbra.com");
    ZimbraAdminAccount admin =
        new ZimbraAdminAccount("admin" + System.currentTimeMillis() + "@" + domain);
    admin.provision(); // Create the account (CreateAccountRequest)
    admin.authenticate(); // Authenticate the account (AuthRequest)

    // Send a basic request as the new admin account
    admin.soapSend("<GetServiceStatusRequest xmlns='urn:zimbraAdmin'/>");
    if (!admin.soapMatch("//admin:GetServiceStatusResponse", null, null))
      throw new HarnessException("GetServiceStatusRequest did not return GetServiceStatusResponse");

    logger.info("Done!");
  }
Esempio n. 2
0
 /**
  * Get the global admin account This account is defined in config.properties as
  * <adminName>@<server>
  *
  * @return The global admin account
  */
 public static synchronized ZimbraAdminAccount GlobalAdmin() {
   if (_GlobalAdmin == null) {
     String name =
         ZimbraSeleniumProperties.getStringProperty("adminName", "*****@*****.**");
     _GlobalAdmin = new ZimbraAdminAccount(name);
     _GlobalAdmin.authenticate();
   }
   return (_GlobalAdmin);
 }
Esempio n. 3
0
 /**
  * Get the global admin account used for Admin Console testing This global admin has the
  * zimbraPrefAdminConsoleWarnOnExit set to false
  */
 public static synchronized ZimbraAdminAccount AdminConsoleAdmin() {
   if (_AdminConsoleAdmin == null) {
     try {
       String name = "globaladmin" + ZimbraSeleniumProperties.getUniqueString();
       String domain =
           ZimbraSeleniumProperties.getStringProperty("server.host", "qa60.lab.zimbra.com");
       _AdminConsoleAdmin = new ZimbraAdminAccount(name + "@" + domain);
       _AdminConsoleAdmin.provision();
       _AdminConsoleAdmin.authenticate();
       _AdminConsoleAdmin.soapSend(
           "<ModifyAccountRequest xmlns='urn:zimbraAdmin'>"
               + "<id>"
               + _AdminConsoleAdmin.ZimbraId
               + "</id>"
               + "<a n='zimbraPrefAdminConsoleWarnOnExit'>FALSE</a>"
               + "</ModifyAccountRequest>");
     } catch (HarnessException e) {
       logger.error("Unable to fully provision admin account", e);
     }
   }
   return (_AdminConsoleAdmin);
 }
Esempio n. 4
0
 public ZimbraAdminAccount(String email) {
   EmailAddress = email;
   Password = ZimbraSeleniumProperties.getStringProperty("adminPwd", "test123");
   ZimbraMailHost = EmailAddress.split("@")[1];
 }