Package org.apache.jsieve.mail

Examples of org.apache.jsieve.mail.ActionReject


     * Tests that the message is correctly passed
     */
    public void testRejectMessage() throws Exception {
        String message = "Spam not consumed here!";
        String script = "reject \"" + message + "\";";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, 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

         */
        public boolean isActionReject(String message, int n) {
            boolean result = false;
            Object action = actionsExecuted.get(n);
            if (action != null && action instanceof ActionReject) {
                ActionReject actionReject = (ActionReject) action;
                result = message.equals(actionReject.getMessage());
            }
            return result;
        }
View Full Code Here

         */
        public boolean isActionReject(String message, int n) {
            boolean result = false;
            Object action = actionsExecuted.get(n);
            if (action != null && action instanceof ActionReject) {
                ActionReject actionReject = (ActionReject) action;
                result = message.equals(actionReject.getMessage());
            }
            return result;
        }
View Full Code Here

         */
        public boolean isActionReject(String message, int n) {
            boolean result = false;
            Object action = actionsExecuted.get(n);
            if (action != null && action instanceof ActionReject) {
                ActionReject actionReject = (ActionReject) action;
                result = message.equals(actionReject.getMessage());
            }
            return result;
        }
View Full Code Here

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

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

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

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

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

     * 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:\r\n" + message + "\r\n.\r\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 \r\n" + message + "\r\n.\r\n;";
        ActionReject rejection = runRejectScript(script);       
        assertEquals(message, rejection.getMessage());
    }   
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.