Package org.apache.jsieve.mail

Examples of org.apache.jsieve.mail.MailAdapter


        ActionReject rejection = runRejectScript(script);       
        assertEquals(lineOne + lineTwo + lineThree + lineFour + lineFive, rejection.getMessage());
    }
   
    private ActionReject runRejectScript(String script) throws SieveException, ParseException {
        MailAdapter mail = JUnitUtils.createMail();
        JUnitUtils.interpret(mail, script);
        assertTrue(mail.getActions().size() == 1);
        Object action = mail.getActions().get(0);
        assertTrue(action instanceof ActionReject);
        ActionReject rejection = (ActionReject) action;
        return rejection;
    }
View Full Code Here


    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

    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

    public void testKeep() {
        boolean isTestPassed = false;
        String script = "keep;";

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

    public void testStop() {
        boolean isTestPassed = false;
        String script = "stop; throwTestException;";

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

    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

        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, rejection.getMessage());
    }

    private ActionReject runRejectScript(String script) throws SieveException, ParseException {
        MailAdapter mail = JUnitUtils.createMail();
        JUnitUtils.interpret(mail, script);
        assertTrue(mail.getActions().size() == 1);
        Object action = mail.getActions().get(0);
        assertTrue(action instanceof ActionReject);
        ActionReject rejection = (ActionReject) action;
        return rejection;
    }
View Full Code Here

    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

    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

    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

TOP

Related Classes of org.apache.jsieve.mail.MailAdapter

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.