Package javax.mail.search

Examples of javax.mail.search.SearchTerm.match()


        MimeMessage msg = new MimeMessage(sender.getSession());
        msg.setSubject("Yeah Camel rocks");
        msg.setText("Apache Camel is a cool project. Have a fun ride.");
        msg.setFrom(new InternetAddress("someone@somewhere.com"));
        assertTrue("Should match message", st.match(msg));

        MimeMessage msg2 = new MimeMessage(sender.getSession());
        msg2.setSubject("Apache Camel is fantastic");
        msg2.setText("I like Camel.");
        msg2.setFrom(new InternetAddress("donotreply@somewhere.com"));
View Full Code Here


        MimeMessage msg2 = new MimeMessage(sender.getSession());
        msg2.setSubject("Apache Camel is fantastic");
        msg2.setText("I like Camel.");
        msg2.setFrom(new InternetAddress("donotreply@somewhere.com"));
        assertFalse("Should not match message, as from doesn't match", st.match(msg2));
    }

    public void testSearchTermBuilderFromOrSubject() throws Exception {
        SearchTermBuilder build = new SearchTermBuilder();
        SearchTerm st = build.subject("Camel").from(or, "admin@apache.org").build();
View Full Code Here

        MimeMessage msg = new MimeMessage(sender.getSession());
        msg.setSubject("Yeah Camel rocks");
        msg.setText("Apache Camel is a cool project. Have a fun ride.");
        msg.setFrom(new InternetAddress("someone@somewhere.com"));
        assertTrue("Should match message", st.match(msg));

        MimeMessage msg2 = new MimeMessage(sender.getSession());
        msg2.setSubject("Beware");
        msg2.setText("This is from the administrator.");
        msg2.setFrom(new InternetAddress("admin@apache.org"));
View Full Code Here

        MimeMessage msg2 = new MimeMessage(sender.getSession());
        msg2.setSubject("Beware");
        msg2.setText("This is from the administrator.");
        msg2.setFrom(new InternetAddress("admin@apache.org"));
        assertTrue("Should match message, as its from admin", st.match(msg2));
    }

    public void testSearchTermSentLast24Hours() throws Exception {
        SearchTermBuilder build = new SearchTermBuilder();
        long offset = -1 * (24 * 60 * 60 * 1000L);
 
View Full Code Here

        MimeMessage msg = new MimeMessage(sender.getSession());
        msg.setSubject("Yeah Camel rocks");
        msg.setText("Apache Camel is a cool project. Have a fun ride.");
        msg.setFrom(new InternetAddress("someone@somewhere.com"));
        msg.setSentDate(new Date());
        assertTrue("Should match message", st.match(msg));

        MimeMessage msg2 = new MimeMessage(sender.getSession());
        msg2.setSubject("Camel in Action");
        msg2.setText("Hey great book");
        msg2.setFrom(new InternetAddress("dude@apache.org"));
View Full Code Here

        // mark it as sent 2 days ago
        long twoDays = 2 * 24 * 60 * 60 * 1000L;
        long time = new Date().getTime() - twoDays;
        msg2.setSentDate(new Date(time));

        assertFalse("Should not match message as its too old", st.match(msg2));
    }

    public void testComparison() throws Exception {
        assertEquals(1, Comparison.LE.asNum());
        assertEquals(2, Comparison.LT.asNum());
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.