Examples of MailAdapter


Examples of org.apache.jsieve.mail.MailAdapter

    public void testRejectAndAFollowingCommand() {
        boolean isTestPassed = false;
        String script = "reject \"Spam not consumed here!\"; keep;";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (CommandException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testDiscard() {
        boolean isTestPassed = false;
        String script = "discard;";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
            assertTrue(mail.getActions().isEmpty());
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
        }
        assertTrue(isTestPassed);
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testReject() {
        boolean isTestPassed = false;
        String script = "reject \"Spam not consumed here!\";";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
            assertTrue(mail.getActions().size() == 1);
            assertTrue(mail.getActions().get(0) instanceof ActionReject);
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
        }
        assertTrue(isTestPassed);
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testRejectMissingMessage() {
        boolean isTestPassed = false;
        String script = "reject;";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
            assertTrue(mail.getActions().size() == 1);
            assertTrue(mail.getActions().get(0) instanceof ActionReject);
        } catch (ParseException e) {
        } catch (SieveException e) {
            isTestPassed = true;
        }
        assertTrue(isTestPassed);
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testDuplicateReject() {
        boolean isTestPassed = false;
        String script = "reject \"Spam not consumed here!\"; reject \"Spam not consumed here!\";";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (CommandException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testRejectAndAPrecedingCommand() {
        boolean isTestPassed = false;
        String script = "keep; reject \"Spam not consumed here!\";";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (CommandException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testRejectAndAFollowingCommand() {
        boolean isTestPassed = false;
        String script = "reject \"Spam not consumed here!\"; keep;";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (CommandException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

     * @throws MessagingException
     */
    protected void evaluate(Mail aMail) throws MessagingException {
        // Evaluate the script against the mail
        try {
            MailAdapter aMailAdapter = new SieveMailAdapter(aMail,
                    getMailetContext());
            log("Evaluating " + aMailAdapter.toString() + "against \""
                    + getScriptURL().toExternalForm() + "\"");
            SieveFactory.getInstance().evaluate(aMailAdapter, getStartNode());
        } catch (SieveException ex) {
            log("Exception evaluating Sieve script", ex);
            // If there were errors, we redirect the email to the ERROR
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testFileInto() {
        boolean isTestPassed = false;
        String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test2\";";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
            assertTrue(mail.getActions().size() == 2);
            assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
            assertTrue(((ActionFileInto) mail.getActions().get(0))
                    .getDestination().equals("INBOX.test1"));
            assertTrue(mail.getActions().get(1) instanceof ActionFileInto);
            assertTrue(((ActionFileInto) mail.getActions().get(1))
                    .getDestination().equals("INBOX.test2"));
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
        }
View Full Code Here

Examples of org.apache.jsieve.mail.MailAdapter

    public void testDuplicateFileInto() {
        boolean isTestPassed = false;
        String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test1\";";

        try {
            MailAdapter mail = JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
            assertTrue(mail.getActions().size() == 1);
            assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
            assertTrue(((ActionFileInto) mail.getActions().get(0))
                    .getDestination().equals("INBOX.test1"));
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
        }
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.