Package org.subethamail.wiser

Examples of org.subethamail.wiser.Wiser


   public void setUp() throws Exception
   {
      PortalContainer pcontainer = PortalContainer.getInstance();
      service = (MailService)pcontainer.getComponentInstanceOfType(MailService.class);
      // starting dummy SMTP Server
      mailServer = new Wiser();
      mailServer.setPort(SMTP_PORT);
      mailServer.start();
   }
View Full Code Here


        user.setWebsite("http://raibledesigns.com");
        user.setPasswordHint("Password is one with you.");
        bean.setUser(user);

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

        assertEquals("home", bean.save());
        assertFalse(bean.hasErrors());

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

        // verify that success messages are in the session
        assertNotNull(bean.getSession().getAttribute(Constants.REGISTERED));

        SecurityContextHolder.getContext().setAuthentication(null);
View Full Code Here

    }

    @Test
    public void testExecute() throws Exception {
        // start SMTP Server
        Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();

        bean.setUsername("user");
        assertEquals("success", bean.execute());
        assertFalse(bean.hasErrors());

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

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

    @Test
    public void testSendMessageWithAttachment() throws Exception {
        final String ATTACHMENT_NAME = "boring-attachment.txt";
       
        //mock smtp server
        Wiser wiser = new Wiser();
        int port = 2525 + (int)(Math.random() * 100);
        mailSender.setPort(port);
        wiser.setPort(port);
        wiser.start();
       
        Date dte = new Date();
        String emailSubject = "grepster testSendMessageWithAttachment: " + dte;
        String emailBody = "Body of the grepster testSendMessageWithAttachment message sent at: " + dte;
       
        ClassPathResource cpResource = new ClassPathResource("/test-attachment.txt");
        // a null from should work
        mailEngine.sendMessage(new String[] {
            "foo@bar.com"
        }, null, cpResource, emailBody, emailSubject, ATTACHMENT_NAME);

        mailEngine.sendMessage(new String[] {
            "foo@bar.com"
        }, mailMessage.getFrom(), cpResource, emailBody, emailSubject, ATTACHMENT_NAME);

        wiser.stop();
        // one without and one with from
        assertTrue(wiser.getMessages().size() == 2);
       
        WiserMessage wm = wiser.getMessages().get(0);
        MimeMessage mm = wm.getMimeMessage();

        Object o = wm.getMimeMessage().getContent();
        assertTrue(o instanceof MimeMultipart);
        MimeMultipart multi = (MimeMultipart)o;
View Full Code Here

        final String token = passwordTokenManager.generateRecoveryToken(user);
        Assert.assertNotNull(token);
        Assert.assertTrue(passwordTokenManager.isRecoveryTokenValid(user, token));

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

        userManager.updatePassword(user.getUsername(), null, token, "user", "");

        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);

        Assert.assertTrue(user.getVersion() > version);
        Assert.assertFalse(passwordTokenManager.isRecoveryTokenValid(user, token));
    }
View Full Code Here

        setupWiser();
        setupRelay();
    }

    private void setupWiser() {
        wiser = new Wiser(2525);
        wiser.getServer().getCommandHandler()
                .addCommand(new ObservableQuitCommand());
        wiser.start();
    }
View Full Code Here

        filters.addFilter(destinationProcessFilter);
        return filters;
    }

    private void setupWiser() {
        wiser = new Wiser(8026);
        wiser.start();
    }
View Full Code Here

    loggerOrg.addAppender(appender);
    loggerCom.addAppender(appender);
    loggerOrg.setLevel(Level.WARN);
    loggerCom.setLevel(Level.WARN);
   
    wiser = new Wiser(2500);
   
  }
View Full Code Here

    ConsoleAppender appender = new ConsoleAppender(layout);
    logger1.addAppender(appender);
    logger1.setLevel(Level.WARN);
    logger2.addAppender(appender);
   
    wiser = new Wiser(2500);
  }
View Full Code Here

    loggerOrg.addAppender(appender);
    loggerCom.addAppender(appender);
    loggerOrg.setLevel(Level.WARN);
    loggerCom.setLevel(Level.WARN);
   
    wiser = new Wiser(2500);
    wiser.start();
   
    return Arrays.asList(new Object[][] {
        {null, null, 0, null, null, null, null} //QwertoMailerException
        , {null, "", 0, null, null, null, null//QwertoMailerException
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.