Package org.apache.jsieve

Examples of org.apache.jsieve.ConfigurationManager


    public void init(MailetConfig config) throws MessagingException {
       
        super.init(config);

        try {
            final ConfigurationManager configurationManager = new ConfigurationManager();
            final int logLevel;
            if (verbose) {
                logLevel = CommonsLoggingAdapter.TRACE;
            } else if (quiet) {
                logLevel = CommonsLoggingAdapter.FATAL;
            } else {
                logLevel = CommonsLoggingAdapter.WARN;
            }
            log = new CommonsLoggingAdapter(this, logLevel);
            configurationManager.setLog(log);
            factory = configurationManager.build();
        } catch (SieveConfigurationException e) {
            throw new MessagingException("Failed to load standard Sieve configuration.", e);
        }
    }
View Full Code Here


    }

    public void testShouldGenerateXmlFromSimpleScript() throws Exception {
        // Set up
        final String script = "if address :all :is \"from\" \"user@domain\" {stop;}";
        final Node node = new ConfigurationManager().build().parse(new ByteArrayInputStream(script.getBytes()));
        final StringWriter monitor = new StringWriter();
       
        // Exercise
        OutputUtils.toXml(node, monitor);
       
View Full Code Here

        assertShouldRoundtripScript("fileinto [\"INBOX.test1\"]; fileinto [\"INBOX.test1\"];");
    }
   
    private void assertShouldRoundtripScript(final String script) throws Exception {
        // Set up
        final Node node = new ConfigurationManager().build().parse(new ByteArrayInputStream(script.getBytes()));
        final StringWriter monitor = new StringWriter();
       
        // Exercise
        OutputUtils.toSieve(node, monitor);
       
View Full Code Here

    private void traverse(String script) throws Exception {
        subject.traverse(handler, parse(script));
    }

    private Node parse(String script) throws Exception {
        return new ConfigurationManager().build().parse(
                new ByteArrayInputStream(script.getBytes()));
    }
View Full Code Here

        List<String> stringList = new ArrayList<String>();
        stringList.add("Whatever");
        List<Argument> argumentList = new ArrayList<Argument>();
        argumentList.add(new StringListArgument(stringList));
        dummyArguments = new Arguments(argumentList, new TestList(Collections.EMPTY_LIST));
        ConfigurationManager configurationManager = new ConfigurationManager();
        dummyContext = new BaseSieveContext(
                configurationManager.getCommandManager(), configurationManager
                        .getComparatorManager(), configurationManager
                        .getTestManager(), LogFactory
                        .getLog(this.getClass()));
        dummyContext.setCoordinate(new ScriptCoordinate(0, 0, 0, 0));
        subject = new FileInto();
    }
View Full Code Here

    OpenedAddress address;

    protected void setUp() throws Exception {
        super.setUp();
        ConfigurationManager configurationManager = new ConfigurationManager();
        context = new BaseSieveContext(
                configurationManager.getCommandManager(), configurationManager
                        .getComparatorManager(), configurationManager
                        .getTestManager(), LogFactory
                        .getLog(AddressParseTest.class));
        mail = (SieveMailAdapter) JUnitUtils.createMail();
        address = new OpenedAddress();
    }
View Full Code Here

        map.put("reject", "org.apache.jsieve.commands.optional.Reject");
        map.put("fileinto", "org.apache.jsieve.commands.optional.FileInto");

        boolean isTestPassed = false;
        try {
            Map commandMap = new ConfigurationManager().getCommandMap();

            Iterator mapIter = map.entrySet().iterator();
            while (mapIter.hasNext()) {
                Map.Entry entry = (Map.Entry) mapIter.next();
                assertTrue("Key: " + entry.getKey(), commandMap
View Full Code Here

        // RFC3082 - Implementations SHOULD support the "envelope" test.
        map.put("envelope", "org.apache.jsieve.tests.optional.Envelope");

        boolean isTestPassed = false;
        try {
            Map testMap = new ConfigurationManager().getTestMap();

            Iterator mapIter = map.entrySet().iterator();
            while (mapIter.hasNext()) {
                Map.Entry entry = (Map.Entry) mapIter.next();
                assertTrue("Key: " + entry.getKey(), testMap.containsKey(entry
View Full Code Here

                .put("i;ascii-casemap",
                        "org.apache.jsieve.comparators.AsciiCasemap");

        boolean isTestPassed = false;
        try {
            Map comparatorMap = new ConfigurationManager().getComparatorMap();

            Iterator mapIter = map.entrySet().iterator();
            while (mapIter.hasNext()) {
                Map.Entry entry = (Map.Entry) mapIter.next();
                assertTrue("Key: " + entry.getKey(), comparatorMap
View Full Code Here

     * @throws SieveException
     * @throws ParseException
     */
    static public void interpret(MailAdapter mail, String script)
            throws SieveException, ParseException {
        new ConfigurationManager().build().interpret(mail,
                new ByteArrayInputStream(script.getBytes()));
    }
View Full Code Here

TOP

Related Classes of org.apache.jsieve.ConfigurationManager

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.