Package org.apache.jsieve.utils

Examples of org.apache.jsieve.utils.SieveMailAdapter


    /**
     * Test for Test 'size'
     */
    public void testSizeIsUnderFalse() {
        boolean isTestPassed = false;
        SieveMailAdapter mail = null;
        int size = 0;
        try {
            mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().setText("Hi!");
            mail.getMessage().saveChanges();
            // Need to copy the mail to get JavaMail to report the message size
            // correctly (saveChanges() only saves the headers!)
            mail = (SieveMailAdapter) JUnitUtils.copyMail(mail);
            size = mail.getSize();
        } catch (SieveMailException e) {
        } catch (MessagingException e) {
        }

        String script = "if size :over " + new Integer(size).toString()
View Full Code Here


    /**
     * Test for Test 'size' with quantifier
     */
    public void testSizeIsWithQuantifier() throws Exception {
        boolean isTestPassed = false;
        SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
        mail.getMessage().setText("Hi!");
        mail.getMessage().saveChanges();
        // Need to copy the mail to get JavaMail to report the message size
        // correctly (saveChanges() only saves the headers!)
        mail = (SieveMailAdapter) JUnitUtils.copyMail(mail);

        String script = "if size :over 1G {throwTestException;}";
View Full Code Here

* Class BodyTest
*/
public class BodyTest extends TestCase {

    protected SieveMailAdapter textMail() throws MessagingException {
        SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
        mail.getMessage().setContent("Wibble\n\n" + "Wibble\n", "text/plain");
        return mail;
    }
View Full Code Here

        return mail;
    }

    protected SieveMailAdapter nonTextMail() throws MessagingException,
            SieveException {
        SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
        // FIXME: This doesn't work
        mail.getMessage().setContent(new MimeMultipart("image/png"));
        return mail;
    }
View Full Code Here

     */
    public void testHeaderIsTrue() {
        boolean isTestPassed = false;
        String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("X-Caffeine", "C8H10N4O2");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

     */
    public void testHeaderCaseInsensitivity() {
        boolean isTestPassed = false;
        String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("x-caffeine", "C8H10N4O2");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

     */
    public void testHeaderIsTrueMulti1() {
        boolean isTestPassed = false;
        String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] \"C8H10N4O2\" {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("X-Caffeine", "C8H10N4O2");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

     */
    public void testHeaderIsFalseMulti1() {
        boolean isTestPassed = false;
        String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] \"C8H10N4O2\" {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("X-Caffeine", "stuff");
            mail.getMessage().addHeader("X-Decaf", "more stuff");
            JUnitUtils.interpret(mail, script);
            isTestPassed = true;
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
        } catch (ParseException e) {
View Full Code Here

     */
    public void testHeaderIsTrueMulti2() {
        boolean isTestPassed = false;
        String script = "if header :is \"X-Caffeine\" [\"absent\", \"C8H10N4O2\"] {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("X-Caffeine", "C8H10N4O2");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

     */
    public void testHeaderIsTrueMulti3() {
        boolean isTestPassed = false;
        String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] [\"absent\", \"C8H10N4O2\"] {throwTestException;}";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("X-Caffeine", "stuff");
            mail.getMessage().addHeader("X-Decaf", "C8H10N4O2");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

TOP

Related Classes of org.apache.jsieve.utils.SieveMailAdapter

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.