Examples of WebMailConfig


Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.WebMailConfig

   * @param xml The xml containing the configuration.
   * @return The jpmail configuration.
   * @throws ApsSystemException In case of parsing errors.
   */
  public WebMailConfig extractConfig(String xml) throws ApsSystemException {
    WebMailConfig config = new WebMailConfig();
    try {
      Element root = this.getRootElement(xml);
     
      Element domainNameElem = root.getChild(DOMAIN_ELEM);
      if (null != domainNameElem) {
        String domainName = domainNameElem.getText();
        config.setDomainName(domainName);
      }
     
      Element localhostElem = root.getChild(LOCALHOST_ELEM);
      if (null != localhostElem) {
        String localhost = localhostElem.getText();
        config.setLocalhost(localhost);
      }
     
      Element smtpElem = root.getChild(SMTP_ELEM);
      String debug = smtpElem.getAttributeValue(SMTP_DEBUG_ATTR);
      config.setDebug(new Boolean(debug).booleanValue());
     
      String japsUserAuth = smtpElem.getAttributeValue(SMTP_JAPS_USER_AUTH_ATTR);
      config.setSmtpJapsUserAuth(new Boolean(japsUserAuth).booleanValue());
     
      config.setSmtpHost(smtpElem.getChildText(SMTP_HOST_CHILD));
      config.setSmtpUserName(smtpElem.getChildText(SMTP_USER_CHILD));
      config.setSmtpPassword(smtpElem.getChildText(SMTP_PASSWORD_CHILD));
      String smtpPort = smtpElem.getChildText(SMTP_PORT_CHILD);
      Integer smtpPortValue = (smtpPort==null || smtpPort.length()==0) ? null : new Integer(smtpPort);
      config.setSmtpPort(smtpPortValue);
     
      Element certElem = root.getChild(CERTIFICATES_ELEM);
      String enable = certElem.getChildText(CERTIFICATES_ENABLE_CHILD);
      config.setCertificateEnable(new Boolean(enable).booleanValue());
      String lazyCheck =   certElem.getChildText(CERTIFICATES_LAZYCHECK_CHILD);
      config.setCertificateLazyCheck(new Boolean(lazyCheck).booleanValue());
      String certificatePath = certElem.getChildText(CERTIFICATES_CERTPATH_CHILD);
      config.setCertificatePath(certificatePath);
      String debugOnConsole = certElem.getChildText(CERTIFICATES_DEBUGONCONSOLE_CHILD);
      config.setCertificateDebugOnConsole(new Boolean(debugOnConsole).booleanValue());
     
      Element imapElem = root.getChild(IMAP_ELEM);
      config.setImapHost(imapElem.getChildText(IMAP_HOST_CHILD));
      String imapPort = imapElem.getChildText(IMAP_PORT_CHILD);
      Integer imapPortValue = (imapPort==null || imapPort.length()==0) ? null : new Integer(imapPort);
      config.setImapPort(imapPortValue);
      config.setImapProtocol(imapElem.getChildText(IMAP_PROTOCOL_CHILD));
     
      Element folderElem = root.getChild(FOLDER_ELEM);
      if (null != folderElem) {
        config.setTrashFolderName(folderElem.getChildText(FOLDER_TRASH_CHILD));
        config.setSentFolderName(folderElem.getChildText(FOLDER_SENT_CHILD));
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "extractConfig");
      throw new ApsSystemException("Error extracting config", t);
    }
View Full Code Here

Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.WebMailConfig

        super.setUp();
        this.init();
    }
 
  public void testGetConfig() throws Throwable {
    WebMailConfig config = this._webMailManager.loadConfig();
    assertEquals("out.virgilio.it", config.getSmtpHost());
    assertEquals("", config.getSmtpUserName());
    assertEquals("", config.getSmtpPassword());
  }
View Full Code Here

Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.WebMailConfig

public class TestWebMailConfigDOM extends ApsPluginBaseTestCase {
 
  public void testGetItems() throws ApsSystemException {
    WebMailConfigDOM configDOM = new WebMailConfigDOM();
    WebMailConfig bean = configDOM.extractConfig(XML);
    assertEquals("smtpUsername", bean.getSmtpUserName());
    assertEquals("SMTP.EMAIL.COM", bean.getSmtpHost());
    assertEquals("smtpPassword", bean.getSmtpPassword());
    assertEquals("/cert/path/", bean.getCertificatePath());
    assertTrue(bean.isCertificateLazyCheck());
    assertTrue(bean.isDebug());
  }
View Full Code Here

Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.WebMailConfig

  }
 
  @Override
  public String edit() {
    try {
      WebMailConfig config = this.getWebMailManager().loadConfig();
      this.setConfig(config);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "edit");
      return FAILURE;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.