Package org.apache.jsieve.utils

Examples of org.apache.jsieve.utils.SieveMailAdapter


public class QuotingTest extends TestCase {

    public void testQuoteInQuotedString() throws Exception {
        String script = "if header :is \"X-Test\" \"Before\\\"After\" {throwTestException;}";

        final SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils
                .createMail();
        mail.getMessage().addHeader("X-Test", "Before\"After");
        try {
            JUnitUtils.interpret(mail, script);
            fail("Expected header to be matched");
        } catch (ThrowTestException.TestException e) {
            // expected
View Full Code Here


    public void testExistsTrue() {
        boolean isTestPassed = false;
        String script = "if exists \"From\" {throwTestException;}";

        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("From", "tweety@pie");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

    public void testCaseInsensitivity() {
        boolean isTestPassed = false;
        String script = "if exists \"From\" {throwTestException;}";

        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("from", "tweety@pie");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

    public void testExistsTrueTrue() {
        boolean isTestPassed = false;
        String script = "if exists [\"From\", \"X-Files\"] {throwTestException;}";

        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("From", "tweety@pie");
            mail.getMessage().addHeader("X-Files", "spooks@everywhere");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

     */
    public void testExistsTrueFalse() {
        boolean isTestPassed = false;
        String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            mail.getMessage().addHeader("From", "tweety@pie");
            JUnitUtils.interpret(mail, script);
        } catch (MessagingException e) {
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
View Full Code Here

    public void testExistsFalse() {
        boolean isTestPassed = false;
        String script = "if exists \"From\" {stop;} throwTestException;";

        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

    public void testExistsFalseFalse() {
        boolean isTestPassed = false;
        String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";

        try {
            SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
            JUnitUtils.interpret(mail, script);
        } catch (ThrowTestException.TestException e) {
            isTestPassed = true;
        } catch (ParseException e) {
        } catch (SieveException e) {
View Full Code Here

    /**
     * Test for Test 'size'
     */
    public void testSizeIsOverTrue() {
        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 - 1).toString()
View Full Code Here

    /**
     * Test for Test 'size'
     */
    public void testSizeIsOverFalse() {
        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'
     */
    public void testSizeIsUnderTrue() {
        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 :under " + new Integer(size + 1).toString()
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.