Package org.apache.mailet.base

Examples of org.apache.mailet.base.GenericMailet


    private final static String HEADER1 = "header1";
   
    private final static String HEADER2 = "header2";
   
    private GenericMailet setupMockedMailet(String name1,String name2) throws MessagingException {
        GenericMailet mailet = new RemoveMimeHeader();
        FakeMailetConfig mci = new FakeMailetConfig("Test", new FakeMailContext());
        if (name1 != null) mci.setProperty("name", name1);
        if (name2 != null) mci.setProperty("name", name2);

        mailet.init(mci);
        return mailet;
    }
View Full Code Here


        m.setMessage(message);
        return m;
    }
   
    public void testOneHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet(HEADER1,null);
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // The first header should be removed
        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
    }
   
    public void testTwoHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet(HEADER1,HEADER2);
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // Both header should be removed
        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNull("Header removed",mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNull("Header removed",mail.getMessage().getHeader(HEADER2));
    }
   
    public void testNoHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet("h1","h2");
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // Both header should be removed
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("header present", mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

    private final static String HEADER1 = "header1";
   
    private final static String HEADER2 = "header2";
   
    private GenericMailet setupMockedMailet(String name1,String name2) throws MessagingException {
        GenericMailet mailet = new RemoveMimeHeader();
        FakeMailetConfig mci = new FakeMailetConfig("Test", new FakeMailContext());
        if (name1 != null) mci.setProperty("name", name1);
        if (name2 != null) mci.setProperty("name", name2);

        mailet.init(mci);
        return mailet;
    }
View Full Code Here

        m.setMessage(message);
        return m;
    }
   
    public void testOneHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet(HEADER1,null);
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // The first header should be removed
        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
    }
   
    public void testTwoHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet(HEADER1,HEADER2);
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // Both header should be removed
        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNull("Header removed",mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

        assertNull("Header removed",mail.getMessage().getHeader(HEADER1));
        assertNull("Header removed",mail.getMessage().getHeader(HEADER2));
    }
   
    public void testNoHeaderRemoved() throws MessagingException {
        GenericMailet mailet = setupMockedMailet("h1","h2");
        Mail mail = getMockedMail(getMockedMimeMessage());
   
        // Get sure both headers are present
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER2));
   
        mailet.service(mail);
   
        // Both header should be removed
        assertNotNull("Header present",mail.getMessage().getHeader(HEADER1));
        assertNotNull("header present", mail.getMessage().getHeader(HEADER2));
    }
View Full Code Here

TOP

Related Classes of org.apache.mailet.base.GenericMailet

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.