Package org.apache.jsieve.mail

Examples of org.apache.jsieve.mail.ActionReject


public class RejectAction implements MailAction {

    public void execute(Action action, Mail mail, ActionContext context)
            throws MessagingException {
        if (action instanceof ActionReject) {
            final ActionReject actionReject = (ActionReject) action;
            execute(actionReject, mail, context);
        }

    }
View Full Code Here


    protected Object executeBasic(MailAdapter mail, Arguments arguments,
            Block block, SieveContext context) throws SieveException {
        final String message = ((StringListArgument) arguments
                .getArgumentList().get(0)).getList().get(0);

        mail.addAction(new ActionReject(message));
        return null;
    }
View Full Code Here

     * Tests that a multiline message is correctly passed
     */
    public void testRejectMultilineMessage() throws Exception {
        String message = "This is not a love song";
        String script = "reject text:\n" + message + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, rejection.getMessage());
    }
View Full Code Here

     * between the command and the content.
     */
    public void testRejectMultilineMessageWithWhitespace() throws Exception {
        String message = "This is not a love song";
        String script = "reject text: \t \t \n" + message + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, rejection.getMessage());
    }   
View Full Code Here

     * between the command and the content.
     */
    public void testRejectMultilineMessageWithDotsMidline() throws Exception {
        String message = "This is not.....a love song";
        String script = "reject text:\n" + message + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, rejection.getMessage());
    }   
View Full Code Here

     */
    public void testRejectMultilineMessageWithDotStuffing() throws Exception {
        String lineOne = "This is not\n";
        String lineTwo = ".A Love Story";
        String script = "reject text:\n" + lineOne + '.' + lineTwo + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(lineOne + lineTwo, rejection.getMessage());
    }
View Full Code Here

     */
    public void testRejectMultilineMessageWithMissedDotStuffing() throws Exception {
        String lineOne = "This is not\n";
        String lineTwo = ".A Love Story";
        String script = "reject text:\n" + lineOne + lineTwo + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(lineOne + lineTwo, rejection.getMessage());
    }
View Full Code Here

    public void testNumberOfStuffedDotsInMultilineMessage() throws Exception {
        String lineOne = "This is line 1.\n";
        String lineTwo = "This is line 2.\n";
        String lineThree = "........ This is line 3.\n";
        String script = "reject text:\n" + lineOne + lineTwo + '.' + lineThree + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(lineOne + lineTwo + lineThree, rejection.getMessage());
    }
View Full Code Here

        String lineTwo = "This is line 2.\n";
        String lineThree = "........ This is line 3.\n";
        String lineFour = ".\n";
        String lineFive = ".\n";
        String script = "reject text:\n" + lineOne + lineTwo + '.' + lineThree + '.' + lineFour + '.' + lineFive + "\n.\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(lineOne + lineTwo + lineThree + lineFour + lineFive, rejection.getMessage());
    }
View Full Code Here

        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

TOP

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

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.