Examples of MailConfig


Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

   * @param xml The xml containing the configuration.
   * @return The jpmail configuration.
   * @throws ApsSystemException In case of parsing errors.
   */
  public MailConfig extractConfig(String xml) throws ApsSystemException {
    MailConfig config = new MailConfig();
    Element root = this.getRootElement(xml);
    Element activeElem = root.getChild(ACTIVE_ELEM);
    if (activeElem != null) {
      String active = activeElem.getText();
      config.setActive(null != active && active.equalsIgnoreCase("true"));
    }
    this.extractSenders(root, config);
    this.extractSmtp(root, config);
    return config;
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

   * Tests the extraction of the configuration from the XML.
   * @throws Throwable
   */
  public void testExtractConfig() throws Throwable {
    String xml = this._configManager.getConfigItem(JpmailSystemConstants.MAIL_CONFIG_ITEM);
    MailConfig mailConfig = new MailConfigDOM().extractConfig(xml);
    this.checkOriginaryConfig(mailConfig);
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

   * @throws Throwable
   */
  public void testUpdateConfig() throws Throwable {
    MailConfigDOM mailConfigDom = new MailConfigDOM();
    String xml = this._configManager.getConfigItem(JpmailSystemConstants.MAIL_CONFIG_ITEM);
    MailConfig originaryConfig = mailConfigDom.extractConfig(xml);
    try {
      MailConfig config = this.createMailConfig();
      xml = mailConfigDom.createConfigXml(config);
      MailConfig updatedConfig = mailConfigDom.extractConfig(xml);
      this.compareConfigs(config, updatedConfig);
    } catch (Throwable t) {
      throw t;
    } finally {
      xml = mailConfigDom.createConfigXml(originaryConfig);
      MailConfig updatedConfig = mailConfigDom.extractConfig(xml);
      this.compareConfigs(originaryConfig, updatedConfig);
    }
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

  /**
   * Tests the 'edit' action.
   * @throws Throwable
   */
  public void testEdit() throws Throwable {
    MailConfig config = this._mailManager.getMailConfig();
   
    this.setUserOnSession("admin");
    this.initAction("/do/jpmail/MailConfig", "editSmtp");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    SmtpConfigAction action = (SmtpConfigAction) this.getAction();
    assertEquals(config.isDebug(), action.isDebug());
    assertEquals(config.getSmtpHost(), action.getSmtpHost());
    assertEquals(config.getSmtpUserName(), action.getSmtpUserName());
    assertEquals(config.getSmtpPassword(), action.getSmtpPassword());
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

      params.put("smtpUserName", "username");
      params.put("smtpPassword", "password");
      String result = this.executeSave("admin", params);
      assertEquals(Action.SUCCESS, result);
     
      MailConfig config = this._mailManager.getMailConfig();
      assertEquals("host", config.getSmtpHost());
      assertNull(config.getSmtpPort());
      assertNull(config.getSmtpTimeout());
      assertEquals("username", config.getSmtpUserName());
      assertEquals("password", config.getSmtpPassword());
     
      params.put("smtpPort", "2525");
      params.put("smtpTimeout", "2000");
      result = this.executeSave("admin", params);
      assertEquals(Action.SUCCESS, result);
      config = this._mailManager.getMailConfig();
      assertEquals("host", config.getSmtpHost());
      assertEquals(new Integer(2525), config.getSmtpPort());
      assertEquals(new Integer(2000), config.getSmtpTimeout());
      assertEquals("username", config.getSmtpUserName());
      assertEquals("password", config.getSmtpPassword());
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.resetConfig();
    }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

import com.agiletec.plugins.jpmail.aps.services.mail.MailConfig;

public class TestMailManager extends AbstractMailConfigTestCase {
 
  public void testGetConfig() throws Throwable {
    MailConfig mailConfig = this._mailManager.getMailConfig();
    this.checkOriginaryConfig(mailConfig);
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

    MailConfig mailConfig = this._mailManager.getMailConfig();
    this.checkOriginaryConfig(mailConfig);
  }
 
  public void testUpdateConfig() throws Throwable {
    MailConfig originaryConfig = this._mailManager.getMailConfig();
    try {
      MailConfig config = this.createMailConfig();
      this._mailManager.updateMailConfig(config);
      MailConfig updatedConfig = this._mailManager.getMailConfig();
      this.compareConfigs(config, updatedConfig);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._mailManager.updateMailConfig(originaryConfig);
      MailConfig updatedConfig = this._mailManager.getMailConfig();
      this.compareConfigs(originaryConfig, updatedConfig);
    }
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

    MockAuthenticationHandlerFactory myAuthFactory2 = new MockAuthenticationHandlerFactory();
    SMTPServer smtpServer2 = new SMTPServer(myFactory2, myAuthFactory2);
        smtpServer2.setPort(25001);
        smtpServer2.start();
   
    MailConfig originaryConfig = this._mailManager.getMailConfig();
    try {
      MailConfig config = this._mailManager.getMailConfig();
      config.setSmtpPort(25001);
      this._mailManager.updateMailConfig(config);
      String[] mailAddresses = JpmailTestHelper.MAIL_ADDRESSES;
      this._mailManager.sendMail(MAIL_TEXT, "Mail semplice", mailAddresses, mailAddresses, mailAddresses, SENDER_CODE);
    } catch (Throwable t) {
      throw t;
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

    this._helper.resetConfig();
    super.tearDown();
  }
 
  protected MailConfig createMailConfig() {
    MailConfig config = new MailConfig();
    config.addSender("c1", "aaa@aaa.aaa");
    config.addSender("c2", "bbb@bbb.bbb");
    config.addSender("c3", "ccc@ccc.ccc");
   
    config.setDebug(false);
    config.setSmtpHost("smtp.qwerty.it");
    config.setSmtpPort(new Integer(2525));
    config.setSmtpTimeout(new Integer(100));
    config.setSmtpUserName("ciccio");
    config.setSmtpPassword("cicci");
    config.setSmtpProtocol(new Integer(2));
    return config;
  }
View Full Code Here

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

    this.setUserOnSession("admin");
    this.initAction("/do/jpmail/MailConfig", "viewSenders");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    MailSenderConfigAction action = (MailSenderConfigAction) this.getAction();
    MailConfig mailConfig = action.getConfig();
    this.checkOriginaryConfig(mailConfig);
  }
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.