Search in sources :

Example 16 with Mailbox

use of org.jvnet.mock_javamail.Mailbox in project camel by apache.

the class MailSearchTermTest method testSearchTerm.

@Test
public void testSearchTerm() throws Exception {
    Mailbox mailbox = Mailbox.get("bill@localhost");
    assertEquals(6, mailbox.size());
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder("I like riding the Camel", "Ordering Camel in Action");
    assertMockEndpointsSatisfied();
}
Also used : Mailbox(org.jvnet.mock_javamail.Mailbox) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 17 with Mailbox

use of org.jvnet.mock_javamail.Mailbox in project camel by apache.

the class MailSearchTermUriConfigLast24HoursTest method testSearchTerm.

@Test
public void testSearchTerm() throws Exception {
    Mailbox mailbox = Mailbox.get("bill@localhost");
    assertEquals(6, mailbox.size());
    // should only get the 4 latest emails that was sent within the last 24 hours
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder("Ordering ActiveMQ in Action", "This is spam", "We meet at 7pm the usual place", "I am attaching you");
    assertMockEndpointsSatisfied();
}
Also used : Mailbox(org.jvnet.mock_javamail.Mailbox) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 18 with Mailbox

use of org.jvnet.mock_javamail.Mailbox in project camel by apache.

the class MailSearchTermUriConfigTest method testSearchTerm.

@Test
public void testSearchTerm() throws Exception {
    Mailbox mailbox = Mailbox.get("bill@localhost");
    assertEquals(6, mailbox.size());
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder("I like riding the Camel", "Ordering Camel in Action");
    assertMockEndpointsSatisfied();
}
Also used : Mailbox(org.jvnet.mock_javamail.Mailbox) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 19 with Mailbox

use of org.jvnet.mock_javamail.Mailbox in project camel by apache.

the class MailUsingOwnComponentTest method testUsingOwnMailComponent.

@Test
public void testUsingOwnMailComponent() throws Exception {
    Mailbox.clearAll();
    template.sendBodyAndHeader("mailbox:foo", "Hello Mailbox", "to", "davsclaus@apache.org");
    Mailbox box = Mailbox.get("davsclaus@apache.org");
    Message msg = box.get(0);
    assertEquals("davsclaus@apache.org", msg.getRecipients(Message.RecipientType.TO)[0].toString());
}
Also used : Mailbox(org.jvnet.mock_javamail.Mailbox) Message(javax.mail.Message) Test(org.junit.Test)

Example 20 with Mailbox

use of org.jvnet.mock_javamail.Mailbox in project camel by apache.

the class MailSortTermThreeTest method testSortTerm.

@Test
public void testSortTerm() throws Exception {
    Mailbox mailbox = Mailbox.get("bill@localhost");
    assertEquals(3, mailbox.size());
    // This one has search term set
    MockEndpoint mockDescImap = getMockEndpoint("mock:resultDescendingImap");
    mockDescImap.expectedBodiesReceived("Even later date", "Later date", "Earlier date");
    context.startAllRoutes();
    assertMockEndpointsSatisfied();
}
Also used : Mailbox(org.jvnet.mock_javamail.Mailbox) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

Mailbox (org.jvnet.mock_javamail.Mailbox)44 Test (org.junit.Test)39 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)20 Message (javax.mail.Message)18 HashMap (java.util.HashMap)5 MimeMessage (javax.mail.internet.MimeMessage)3 Address (javax.mail.Address)2 Exchange (org.apache.camel.Exchange)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashSet (java.util.HashSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 Folder (javax.mail.Folder)1 Session (javax.mail.Session)1 InternetAddress (javax.mail.internet.InternetAddress)1 MimeMultipart (javax.mail.internet.MimeMultipart)1 NotifyBuilder (org.apache.camel.builder.NotifyBuilder)1