Package com.icegreen.greenmail.util

Examples of com.icegreen.greenmail.util.GreenMail


        return null;
    }

    protected void startGreenMail() throws Exception
    {
        this.greenMail = new GreenMail();
        this.greenMail.start();
    }
View Full Code Here


        conf.set(SLAEmailEventListener.BLACKLIST_CACHE_TIMEOUT, "1");
        conf.set(SLAEmailEventListener.BLACKLIST_FAIL_COUNT, "2");
        conf.set(SLAService.CONF_ALERT_EVENTS, SLAEvent.EventStatus.START_MISS.name() + ","
                + SLAEvent.EventStatus.END_MISS + "," + SLAEvent.EventStatus.DURATION_MISS);

        greenMail = new GreenMail(new ServerSetup(SMTP_TEST_PORT, null, "smtp"));
        greenMail.start();
        services.init();
        slaEmailListener = new SLAEmailEventListener();
        slaEmailListener.init(conf);
    }
View Full Code Here

    GreenMail server;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        server = new GreenMail();
        server.start();
    }
View Full Code Here

    OnConsoleStatusListener.addNewInstanceToContext(loggerContext);
    MDC.clear();
    ServerSetup serverSetup = new ServerSetup(port, "localhost",
            ServerSetup.PROTOCOL_SMTP);
    greenMailServer = new GreenMail(serverSetup);
    greenMailServer.start();
    // give the server a head start
    if (EnvUtilForTests.isRunningOnSlowJenkins()) {
      Thread.sleep(2000);
    } else {
View Full Code Here

        conf.set(SLAEmailEventListener.BLACKLIST_CACHE_TIMEOUT, "1");
        conf.set(SLAEmailEventListener.BLACKLIST_FAIL_COUNT, "2");
        conf.set(SLAService.CONF_ALERT_EVENTS, SLAEvent.EventStatus.START_MISS.name() + ","
                + SLAEvent.EventStatus.END_MISS + "," + SLAEvent.EventStatus.DURATION_MISS);

        greenMail = new GreenMail(new ServerSetup(SMTP_TEST_PORT, null, "smtp"));
        greenMail.start();
        services.init();
        slaEmailListener = new SLAEmailEventListener();
        slaEmailListener.init(conf);
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {

        SMTP_TEST_PORT = findAvailablePort(1000, 10000);

        greenMail = new GreenMail(new ServerSetup(SMTP_TEST_PORT, null, "smtp"));
        greenMail.start();
    }
View Full Code Here

  public T ensureStarted() {
    if (greenMail == null) {
      send = setupSendServer();
      receive = setupReceiveServer();

      greenMail = new GreenMail(new ServerSetup[] { send, receive });
      greenMail.setUser(ADMIN_USER + "@localhost", ADMIN_USER, ADMIN_PASSWORD);
      greenMail.start();
    }
    return (T) this;
  }
View Full Code Here

    serverSetups = ServerSetup.SMTPS_POP3S_IMAPS;
      } else {
    serverSetups = ServerSetup.SMTP_POP3_IMAP;
      }
  }
  greenMail = new GreenMail(serverSetups);
  greenMail.start();
  logInfo(logger, "com.btmatthews.maven.plugin.emailserver.greenmail.started");
    }
View Full Code Here

    @Test(groups = {"jaggery"},
            description = "Test a sample request and a response for E-mail host object")
    public void testEmail() {
        ClientConnectionUtil.waitForPort(9763);

        GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP);
        greenMail.start();

        String finalOutput = null;

        try {
            URL jaggeryURL = new URL("http://localhost:9763/testapp/email.jag");
            URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    jaggeryServerConnection.getInputStream()));

            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                finalOutput = inputLine;
            }

            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            assertNotNull(finalOutput, "Result cannot be null");
            greenMail.stop();
        }

    }
View Full Code Here

    @Test(groups = {"jaggery"},
            description = "Test a sample request and a response for E-mail host object")
    public void testSendEmail() {
        ClientConnectionUtil.waitForPort(9763);

        GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP);
        greenMail.start();

        String finalOutput = null;
        try {
            URL jaggeryURL = new URL("http://localhost:9763/testapp/email.jag");
            URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    jaggeryServerConnection.getInputStream()));

            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                finalOutput = inputLine;
            }

            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            assertEquals(finalOutput, "email successfully sent");
            greenMail.stop();
        }

    }
View Full Code Here

TOP

Related Classes of com.icegreen.greenmail.util.GreenMail

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.