Package org.subethamail.wiser

Examples of org.subethamail.wiser.Wiser


  /** */
  @Override
  protected void setUp() throws Exception
  {
    super.setUp();
    this.server = new Wiser();
    this.server.setPort(SMTP_PORT);
    this.server.start();
    this.socket = new Socket(HOST_NAME, SMTP_PORT);
    this.input = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
    this.output = new PrintWriter(this.socket.getOutputStream(), true);
View Full Code Here


    Properties props = new Properties();
    props.setProperty("mail.smtp.host", "localhost");
    props.setProperty("mail.smtp.port", Integer.toString(PORT));
    this.session = Session.getInstance(props);

    this.wiser = new Wiser();
    this.wiser.setPort(PORT);

    this.wiser.start();
  }
View Full Code Here

  }

  /** */
  private void startStop(boolean pause) throws Exception
  {
    Wiser wiser = new Wiser();
    wiser.setPort(PORT);

    wiser.start();

    if (pause)
      Thread.sleep(1000);

    wiser.stop();

    this.counter++;
  }
View Full Code Here

  public static final int PORT = 2566;

  /** */
  public static void main(String[] args) throws Exception
  {
    Wiser wiser = new Wiser();
    wiser.setHostname("localhost");
    wiser.setPort(PORT);

    wiser.start();

    String line;
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    do
    {
      line = in.readLine();
      line = line.trim();

      if ("dump".equals(line));
        wiser.dumpMessages(System.out);

      if (line.startsWith("dump "))
      {
        line = line.substring("dump ".length());
        File f = new File(line);
        OutputStream out = new FileOutputStream(f);
        wiser.dumpMessages(new PrintStream(out));
        out.close();
      }
    }
    while (!"quit".equals(line));

    wiser.stop();
  }
View Full Code Here

  private Wiser wiser;
 
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    wiser = new Wiser();
    wiser.setPort(5025);
    wiser.start();
  }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        log.debug("");

        log.debug("Starting wiser on port " + smtpPort);
        wiser = new Wiser();
        wiser.setPort(smtpPort);
        wiser.start();

        setDriver(new ChromeDriver());
        getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
View Full Code Here

    protected void logout() {
        SecurityContextHolder.getContext().setAuthentication(null);
    }

    protected void startSmtpServer() {
        wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();
    }
View Full Code Here

        // set mock response so setting cookies doesn't fail
        ServletActionContext.setResponse(new MockHttpServletResponse());

        // start SMTP Server
        final Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();

        assertNull(action.getUser().getId());
        assertEquals("success", action.save());
        assertFalse(action.hasActionErrors());
        assertNotNull(action.getUser().getId());

        // verify an account information e-mail was sent
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);

        // verify that success messages are in the session
        assertNotNull(action.getSession().getAttribute(Constants.REGISTERED));
        // try it again with same user
        action.setUser(user2);
View Full Code Here

    private UserManager userManager;

    @Test
    public void testExecute() throws Exception {
        // start SMTP Server
        Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();
       
        action.setUsername("user");
        assertEquals("success", action.execute());
        assertFalse(action.hasActionErrors());

        // verify an account information e-mail was sent
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);

        // verify that success messages are in the request
        assertNotNull(action.getSession().getAttribute("messages"));
    }
View Full Code Here

    }

    @Test
    public void testSend() throws Exception {
        // mock smtp server
        Wiser wiser = new Wiser();
        // set the port to a random value so there's no conflicts between tests
        int port = 2525 + (int)(Math.random() * 100);
        mailSender.setPort(port);
        wiser.setPort(port);
        wiser.start();
       
        Date dte = new Date();
        this.mailMessage.setTo("foo@bar.com");
        String emailSubject = "grepster testSend: " + dte;
        String emailBody = "Body of the grepster testSend message sent at: " + dte;
        this.mailMessage.setSubject(emailSubject);
        this.mailMessage.setText(emailBody);
        this.mailEngine.send(this.mailMessage);
       
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);
        WiserMessage wm = wiser.getMessages().get(0);
        assertEquals(emailSubject, wm.getMimeMessage().getSubject());
        assertEquals(emailBody, wm.getMimeMessage().getContent());
    }
View Full Code Here

TOP

Related Classes of org.subethamail.wiser.Wiser

Copyright © 2018 www.massapicom. 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.